From 3bc68def3328ab2cb44c12f2235620dbcba02cff Mon Sep 17 00:00:00 2001 From: Nathan Crawford Date: Wed, 30 Mar 2016 18:28:04 -0400 Subject: [PATCH] Remove ErrorReporter.cs and use ErrorReporter.dll instead --- Installer/EmbroideryReader.wxs | 1 + embroideryReader/ErrorReporter.cs | 113 ----------------------- embroideryReader/ErrorReporter.dll | Bin 0 -> 7168 bytes embroideryReader/Program.cs | 2 +- embroideryReader/embroideryReader.csproj | 4 +- 5 files changed, 5 insertions(+), 115 deletions(-) delete mode 100644 embroideryReader/ErrorReporter.cs create mode 100644 embroideryReader/ErrorReporter.dll diff --git a/Installer/EmbroideryReader.wxs b/Installer/EmbroideryReader.wxs index 46b026b..1039ada 100644 --- a/Installer/EmbroideryReader.wxs +++ b/Installer/EmbroideryReader.wxs @@ -42,6 +42,7 @@ + diff --git a/embroideryReader/ErrorReporter.cs b/embroideryReader/ErrorReporter.cs deleted file mode 100644 index f3acc18..0000000 --- a/embroideryReader/ErrorReporter.cs +++ /dev/null @@ -1,113 +0,0 @@ -/* -Embroidery Reader - an application to view .pes embroidery designs - -Copyright (C) 2016 Nathan Crawford - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. - -A copy of the full GPL 2 license can be found in the docs directory. -You can contact me at http://www.njcrawford.com/contact -*/ - - -using System; -using System.Reflection; -using System.Windows.Forms; - -namespace NJCrawford -{ - public class ErrorReporter - { - // Application name to use in report - private static string appName; - - // Call this to enable reporting of unhandled exceptions. - // appName is a string that will be used in the report to help identify which program it came from. - public static void Register(string appName) - { - ErrorReporter.appName = appName; - - AppDomain.CurrentDomain.UnhandledException += - new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); - Application.ThreadException += - new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); - } - - // Functions to deal with unhandled exceptions - // Based on code from http://stevenbenner.com/2010/01/reporting-of-unhandled-exceptions-in-your-distributable-net-application/ - static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) - { - reportError((Exception)e.ExceptionObject); - } - - public static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) - { - reportError(e.Exception); - } - - private static void reportError(Exception ex) - { - try - { - if (MessageBox.Show( - appName + " has encountered a error.\n\n" + - "Click Yes to report this error using a web browser.\n" + - "Click No if you'd rather not report the error.\n" + - "Please consider submitting the report to help find and fix this issue.\n\n" + - "Error:\n" + - ex.Message + "\n" + - ex.StackTrace, - "Report Application Error?", - MessageBoxButtons.YesNo, - MessageBoxIcon.Stop) == DialogResult.Yes) - { - // Base url - string url = "http://www.njcrawford.com/contact/error-reports/?2subject=" + System.Uri.EscapeDataString(appName) + "%20Automated%20Error%20Report&2message="; - - // Add error message to it - Assembly caller = Assembly.GetEntryAssembly(); - string errorText = "Additional details:\n\n" + - "Time: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\n" + - "Program: " + caller.FullName + "\n" + - "Program location: " + caller.Location + "\n" + - "OS: " + Environment.OSVersion.ToString() + "\n" + - "OS Culture: " + System.Globalization.CultureInfo.CurrentCulture.Name + "\n" + - "Framework: " + Environment.Version + "\n\n" + - "Error:\n" + - ex.GetType().ToString() + " (" + ex.Message + ")\n" + - ex.StackTrace; - // URL encode message - url += System.Uri.EscapeDataString(errorText.Trim()); - - // Limit commandline to about 2000 characters (2000 seems to be the limit on my Windows 7 laptop) - if(url.Length > 2000) - { - string clippedMessage = System.Uri.EscapeDataString("\n(Report clipped)"); - url = url.Substring(0, 2000 - clippedMessage.Length); - url += clippedMessage; - } - - // Open URL in browser - System.Diagnostics.Process.Start(url); - } - } - finally - { - Application.Exit(); - } - } - } -} diff --git a/embroideryReader/ErrorReporter.dll b/embroideryReader/ErrorReporter.dll new file mode 100644 index 0000000000000000000000000000000000000000..a2abd5f1ba4ab8b939566ec39bc626b3c67203eb GIT binary patch literal 7168 zcmeHLYit}>6+W{s+nadFI*-P&6OWtM=HbPT-8$(bwc|%#j+1!pgiyE1?C$k?n%SA{ zo!Qtfv~tx3sihSSD)a{wM9L3BB%lb6|o@zSLnY46e4m}lH z4-igt4X&!zgXq&zSPld^Ryu==ZLPyq)q05bRdp5G!*xaD*g_Pg$y5`zgaeJI@NDDDS{j}PMOzt7M%T!9l!fRmsr6v3j5Wk$B1EOs2J|i_ zqif~u=mBZ0aaw%RIyvN%nra-~CpAmYC#_Glg5sdKth_;@JgnSOm)gkmO+LLPF25Qu zmZdfawB_=L0j)mdY+>oZN=rh%5pX_H$voP!LcSFcla<_~sjX039;M<%*ec(Fo?_O=)+kz?VxMw$D%rX~C)I}Tmfy!xY21GYJJgHfp^BC(jv(5GtW! z<#^$OkUAki!jM;dmO&V3@gUk54bWcXV*|$NWx5RfuZq&CHEJ=sUmF4}EBHkPUsUi7 z1^=YrM+!EESn_yiS13k8L03_pQt;)_rO;u*!-M^6p+7*TCCu>dFnd1*7^g3UFC)^Q zhA)R>6pHKxz9VuuoS@qk>{D$6YYP4&^2bPwHbj}e3ouUo3fj?2 zT#_JXeo`80+)Ue1CB~C91lc5w0v^*@^2;<%_28UWy$kdttwiOX3wXcA;uEEB2D}fb z6_q}7E7a(7YiqQvYHieDlb^;Yphop5eTY^8F2vVp+o(p{K^+S2QLtCRg9;v3@RWjv zf~JBG0=CnP!XH)e2?Z|z-bUX5ypt{gZlxD#f4GN!1bhJaboem6s_@t87vbZ``D*wi zHPU>{?*e{?t^htp zuWGLm!bjtoP-(pLVN%XDjc!x;LfYQz&@TIviRi8)PQGl3y)+=DBS%EZk)Dw0yk#w< z(D0!?X-rKxGEYS}=Sa)UQf9{WM3IhW9}qc@j8bXXC<@9Nt{9URjfj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_1qMnm| zU>v);z;SdTCtb>CIo6w~?GC;Namd4r>x?aJmG4GGr~4e)Z&^ohn)VOuLa0+c>s;Fm zeSTH{xZM;L;CFr^d_B21qpbe7|9ho9;pdY30!(B2Jo0Xu=E|1{tL7U&Ee z#8xnj{z1S&;M`t`{N*El*JS(LDtBybs$t0tW`01xtsj>Ls|GfSLAAjN*tD?;J4$Gi zdRHA)+X-*+R@J8DTlrq(7-H2BlLsk(t6yqqr;=$$-u|x(#{<*={u9ux$oFFlbFuNU zof7Q%n>72G-?XZ?Cjm*WWo?y>6R?5T!YbW%91=Qk@!j{?0C~>RKdjlv$wD1@Ll!sm zmBtom;YT=#w8F*^5A`bH0KkzKz~w{YQksshB)am%M;QYV@CMFDfhkpS3Hv(j zLX;hZ1s-jPIM$l@d&OVxOx?&3->uJdlC p)2og?0&!*$`3&;=PkJixn-O4e;qxh-sap4M#xy>T`TwiHzW|YYqT~Po literal 0 HcmV?d00001 diff --git a/embroideryReader/Program.cs b/embroideryReader/Program.cs index d654018..05c581e 100644 --- a/embroideryReader/Program.cs +++ b/embroideryReader/Program.cs @@ -38,7 +38,7 @@ namespace embroideryReader static void Main() { // Register ErrorReporter to report unhandled exceptions - NJCrawford.ErrorReporter.Register("Embroidery Reader"); + NJCrawford.ErrorReporter.RegisterWebReport("Embroidery Reader", "http://www.njcrawford.com/contact/error-reports/?2subject=Embroidery%20Reader%20Automated%20Error%20Report&2message="); // Normal program.cs stuff Application.EnableVisualStyles(); diff --git a/embroideryReader/embroideryReader.csproj b/embroideryReader/embroideryReader.csproj index bfab6f3..849620b 100644 --- a/embroideryReader/embroideryReader.csproj +++ b/embroideryReader/embroideryReader.csproj @@ -53,6 +53,9 @@ false + + .\ErrorReporter.dll + False .\IniFile.dll @@ -67,7 +70,6 @@ - Form