Skip to content

Commit

Permalink
KillEntireProcessTree
Browse files Browse the repository at this point in the history
  • Loading branch information
AigioL committed May 5, 2022
1 parent 5c2fca9 commit c5400dc
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
18 changes: 9 additions & 9 deletions SteamToolsV2+.sln
Original file line number Diff line number Diff line change
Expand Up @@ -2114,20 +2114,20 @@ Global
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Debug|x64.Build.0 = Debug|x64
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Debug|x86.ActiveCfg = Debug|x86
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Debug|x86.Build.0 = Debug|x86
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Release|Any CPU.Build.0 = Release|Any CPU
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Release|Any CPU.ActiveCfg = Release|x64
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Release|Any CPU.Build.0 = Release|x64
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Release|ARM.ActiveCfg = Release|Any CPU
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Release|ARM.Build.0 = Release|Any CPU
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Release|ARM64.ActiveCfg = Release|Any CPU
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Release|ARM64.Build.0 = Release|Any CPU
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Release|ARM64.ActiveCfg = Release|arm64
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Release|ARM64.Build.0 = Release|arm64
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Release|iPhone.ActiveCfg = Release|Any CPU
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Release|iPhone.Build.0 = Release|Any CPU
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Release|x64.ActiveCfg = Release|Any CPU
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Release|x64.Build.0 = Release|Any CPU
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Release|x86.ActiveCfg = Release|Any CPU
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Release|x86.Build.0 = Release|Any CPU
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Release|x64.ActiveCfg = Release|x64
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Release|x64.Build.0 = Release|x64
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Release|x86.ActiveCfg = Release|x86
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -2205,7 +2205,7 @@ Global
{7E7C34F0-1391-473C-8A1C-CE3EAF5D66DB} = {1B889C56-157A-4493-85F2-76366282B002}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9313F2B4-10DA-43AA-A481-CAA7571C740C}
RESX_NeutralResourcesLanguage = zh-Hans
SolutionGuid = {9313F2B4-10DA-43AA-A481-CAA7571C740C}
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion src/Common.CoreLib/Process2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static class Process2
/// <para>或 参数的长度与该进程的完整路径的长度的总和超过了 2080。 与此异常关联的错误消息可能为以下消息之一:“传递到系统调用的数据区域太小。” 或“拒绝访问。”</para>
/// </exception>
/// <exception cref="PlatformNotSupportedException">不支持 shell 的操作系统(如,仅适用于.NET Core 的 Nano Server)不支持此方法</exception>
public static Process? Start(string fileName, string? arguments = null, bool useShellExecute = false, string? workingDirectory = null, IDictionary<string, string>? environment = null)
public static Process? Start(string fileName, string? arguments = null, bool useShellExecute = false, string? workingDirectory = null, IReadOnlyDictionary<string, string>? environment = null)
{
if (string.IsNullOrEmpty(fileName)) return null;
var p = new ProcessStartInfo(fileName);
Expand Down
16 changes: 8 additions & 8 deletions src/ST.Client/Models/Steam/SteamApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -760,10 +760,10 @@ public SteamApp ExtractReaderProperty(SteamAppPropertyTable properties, uint[]?

if (launchTable != null)
{
var launchItems = from table in (from prop in (from prop in launchTable.Properties
where prop.PropertyType == SteamAppPropertyType.Table
select prop).OrderBy((SteamAppProperty prop) => prop.Name, StringComparer.OrdinalIgnoreCase)
select prop.GetValue<SteamAppPropertyTable>())
var launchItems = from table in from prop in (from prop in launchTable.Properties
where prop.PropertyType == SteamAppPropertyType.Table
select prop).OrderBy((SteamAppProperty prop) => prop.Name, StringComparer.OrdinalIgnoreCase)
select prop.GetValue<SteamAppPropertyTable>()
select new SteamAppLaunchItem
{
Label = table.GetPropertyValue<string?>("description"),
Expand All @@ -785,10 +785,10 @@ select prop.GetValue<SteamAppPropertyTable>())

if (savefilesTable != null)
{
var savefiles = from table in (from prop in (from prop in savefilesTable.Properties
where prop.PropertyType == SteamAppPropertyType.Table
select prop).OrderBy((SteamAppProperty prop) => prop.Name, StringComparer.OrdinalIgnoreCase)
select prop.GetValue<SteamAppPropertyTable>())
var savefiles = from table in from prop in (from prop in savefilesTable.Properties
where prop.PropertyType == SteamAppPropertyType.Table
select prop).OrderBy((SteamAppProperty prop) => prop.Name, StringComparer.OrdinalIgnoreCase)
select prop.GetValue<SteamAppPropertyTable>()
select new SteamAppSaveFile
(
AppId,
Expand Down
2 changes: 1 addition & 1 deletion src/ST.Client/Services/Mvvm/SteamConnectService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ public void Dispose()
{
if (app.Process != null)
if (!app.Process.HasExited)
app.Process.Kill();
app.Process.KillEntireProcessTree();
}
DisposeSteamClient();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void DeleteAllButton_Click()
SteamConnectService.Current.RuningSteamApps.TryGetValue(item.Key, out var runState);
if (runState != null)
{
runState.Process?.Kill();
runState.Process?.KillEntireProcessTree();
SteamConnectService.Current.RuningSteamApps.TryRemove(item.Key, out runState);
}
}
Expand Down Expand Up @@ -135,7 +135,7 @@ public void DeleteButton_Click(SteamApp app)
SteamConnectService.Current.RuningSteamApps.TryGetValue(app.AppId, out var runState);
if (runState != null)
{
runState.Process?.Kill();
runState.Process?.KillEntireProcessTree();
SteamConnectService.Current.RuningSteamApps.TryRemove(app.AppId, out runState);
}
MainThread2.BeginInvokeOnMainThread(() =>
Expand Down Expand Up @@ -203,7 +203,7 @@ public async void RunOrStopAllButton_Click()
SteamConnectService.Current.RuningSteamApps.TryGetValue(item.AppId, out var runState);
if (runState != null)
{
runState.Process?.Kill();
runState.Process?.KillEntireProcessTree();
SteamConnectService.Current.RuningSteamApps.TryRemove(item.AppId, out var remove);
item.Process = null;
}
Expand Down Expand Up @@ -261,7 +261,7 @@ public void RunOrStop(SteamApp app)
}
else
{
app.Process.Kill();
app.Process.KillEntireProcessTree();
app.Process = null;
}
}
Expand Down Expand Up @@ -301,7 +301,7 @@ public void Refresh_Click()
else
{
SteamConnectService.Current.RuningSteamApps.TryGetValue(item.Key, out var runState);
runState?.Process?.Kill();
runState?.Process?.KillEntireProcessTree();
list.Add(new SteamApp
{
AppId = item.Key,
Expand Down

0 comments on commit c5400dc

Please sign in to comment.