now sending crash dumps ! -> 1.0.1.4

This commit is contained in:
Mael-fixe 2018-08-28 01:46:25 +02:00
parent 72d315accc
commit 0f68abd8b0
5 changed files with 64 additions and 9 deletions

View file

@ -1,5 +1,9 @@
 
using System.Windows; using System.Windows;
using System.Threading.Tasks;
using System.Windows.Threading;
using CrashReporterDotNET;
using System;
namespace NaturalLauncher namespace NaturalLauncher
{ {
@ -8,5 +12,45 @@ namespace NaturalLauncher
/// </summary> /// </summary>
public partial class App : Application 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);
}
} }
} }

View file

@ -35,11 +35,13 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Resources; using System.Windows.Resources;
namespace NaturalLauncher namespace NaturalLauncher
{ {
/// <summary> /// <summary>
/// Logique d'interaction pour MainWindow.xaml /// Logique d'interaction pour MainWindow.xaml
/// </summary> /// </summary>
///
public partial class MainWindow : Window 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). // 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; IsDebugMode = true;
#endif #endif
// Self Updater
SelfUpdater.DeleteOldFiles(); // not really needed since CleanAndLaunch.exe SelfUpdater.DeleteOldFiles(); // not really needed since CleanAndLaunch.exe
SelfUpdater TheSelfUpdater = new SelfUpdater(); SelfUpdater TheSelfUpdater = new SelfUpdater();
TheSelfUpdater.SetMainWindowRef(this); TheSelfUpdater.SetMainWindowRef(this);
TheSelfUpdater.UpdateLauncher(); TheSelfUpdater.UpdateLauncher();
if (SelfUpdater.LaucherRemoteVNumber != SelfUpdater.LaucherLocalVNumber && SelfUpdater.isSelfUpdating) if (SelfUpdater.LaucherRemoteVNumber != SelfUpdater.LaucherLocalVNumber && SelfUpdater.isSelfUpdating)
{ {
this.Hide(); this.Hide();
@ -216,7 +218,7 @@ namespace NaturalLauncher
} }
} }
#region clicks #region Clicks
private void Start_Click(object sender, RoutedEventArgs e) private void Start_Click(object sender, RoutedEventArgs e)
{ {
if (SelfUpdater.CheckOneFileSignature("NaturalLauncher.exe") || !SelfUpdater.isSelfUpdating) if (SelfUpdater.CheckOneFileSignature("NaturalLauncher.exe") || !SelfUpdater.isSelfUpdating)
@ -658,4 +660,5 @@ namespace NaturalLauncher
#endregion #endregion
} }
} }

View file

@ -71,6 +71,9 @@
<SignManifests>true</SignManifests> <SignManifests>true</SignManifests>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="CrashReporter.NET, Version=1.5.5.0, Culture=neutral, PublicKeyToken=7828e0fd88cab698, processorArchitecture=MSIL">
<HintPath>..\packages\CrashReporter.NET.Official.1.5.5\lib\net462\CrashReporter.NET.dll</HintPath>
</Reference>
<Reference Include="DiscordRPC, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="DiscordRPC, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\DiscordRPC.dll</HintPath> <HintPath>..\packages\DiscordRPC.dll</HintPath>

View file

@ -148,12 +148,13 @@ namespace NaturalLauncher
rv = s; rv = s;
} }
} }
catch (Exception) catch (Exception exception)
{ {
// Anything could have happened here but // Anything could have happened here but
// we don't want to stop the user // we don't want to stop the user
// from using the application. // from using the application.
rv = null; rv = null;
App.SendReport(exception, "Couldnt Find the Remote Version of NS");
} }
return rv; 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); MessageBoxResult AlertBox = MessageBox.Show("HL Folder not found","Alert", MessageBoxButton.OK , MessageBoxImage.Error);
App.SendReport(exception, "Couldnt Find the Remote Version of NS");
path = ""; path = "";
} }
@ -432,15 +434,15 @@ namespace NaturalLauncher
string IgnoreString = File.ReadAllText(IgnorePath); string IgnoreString = File.ReadAllText(IgnorePath);
NewManifest = JsonConvert.DeserializeObject<LauncherManifest>(IgnoreString); NewManifest = JsonConvert.DeserializeObject<LauncherManifest>(IgnoreString);
} }
catch catch(Exception exception)
{ {
/*MessageBoxResult AlertBox = System.Windows.MessageBox.Show("Could not retrieve a new ignore manifest file, Creating a void one..."); /*MessageBoxResult AlertBox = System.Windows.MessageBox.Show("Could not retrieve a new ignore manifest file, Creating a void one...");
NewManifest.Files["/config.cfg"] = "";*/ NewManifest.Files["/config.cfg"] = "";*/
Util.PlaySoundFX("error"); 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..." 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); , "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 // then we read the custom one on the disk
@ -605,9 +607,10 @@ namespace NaturalLauncher
File.WriteAllLines(Launcher.NSFolder + Path.DirectorySeparatorChar + "config.cfg", CfgLines); 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); 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 try
{ {
@ -616,10 +619,11 @@ namespace NaturalLauncher
File.WriteAllLines(Launcher.NSFolder + Path.DirectorySeparatorChar + "userconfig.cfg", UCfgLines); 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 + 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); "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 !");
} }
} }

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="CrashReporter.NET.Official" version="1.5.5" targetFramework="net462" />
<package id="HtmlAgilityPack" version="1.8.5" targetFramework="net462" /> <package id="HtmlAgilityPack" version="1.8.5" targetFramework="net462" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net462" /> <package id="Newtonsoft.Json" version="11.0.2" targetFramework="net462" />
<package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net462" /> <package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net462" />