Skip to content

Commit

Permalink
Detect if already running
Browse files Browse the repository at this point in the history
  • Loading branch information
FemLolStudio committed May 8, 2023
1 parent e2b8a59 commit 6b245ec
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Gacha Plus Launcher/GachaPlusForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ await Task.Run(() =>
process.WaitForInputIdle(); // wait for process to be fully loaded
Task.Delay(3000).Wait();

if (process.HasExited)
throw new Exception("Gacha Plus (or ither Gacha Club mod) is already running!");

if (fullscreen_checkBox.Checked)
else if (fullscreen_checkBox.Checked)
{
// set window to full screen
IntPtr handle = process.MainWindowHandle; // get the window handle
Expand All @@ -209,7 +211,8 @@ await Task.Run(() =>
OtherFunctions.CustomMessageBoxShow($"Failed to start: {ex.Message}");

// if something wrong its remove the wrong files and the launcher will reinstall the game on the next startup
OtherFunctions.DeleteDirectory(ExtractedDirName);
if(!ex.Message.EndsWith("is already running!"))
OtherFunctions.DeleteDirectory(ExtractedDirName);

DownloadingEndUI();
}
Expand Down

0 comments on commit 6b245ec

Please sign in to comment.