Skip to content
This repository has been archived by the owner on Apr 15, 2020. It is now read-only.

Commit

Permalink
Change exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
goaaats committed Dec 16, 2018
1 parent 6de506e commit 159d4eb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions FFXIVRichPresenceRunner/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
Expand Down Expand Up @@ -36,8 +37,7 @@ private static void Main(string[] args)

AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs eventArgs)
{
MessageBox.Show("RichPresence mod ran into an error:\n\n" + eventArgs.ExceptionObject,
"FFXIV RichPresence", MessageBoxButtons.OK, MessageBoxIcon.Error);
File.WriteAllText("RichPresenceException.txt", eventArgs.ExceptionObject.ToString());

Process.GetCurrentProcess().Kill();
};
Expand Down Expand Up @@ -93,6 +93,12 @@ public static async void Run()

while (true)
{
if (!DoesFfxivProcessExist())
{
discordManager.Deinitialize();
Environment.Exit(0);
}

game.Update();

if (game.ActorTable == null)
Expand Down Expand Up @@ -139,12 +145,6 @@ public static async void Run()


Thread.Sleep(1000);

if (!DoesFfxivProcessExist())
{
discordManager.Deinitialize();
Environment.Exit(0);
}
}
}
}
Expand Down

0 comments on commit 159d4eb

Please sign in to comment.