Skip to content

Commit

Permalink
regression: 进程已退出
Browse files Browse the repository at this point in the history
  • Loading branch information
imba-tjd committed Feb 9, 2023
1 parent e70a862 commit 2d53e3a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions MisakaTranslator-WPF/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
[assembly : AssemblyCulture("")]
[assembly : ComVisible(false)]
[assembly : ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
[assembly : AssemblyVersion("2.12.0.0")]
[assembly : AssemblyFileVersion("2.12.0.0")]
[assembly : AssemblyVersion("2.12.1.0")]
[assembly : AssemblyFileVersion("2.12.1.0")]
3 changes: 2 additions & 1 deletion TextHookLibrary/ProcessHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ public static string FindProcessPath(int pid, bool isx64game = false)
foreach (var p in Process.GetProcesses())
using (p)
try { l.Add((p.Id, p.MainModule.FileName)); }
catch (System.ComponentModel.Win32Exception) { }
catch (System.ComponentModel.Win32Exception) { } // 无权限
catch (InvalidOperationException) { } // 进程已退出
return l;
}
}
Expand Down
12 changes: 8 additions & 4 deletions Tools/ProcessHelperExt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@
if (args.Length == 1)
{
int pid = int.Parse(args[0]);
Process p;
try { p = Process.GetProcessById(pid); }
catch (System.ArgumentException) { return 3; } // 不存在pid对应的进程
Console.WriteLine(p.MainModule.FileName);
try
{
Process p = Process.GetProcessById(pid);
Console.WriteLine(p.MainModule.FileName);
}
catch (ArgumentException) { return 3; } // 不存在pid对应的进程
catch (InvalidOperationException) { return 3; } // 进程已退出
}
else
foreach (var p in Process.GetProcesses())
try { Console.WriteLine("{0}|{1}", p.Id, p.MainModule.FileName); }
catch (System.ComponentModel.Win32Exception) { } // 跳过权限不够的进程
catch (InvalidOperationException) { } // 进程已退出

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
This is AutoUpdateCheck's Page.
LatestVersion[2.12.0.0]
LatestVersion[2.12.1.0]
DownloadPath[https://github.com/hanmin0822/MisakaTranslator/releases]

0 comments on commit 2d53e3a

Please sign in to comment.