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.Threading.Tasks;
using System.Windows.Threading;
using CrashReporterDotNET;
using System;
namespace NaturalLauncher
{
@ -8,5 +12,45 @@ namespace NaturalLauncher
/// </summary>
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.Resources;
namespace NaturalLauncher
{
/// <summary>
/// Logique d'interaction pour MainWindow.xaml
/// </summary>
///
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
}
}

View file

@ -71,6 +71,9 @@
<SignManifests>true</SignManifests>
</PropertyGroup>
<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">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\DiscordRPC.dll</HintPath>

View file

@ -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,7 +434,7 @@ namespace NaturalLauncher
string IgnoreString = File.ReadAllText(IgnorePath);
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...");
NewManifest.Files["/config.cfg"] = "";*/
@ -440,7 +442,7 @@ namespace NaturalLauncher
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 !");
}
}

View file

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