From a5d6817429b9a4ab80314cfcded9ac9df6ae52b6 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Sun, 10 Dec 2017 12:05:51 +0100 Subject: [PATCH] Added Sentry integration --- .../Classes/Core.cs | 5 ++ .../DML.Application.csproj | 3 + .../MainForm.Designer.cs | 84 +++++++++---------- Discord Media Loader.Application/MainForm.cs | 1 + Discord Media Loader.Application/app.config | 4 + .../packages.config | 1 + Discord Media Loader/App.config | 4 + 7 files changed, 60 insertions(+), 42 deletions(-) diff --git a/Discord Media Loader.Application/Classes/Core.cs b/Discord Media Loader.Application/Classes/Core.cs index 01ad7e7..c1e5878 100644 --- a/Discord Media Loader.Application/Classes/Core.cs +++ b/Discord Media Loader.Application/Classes/Core.cs @@ -12,6 +12,8 @@ using DML.AppCore.Classes; using DML.Application.Dialogs; using DML.Client; using LiteDB; +using SharpRaven; +using SharpRaven.Data; using SweetLib.Utils; using SweetLib.Utils.Logger; using SweetLib.Utils.Logger.Memory; @@ -25,6 +27,7 @@ namespace DML.Application.Classes internal static LiteDatabase Database { get; set; } internal static Settings Settings { get; set; } internal static JobScheduler Scheduler { get; } = new JobScheduler(); + internal static RavenClient Raven = new RavenClient("https://0de964231669473e9098b9f6cc1d6278:79d9f2eb24034de199b2a37cc058e0f2@sentry.io/257114"); internal static string DataDirectory => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"Serraniel\Discord Media Loader"); @@ -268,6 +271,8 @@ namespace DML.Application.Classes catch (Exception ex) { Logger.Error($"{ex.Message} occured at: {ex.StackTrace}"); + if (MessageBox.Show($"An error occured while running Discord Media Loader:\n{ex.GetType().Name}: {ex.Message}\n\nDo you aggree to sending the error report to the creator of the tool?", "Discord Media Loader", MessageBoxButtons.YesNo) == DialogResult.Yes) + Raven.Capture(new SentryEvent(ex)); } } diff --git a/Discord Media Loader.Application/DML.Application.csproj b/Discord Media Loader.Application/DML.Application.csproj index 32a438f..02bf1f5 100644 --- a/Discord Media Loader.Application/DML.Application.csproj +++ b/Discord Media Loader.Application/DML.Application.csproj @@ -80,6 +80,9 @@ ..\packages\RestSharp.105.2.3\lib\net46\RestSharp.dll True + + ..\packages\SharpRaven.2.2.0\lib\net45\SharpRaven.dll + ..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll diff --git a/Discord Media Loader.Application/MainForm.Designer.cs b/Discord Media Loader.Application/MainForm.Designer.cs index 310b0ce..4b17af7 100644 --- a/Discord Media Loader.Application/MainForm.Designer.cs +++ b/Discord Media Loader.Application/MainForm.Designer.cs @@ -48,15 +48,15 @@ this.statusStrip = new System.Windows.Forms.StatusStrip(); this.pgbProgress = new System.Windows.Forms.ToolStripProgressBar(); this.lbProgress = new System.Windows.Forms.ToolStripStatusLabel(); + this.lblVersionPlaceholder = new System.Windows.Forms.ToolStripStatusLabel(); + this.lbVersion = new System.Windows.Forms.ToolStripStatusLabel(); + this.btnDropDown = new System.Windows.Forms.ToolStripSplitButton(); + this.visitGithubToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.btnDelete = new System.Windows.Forms.Button(); this.lbxJobs = new System.Windows.Forms.ListBox(); this.tmrRefreshProgress = new System.Windows.Forms.Timer(this.components); - this.lblVersionPlaceholder = new System.Windows.Forms.ToolStripStatusLabel(); - this.lbVersion = new System.Windows.Forms.ToolStripStatusLabel(); - this.btnDropDown = new System.Windows.Forms.ToolStripSplitButton(); - this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.visitGithubToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pnlSettings.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.edThreadLimit)).BeginInit(); this.groupBox1.SuspendLayout(); @@ -257,6 +257,43 @@ this.lbProgress.Name = "lbProgress"; this.lbProgress.Size = new System.Drawing.Size(0, 17); // + // lblVersionPlaceholder + // + this.lblVersionPlaceholder.Name = "lblVersionPlaceholder"; + this.lblVersionPlaceholder.Size = new System.Drawing.Size(302, 17); + this.lblVersionPlaceholder.Spring = true; + // + // lbVersion + // + this.lbVersion.Name = "lbVersion"; + this.lbVersion.Size = new System.Drawing.Size(118, 17); + this.lbVersion.Text = "v https://github.com"; + // + // btnDropDown + // + this.btnDropDown.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.btnDropDown.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.visitGithubToolStripMenuItem, + this.aboutToolStripMenuItem}); + this.btnDropDown.ImageTransparentColor = System.Drawing.Color.Magenta; + this.btnDropDown.Name = "btnDropDown"; + this.btnDropDown.Size = new System.Drawing.Size(16, 20); + this.btnDropDown.Text = "Options"; + // + // visitGithubToolStripMenuItem + // + this.visitGithubToolStripMenuItem.Name = "visitGithubToolStripMenuItem"; + this.visitGithubToolStripMenuItem.Size = new System.Drawing.Size(135, 22); + this.visitGithubToolStripMenuItem.Text = "Visit Github"; + this.visitGithubToolStripMenuItem.Click += new System.EventHandler(this.visitGithubToolStripMenuItem_Click); + // + // aboutToolStripMenuItem + // + this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(135, 22); + this.aboutToolStripMenuItem.Text = "About"; + this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); + // // groupBox2 // this.groupBox2.Controls.Add(this.btnDelete); @@ -297,43 +334,6 @@ this.tmrRefreshProgress.Interval = 500; this.tmrRefreshProgress.Tick += new System.EventHandler(this.tmrRefreshProgress_Tick); // - // lblVersionPlaceholder - // - this.lblVersionPlaceholder.Name = "lblVersionPlaceholder"; - this.lblVersionPlaceholder.Size = new System.Drawing.Size(271, 17); - this.lblVersionPlaceholder.Spring = true; - // - // lbVersion - // - this.lbVersion.Name = "lbVersion"; - this.lbVersion.Size = new System.Drawing.Size(118, 17); - this.lbVersion.Text = "v https://github.com"; - // - // btnDropDown - // - this.btnDropDown.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.btnDropDown.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.visitGithubToolStripMenuItem, - this.aboutToolStripMenuItem}); - this.btnDropDown.ImageTransparentColor = System.Drawing.Color.Magenta; - this.btnDropDown.Name = "btnDropDown"; - this.btnDropDown.Size = new System.Drawing.Size(16, 20); - this.btnDropDown.Text = "Options"; - // - // aboutToolStripMenuItem - // - this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; - this.aboutToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.aboutToolStripMenuItem.Text = "About"; - this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); - // - // visitGithubToolStripMenuItem - // - this.visitGithubToolStripMenuItem.Name = "visitGithubToolStripMenuItem"; - this.visitGithubToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.visitGithubToolStripMenuItem.Text = "Visit Github"; - this.visitGithubToolStripMenuItem.Click += new System.EventHandler(this.visitGithubToolStripMenuItem_Click); - // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/Discord Media Loader.Application/MainForm.cs b/Discord Media Loader.Application/MainForm.cs index 7d629b9..44479ec 100644 --- a/Discord Media Loader.Application/MainForm.cs +++ b/Discord Media Loader.Application/MainForm.cs @@ -2,6 +2,7 @@ using System.Diagnostics; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; using System.Windows.Forms; using Discord; using Discord.WebSocket; diff --git a/Discord Media Loader.Application/app.config b/Discord Media Loader.Application/app.config index 5b184e5..d5170f1 100644 --- a/Discord Media Loader.Application/app.config +++ b/Discord Media Loader.Application/app.config @@ -14,6 +14,10 @@ + + + + \ No newline at end of file diff --git a/Discord Media Loader.Application/packages.config b/Discord Media Loader.Application/packages.config index d3b12fc..d3092d0 100644 --- a/Discord Media Loader.Application/packages.config +++ b/Discord Media Loader.Application/packages.config @@ -15,6 +15,7 @@ + diff --git a/Discord Media Loader/App.config b/Discord Media Loader/App.config index 3bddcc4..7cf02b2 100644 --- a/Discord Media Loader/App.config +++ b/Discord Media Loader/App.config @@ -17,6 +17,10 @@ + + + +