public static void ProcessException(Exception e) { global::Controls.LoadingDialog.HideDialog(); if ((e is System.Runtime.Remoting.RemotingException || e is Exception) && e.Message.Contains("Failed to authenticate") && AuthenticationError != null) { AuthenticationError(null, EventArgs.Empty); return; } else if ((e is System.Runtime.Remoting.RemotingException || e is Exception) && e.Message.Contains("Remote Management not allowed") && RemoteManagementError != null) { RemoteManagementError(null, EventArgs.Empty); return; } else if (e is System.Runtime.Remoting.RemotingException || e is System.Net.Sockets.SocketException) { if (ConnectionError != null) { ConnectionError(null, EventArgs.Empty); return; } } string licenseKey = ""; string licenseName = ""; try { licenseKey = ManagementInterfaceClient.ManagementInterface.LicenseKey; licenseName = ManagementInterfaceClient.ManagementInterface.LicenseName; } catch { } ErrorCaptureUtils.SendError(e, licenseKey, licenseName, Application.ProductVersion, true); }
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) { if (e.Exception is WebException) { MessageBox.Show(e.Exception.Message); } else { string errorID = Guid.NewGuid().ToString(); ErrorCaptureUtils.SendError(errorID, e.Exception, "", "", Assembly.GetExecutingAssembly().GetName().Version.ToString(), Properties.Settings.Default.FtpURL + "/BugReports", true, Properties.Settings.Default.FtpUser, Properties.Settings.Default.FtpPasssword); ErrorCaptureUtils.SendLogFile(errorID, "MyListener.log", Properties.Settings.Default.FtpURL + "/BugReports", Properties.Settings.Default.FtpUser, Properties.Settings.Default.FtpPasssword); } }
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) { string licenseKey = ""; string licenseName = ""; try { licenseKey = Properties.Settings.Default.LicenseKey; licenseName = Properties.Settings.Default.LicenseName; } catch { } Service.Services.LoggingService.AddLogEntry(WOSI.CallButler.ManagementInterface.LogLevel.ErrorsOnly, Utils.ErrorUtils.FormatErrorString(e.Exception), true); if (Properties.Settings.Default.ReportErrors) { ErrorCaptureUtils.SendError(e.Exception, licenseKey, licenseName, Application.ProductVersion, runAsApplication); } }
static void Main(string[] args) { bool resetSettings = false; Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); try { // Lock our license so that only one instance of this server can run on this machine /*if (!Licensing.Management.LicenseManager.LockLicense(Properties.Settings.Default.ProductID, Properties.Settings.Default.LicenseKey, true)) * { * return; * } * else * {*/ foreach (string arg in args) { string argVal = arg.ToUpper(); if (argVal == "/A" || argVal == "-A") { runAsApplication = true; } else if (argVal == "/R" || argVal == "-R") { Properties.Settings.Default.Reset(); Properties.Settings.Default.Save(); resetSettings = true; } else if (argVal == "/RP" || argVal == "-RP") { Properties.Settings.Default.ManagementPassword = ""; Properties.Settings.Default.Save(); resetSettings = true; } } if (runAsApplication) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.DoEvents(); CallButlerService service = new CallButlerService(); service.NotifyIconVisible = true; service.StartService(args); Application.Run(); service.NotifyIconVisible = false; service.StopService(); } else if (!resetSettings) { ServiceBase[] ServicesToRun; CallButlerService service = new CallButlerService(); service.NotifyIconVisible = false; ServicesToRun = new ServiceBase[] { service }; ServiceBase.Run(ServicesToRun); } //} //Licensing.Management.LicenseManager.UnlockLicense(); } catch (Exception ex) { string licenseKey = ""; string licenseName = ""; try { licenseKey = Properties.Settings.Default.LicenseKey; licenseName = Properties.Settings.Default.LicenseName; } catch { } Service.Services.LoggingService.AddLogEntry(WOSI.CallButler.ManagementInterface.LogLevel.ErrorsOnly, Utils.ErrorUtils.FormatErrorString(ex), true); if (Properties.Settings.Default.ReportErrors) { ErrorCaptureUtils.SendError(ex, licenseKey, licenseName, Application.ProductVersion, runAsApplication); } } }