Add debug code and update version
This commit is contained in:
parent
4eeec67ac4
commit
62963b6fd2
2 changed files with 12 additions and 1 deletions
|
@ -109,6 +109,7 @@ namespace TBMM
|
|||
|
||||
private void HandleGameExit(object sender, EventArgs e)
|
||||
{
|
||||
Debug.WriteLine("Handling game exit");
|
||||
_gameProcess = (null, false);
|
||||
if (InvokeMethod(CheckIfPatched) != GameState.Patched || Configuration.KeepPatched)
|
||||
return;
|
||||
|
@ -128,27 +129,37 @@ namespace TBMM
|
|||
|
||||
private bool CheckIfGameIsRunning()
|
||||
{
|
||||
Debug.WriteLine($"Check if game is running: {_gameProcess}");
|
||||
switch (_gameProcess.Process)
|
||||
{
|
||||
case { HasExited: false }:
|
||||
Debug.WriteLine("Game has not exited");
|
||||
return true;
|
||||
case { HasExited: true }:
|
||||
Debug.WriteLine("Game has exited, dialog shown");
|
||||
MessageBox.Show("Game has exited without handling... Please report.");
|
||||
HandleGameExit(null, EventArgs.Empty);
|
||||
return false;
|
||||
default:
|
||||
Debug.WriteLine($"Process seems to be null: {_gameProcess}");
|
||||
if (_gameProcess.Process?.HasExited ?? true)
|
||||
{
|
||||
_gameProcess = (Process.GetProcessesByName(GetExe(withExtension: false)).FirstOrDefault(), false);
|
||||
Debug.WriteLine($"Game process exited already, got new process object: {_gameProcess}");
|
||||
}
|
||||
|
||||
if (_gameProcess.Process == null) return false;
|
||||
if (_gameProcess.Process.HasExited)
|
||||
{
|
||||
Debug.WriteLine($"Game has exited already: {_gameProcess}");
|
||||
HandleGameExit(null, EventArgs.Empty);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.WriteLine($"Game is still running");
|
||||
if (_gameProcess.ExitHandlerAdded) return true;
|
||||
Debug.WriteLine("Game running and no exit handler yet, adding it");
|
||||
_gameProcess.Process.Exited += HandleGameExit;
|
||||
_gameProcess.Process.EnableRaisingEvents = true;
|
||||
_gameProcess.ExitHandlerAdded = true;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
<ApplicationIcon>favicon.ico</ApplicationIcon>
|
||||
<Version>1.5.0</Version>
|
||||
<Version>1.6.0</Version>
|
||||
<Authors>NorbiPeti</Authors>
|
||||
<Company>ExMods</Company>
|
||||
<Description>A mod manager for Techblox. It automatically downloads and runs GCIPA and allows the user to install mods.</Description>
|
||||
|
|
Loading…
Reference in a new issue