diff --git a/NaturalLauncher/App.xaml.cs b/NaturalLauncher/App.xaml.cs
index 3f76b19..2f0ebf9 100644
--- a/NaturalLauncher/App.xaml.cs
+++ b/NaturalLauncher/App.xaml.cs
@@ -1,5 +1,9 @@
using System.Windows;
+using System.Threading.Tasks;
+using System.Windows.Threading;
+using CrashReporterDotNET;
+using System;
namespace NaturalLauncher
{
@@ -8,5 +12,45 @@ namespace NaturalLauncher
///
public partial class App : Application
{
+ protected override void OnStartup(StartupEventArgs e)
+ {
+ base.OnStartup(e);
+ AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
+ Application.Current.DispatcherUnhandledException += DispatcherOnUnhandledException;
+ TaskScheduler.UnobservedTaskException += TaskSchedulerOnUnobservedTaskException;
+ }
+
+ private void TaskSchedulerOnUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs unobservedTaskExceptionEventArgs)
+ {
+ SendReport(unobservedTaskExceptionEventArgs.Exception);
+ Environment.Exit(0);
+ }
+
+ private void DispatcherOnUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs dispatcherUnhandledExceptionEventArgs)
+ {
+ SendReport(dispatcherUnhandledExceptionEventArgs.Exception);
+ Environment.Exit(0);
+ }
+
+ private static void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs unhandledExceptionEventArgs)
+ {
+ SendReport((Exception)unhandledExceptionEventArgs.ExceptionObject);
+ Environment.Exit(0);
+ }
+
+ public static void SendReport(Exception exception, string developerMessage = "")
+ {
+ var reportCrash = new ReportCrash("mael.vignaux@elseware-experience.com"); // mail to send crash dumps to
+ reportCrash.DeveloperMessage = developerMessage;
+ reportCrash.DoctorDumpSettings = new DoctorDumpSettings
+ {
+ ApplicationID = new Guid("abac8312-371a-4fad-aa9d-b4b0cd5d11ab"),
+ };
+ /*var reportCrash = new ReportCrash("Email where you want to receive crash reports.")
+ {
+ DeveloperMessage = developerMessage
+ };*/
+ reportCrash.Send(exception);
+ }
}
}
diff --git a/NaturalLauncher/MainWindow.xaml.cs b/NaturalLauncher/MainWindow.xaml.cs
index bd0fe0f..f44f858 100644
--- a/NaturalLauncher/MainWindow.xaml.cs
+++ b/NaturalLauncher/MainWindow.xaml.cs
@@ -35,11 +35,13 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Resources;
+
namespace NaturalLauncher
{
///
/// Logique d'interaction pour MainWindow.xaml
///
+ ///
public partial class MainWindow : Window
{
// TODO We need to know if ns files are being updated to lock the verify/update functions if so (with a file on the main serv).
@@ -78,13 +80,13 @@ namespace NaturalLauncher
IsDebugMode = true;
#endif
+ // Self Updater
SelfUpdater.DeleteOldFiles(); // not really needed since CleanAndLaunch.exe
SelfUpdater TheSelfUpdater = new SelfUpdater();
TheSelfUpdater.SetMainWindowRef(this);
TheSelfUpdater.UpdateLauncher();
-
if (SelfUpdater.LaucherRemoteVNumber != SelfUpdater.LaucherLocalVNumber && SelfUpdater.isSelfUpdating)
{
this.Hide();
@@ -216,7 +218,7 @@ namespace NaturalLauncher
}
}
- #region clicks
+ #region Clicks
private void Start_Click(object sender, RoutedEventArgs e)
{
if (SelfUpdater.CheckOneFileSignature("NaturalLauncher.exe") || !SelfUpdater.isSelfUpdating)
@@ -658,4 +660,5 @@ namespace NaturalLauncher
#endregion
}
+
}
diff --git a/NaturalLauncher/NaturalLauncher.csproj b/NaturalLauncher/NaturalLauncher.csproj
index 9de3a1f..3882a5e 100644
--- a/NaturalLauncher/NaturalLauncher.csproj
+++ b/NaturalLauncher/NaturalLauncher.csproj
@@ -71,6 +71,9 @@
true
+
+ ..\packages\CrashReporter.NET.Official.1.5.5\lib\net462\CrashReporter.NET.dll
+
False
..\packages\DiscordRPC.dll
diff --git a/NaturalLauncher/Util.cs b/NaturalLauncher/Util.cs
index 6c06b21..673b52d 100644
--- a/NaturalLauncher/Util.cs
+++ b/NaturalLauncher/Util.cs
@@ -148,12 +148,13 @@ namespace NaturalLauncher
rv = s;
}
}
- catch (Exception)
+ catch (Exception exception)
{
// Anything could have happened here but
// we don't want to stop the user
// from using the application.
rv = null;
+ App.SendReport(exception, "Couldnt Find the Remote Version of NS");
}
return rv;
}
@@ -261,9 +262,10 @@ namespace NaturalLauncher
}
}
}
- catch
+ catch(Exception exception)
{
MessageBoxResult AlertBox = MessageBox.Show("HL Folder not found","Alert", MessageBoxButton.OK , MessageBoxImage.Error);
+ App.SendReport(exception, "Couldnt Find the Remote Version of NS");
path = "";
}
@@ -432,15 +434,15 @@ namespace NaturalLauncher
string IgnoreString = File.ReadAllText(IgnorePath);
NewManifest = JsonConvert.DeserializeObject(IgnoreString);
}
- catch
+ catch(Exception exception)
{
/*MessageBoxResult AlertBox = System.Windows.MessageBox.Show("Could not retrieve a new ignore manifest file, Creating a void one...");
NewManifest.Files["/config.cfg"] = "";*/
Util.PlaySoundFX("error");
MessageBoxResult AlertBox = System.Windows.MessageBox.Show("Launcher couldn't find a correct ignore.list from online source, please verify you internet connection..."
, "Alert", MessageBoxButton.OK, MessageBoxImage.Error);
-
- throw new Exception("Launcher couldn't find a correct ignore.list from online source, please verify you internet connection...");
+
+ App.SendReport(exception, "Launcher couldn't find a correct ignore.list from online source, please verify you internet connection...");
}
}
// then we read the custom one on the disk
@@ -605,9 +607,10 @@ namespace NaturalLauncher
File.WriteAllLines(Launcher.NSFolder + Path.DirectorySeparatorChar + "config.cfg", CfgLines);
}
}
- catch
+ catch(Exception exception)
{
System.Windows.MessageBox.Show("Could not write config.cfg, please verify the file is not read only !", "Read only", MessageBoxButton.OK, MessageBoxImage.Error);
+ App.SendReport(exception, "Could not write config.cfg, please verify the file is not read only !");
}
try
{
@@ -616,10 +619,11 @@ namespace NaturalLauncher
File.WriteAllLines(Launcher.NSFolder + Path.DirectorySeparatorChar + "userconfig.cfg", UCfgLines);
}
}
- catch
+ catch (Exception exception)
{
System.Windows.MessageBox.Show("Could not write userconfig.cfg, please verify the file is not read only !" + Environment.NewLine +
"This problem may also be caused by a hud_style setting in your userconfig.cfg file !", "Read only", MessageBoxButton.OK, MessageBoxImage.Error);
+ App.SendReport(exception, "Could not write userconfig.cfg, please verify the file is not read only !");
}
}
diff --git a/NaturalLauncher/packages.config b/NaturalLauncher/packages.config
index 4a51347..8c303d8 100644
--- a/NaturalLauncher/packages.config
+++ b/NaturalLauncher/packages.config
@@ -1,5 +1,6 @@
+