Skip to content

Commit

Permalink
feat: force quit hlae process before launching csgo
Browse files Browse the repository at this point in the history
  • Loading branch information
akiver committed Jul 12, 2022
1 parent e95da19 commit 2d72473
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions Services/Concrete/GameLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ public async Task StartGame()
throw new HlaeNotFound();
}

KillHlae();

_arguments.Add(_config.LaunchParameters);
List<string> argList = new List<string>(_hlaeArguments)
{
Expand Down Expand Up @@ -610,12 +612,27 @@ private static string GetFastForwardMessage(EquipmentElement type)
}
}

private static void KillHlae()
{
KillProcessByName("HLAE");
}

private static void KillCsgo()
{
Process[] currentProcess = Process.GetProcessesByName("csgo");
if (currentProcess.Length > 0)
KillProcessByName("csgo");
}

private static void KillProcessByName(string processName)
{
Process[] processes = Process.GetProcessesByName(processName);
if (processes.Length > 0)
{
currentProcess[0].Kill();
var process = processes[0];
if (!process.HasExited)
{
process.Kill();
process.WaitForExit();
}
}
}

Expand Down

0 comments on commit 2d72473

Please sign in to comment.