예제 #1
0
        private void continueSendReport_Click(object sender, System.EventArgs e)
        {
            //if (!NoUi && string.IsNullOrWhiteSpace(email.Text))// || !IsValidEmail(email.Text))
            //{
            //	if (sendAnonymously.Checked)
            //		MessageBox.Show(this, "Valid email address still required even though it won't be sent to us. It will be auto-filled next time you experience an error.", "Email required", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //	else
            //		MessageBox.Show(this, "Valid email address required.", "Email required", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //	return;
            //}
            RegistryHelper.SaveHKLMRegistryString("Email", email.Text);

            if (reportExceptionEventArgs != null)
            {
                //if (sendAnonymously.Checked)
                //	reportExceptionEventArgs.AddCustomProperty("Email", "anon");
                //else
                reportExceptionEventArgs.AddCustomProperty("Email", email.Text);

                if (!string.IsNullOrEmpty(textBoxExtraInfo.Text))
                {
                    reportExceptionEventArgs.AddCustomProperty("ExtraInfo", textBoxExtraInfo.Text);
                }

                reportExceptionEventArgs.AddCustomProperty("Email from License", GetEmailFromLicenseFile());
            }
            SendReport();
        }
 void continueSendReport_Click(object sender, EventArgs e)
 {
     if (!sendAnonymously.Checked && reportExceptionEventArgs != null)
     {
         reportExceptionEventArgs.AddCustomProperty("Email", email.Text);
         RegistryHelper.TrySaveHKLMRegistryString("Email", email.Text);
     }
     SendReport();
 }
        void TryAddSystemInfo(ReportExceptionEventArgs e) {
            try {
                e.AddCustomProperty("Elevation Status", (!new UacHelper().CheckUac()).ToString());
            } catch {}
            try {
                e.AddCustomProperty("SEMVER", GetProductVersion());
            } catch {}
            try {
                e.AddCustomProperty("Uptime", (DateTime.Now - Process.GetCurrentProcess().StartTime).TotalSeconds + "s");
            } catch {}
            // TODO
            /*
            try {
                e.AddCustomProperty("IsPremium", KnownExceptions.IsPremium);
            } catch { }
            try {
                e.AddCustomProperty("UserId", KnownExceptions.UserId);
            } catch { }
*/
        }
예제 #4
0
        void TryAddSystemInfo(ReportExceptionEventArgs e)
        {
            try {
                e.AddCustomProperty("Elevation Status", (!new UacHelper().CheckUac()).ToString());
            } catch {}
            try {
                e.AddCustomProperty("SEMVER", GetProductVersion());
            } catch {}
            try {
                e.AddCustomProperty("Uptime", (DateTime.Now - Process.GetCurrentProcess().StartTime).TotalSeconds + "s");
            } catch {}
            // TODO

            /*
             * try {
             *  e.AddCustomProperty("IsPremium", KnownExceptions.IsPremium);
             * } catch { }
             * try {
             *  e.AddCustomProperty("UserId", KnownExceptions.UserId);
             * } catch { }
             */
        }
예제 #5
0
        public bool Handle(Exception exception, ReportExceptionEventArgs e = null) {
            var r = InternalHandler(exception, e);

            if (string.IsNullOrEmpty(r.Item1))
                return r.Item2;

            var moreInfo = FormatException(exception);

            if (e != null) {
                e.AddCustomProperty("Six.Handled", r.Item1);
                e.TryToContinue = false;
            }

            ExitMessageHandler(exception, r, moreInfo);

            return r.Item2;
        }
예제 #6
0
        public bool Handle(Exception exception, ReportExceptionEventArgs e = null)
        {
            var r = InternalHandler(exception, e);

            if (string.IsNullOrEmpty(r.Item1))
            {
                return(r.Item2);
            }

            var moreInfo = PrettyExceptions.FormatException(exception);

            if (e != null)
            {
                e.AddCustomProperty("Six.Handled", r.Item1);
                e.TryToContinue = false;
            }

            ExitMessageHandler(exception, r, moreInfo);

            return(r.Item2);
        }
예제 #7
0
        public ExceptionReportingForm(UnhandledExceptionHandler unhandledExceptionHandler, ReportExceptionEventArgs reportExceptionEventArgs)
            : this()
        {
            int newHeight = Height;

            this.reportExceptionEventArgs  = reportExceptionEventArgs;
            this.unhandledExceptionHandler = unhandledExceptionHandler;
            this.errorMessage.Text         = reportExceptionEventArgs.Exception.Message;
            this.header1.Text = string.Format("{1} has encountered a problem.{0}We are sorry for the inconvenience.", Environment.NewLine, UnhandledExceptionHandler.ApplicationName);
            this.header2.Text = string.Format("Please wait while {0} sends the report to {1} through the Internet.", UnhandledExceptionHandler.ApplicationName, UnhandledExceptionHandler.CompanyName);
            this.header3.Text = string.Format("Do you want to be contacted by {0} regarding this problem?", UnhandledExceptionHandler.CompanyName);
            this.label3.Text  = string.Format("If you want to be contacted by {0} regarding this error, please provide your e-mail address. This information will not be used for any other purpose.", UnhandledExceptionHandler.CompanyName);
            //this.pleaseTellMessage.Text = string.Format("To help improve the software you use, {0} is interested in learning more about this error. We have created a report about the error for you to send to us.", UnhandledExceptionHandler.CompanyName);

            foreach (var key in reportExceptionEventArgs.Exception.Data.Keys)
            {
                reportExceptionEventArgs.AddCustomProperty(string.Format("Data [{0}]", key.ToString()), reportExceptionEventArgs.Exception.Data[key].ToString());
            }

            newHeight += (this.errorMessage.Height - FontHeight);

            if (!reportExceptionEventArgs.CanContinue)
            {
                this.continueCheckBox.Visible = false;
                newHeight -= (this.continueCheckBox.Height);
            }

            if (newHeight > Height)
            {
                Height = newHeight;
            }

            if (reportExceptionEventArgs.CanDebug)
            {
                unhandledExceptionHandler.DebuggerLaunched += new EventHandler(OnDebuggerLaunched);
                debug.Visible = true;
                //poweredBy.Visible = false;
            }

            if (!reportExceptionEventArgs.CanSendReport)
            {
                sendReport.Enabled = false;
                if (dontSendReport.CanFocus)
                {
                    dontSendReport.Focus();
                }
            }

            this.email.Text = RegistryHelper.ReadHKLMRegistryString("Email");

            unhandledExceptionHandler.SendingReportFeedback += new SendingReportFeedbackEventHandler(OnFeedback);

            // GFH
            //if (WebProxy.Credentials != null)
            unhandledExceptionHandler.SetProxy(WebProxy);

            string reportedExceptions = RegistryHelper.ReadHKLMRegistryString("ReportedExceptions");
            string currentVersion;

            try
            {
                currentVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

                if (!reportedExceptions.StartsWith(currentVersion))
                {
                    reportedExceptions = currentVersion + ":";
                }
            }
            catch
            {
                currentVersion = "";
            }
            string newHashCode = GetExceptionHashCode(reportExceptionEventArgs.Exception).ToString();

            // Force reporting of first-time exceptions
            if (reportedExceptions.Contains(newHashCode))
            {
                //labelRequiredInfo.Visible = false;
                dontSendReport.Enabled = true;
                cancelSending.Enabled  = true;
                saveAsFile.Enabled     = true;
            }
            else
            {
                //labelRequiredInfo.Visible = true;
                //dontSendReport.Enabled = false;
                //cancelSending.Enabled = false;
                //saveAsFile.Enabled = false;

                // Temp: Don't force user to send new message. These 4 lines below are repeated above, and should be removed once we decide what to do going forward.
                //labelRequiredInfo.Visible = false;
                dontSendReport.Enabled = true;
                cancelSending.Enabled  = true;
                saveAsFile.Enabled     = true;

                RegistryHelper.SaveHKLMRegistryString("ReportedExceptions", reportedExceptions + "," + newHashCode);
            }
            if (NoUi)
            {
                panelInformation.Visible = false;
                continueSendReport_Click(null, null);
            }
        }
 static void TryAddFullExceptionTrace(ReportExceptionEventArgs e) {
     try {
         e.AddCustomProperty("Full exception trace", PrettyExceptions.FormatException(e.Exception));
     } catch {}
 }
        public ExceptionReportingForm(UnhandledExceptionHandler unhandledExceptionHandler, ReportExceptionEventArgs reportExceptionEventArgs)
            : this()
        {
            int newHeight = Height;

            this.reportExceptionEventArgs  = reportExceptionEventArgs;
            this.unhandledExceptionHandler = unhandledExceptionHandler;
            this.errorMessage.Text         = reportExceptionEventArgs.Exception.Message;

            foreach (var key in reportExceptionEventArgs.Exception.Data.Keys)
            {
                reportExceptionEventArgs.AddCustomProperty(string.Format("Data [{0}]", key.ToString()), reportExceptionEventArgs.Exception.Data[key].ToString());
            }

            newHeight += (this.errorMessage.Height - FontHeight);

            if (!reportExceptionEventArgs.CanContinue)
            {
                this.continueCheckBox.Visible = false;
                newHeight -= (this.continueCheckBox.Height);
            }

            if (newHeight > Height)
            {
                Height = newHeight;
            }

            if (reportExceptionEventArgs.CanDebug)
            {
                unhandledExceptionHandler.DebuggerLaunched += new EventHandler(OnDebuggerLaunched);
                debug.Visible     = true;
                poweredBy.Visible = false;
            }

            if (!reportExceptionEventArgs.CanSendReport)
            {
                sendReport.Enabled = false;
                if (dontSendReport.CanFocus)
                {
                    dontSendReport.Focus();
                }
            }

            this.email.Text = RegistryHelper.ReadHKLMRegistryString("Email");

            unhandledExceptionHandler.SendingReportFeedback += new SendingReportFeedbackEventHandler(OnFeedback);

            // GFH
            //if (WebProxy.Credentials != null)
            unhandledExceptionHandler.SetProxy(WebProxy);

            string reportedExceptions = RegistryHelper.ReadHKLMRegistryString("ReportedExceptions");
            string currentVersion;

            try
            {
                currentVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

                if (!reportedExceptions.StartsWith(currentVersion))
                {
                    reportedExceptions = currentVersion + ":";
                }
            }
            catch
            {
                currentVersion = "";
            }
            string newHashCode = GetExceptionHashCode(reportExceptionEventArgs.Exception).ToString();

            if (reportedExceptions.Contains(newHashCode))
            {
                labelRequiredInfo.Visible = false;
                dontSendReport.Enabled    = true;
                cancelSending.Enabled     = true;
                saveAsFile.Enabled        = true;
            }
            else
            {
                labelRequiredInfo.Visible = true;
                dontSendReport.Enabled    = false;
                cancelSending.Enabled     = false;
                saveAsFile.Enabled        = false;
                RegistryHelper.SaveHKLMRegistryString("ReportedExceptions", reportedExceptions + "," + newHashCode);
            }
        }
        public ExceptionReportingForm(UnhandledExceptionHandler unhandledExceptionHandler, ReportExceptionEventArgs reportExceptionEventArgs)
            : this()
        {
            int newHeight = Height;

            this.reportExceptionEventArgs = reportExceptionEventArgs;
            this.unhandledExceptionHandler = unhandledExceptionHandler;
            this.errorMessage.Text = reportExceptionEventArgs.Exception.Message;

            foreach (var key in reportExceptionEventArgs.Exception.Data.Keys)
                reportExceptionEventArgs.AddCustomProperty(string.Format("Data [{0}]", key.ToString()), reportExceptionEventArgs.Exception.Data[key].ToString());

            newHeight += (this.errorMessage.Height - FontHeight);

            if (!reportExceptionEventArgs.CanContinue)
            {
                this.continueCheckBox.Visible = false;
                newHeight -= (this.continueCheckBox.Height);
            }

            if (newHeight > Height) Height = newHeight;

            if (reportExceptionEventArgs.CanDebug)
            {
                unhandledExceptionHandler.DebuggerLaunched += new EventHandler(OnDebuggerLaunched);
                debug.Visible = true;
                poweredBy.Visible = false;
            }

            if (!reportExceptionEventArgs.CanSendReport)
            {
                sendReport.Enabled = false;
                if (dontSendReport.CanFocus) dontSendReport.Focus();
            }

            this.email.Text = RegistryHelper.ReadHKLMRegistryString("Email");

            unhandledExceptionHandler.SendingReportFeedback += new SendingReportFeedbackEventHandler(OnFeedback);

            // GFH
            //if (WebProxy.Credentials != null)
            unhandledExceptionHandler.SetProxy(WebProxy);

            string reportedExceptions = RegistryHelper.ReadHKLMRegistryString("ReportedExceptions");
            string currentVersion;

            try
            {
                currentVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

                if (!reportedExceptions.StartsWith(currentVersion))
                    reportedExceptions = currentVersion + ":";
            }
            catch
            {
                currentVersion = "";
            }
            string newHashCode = GetExceptionHashCode(reportExceptionEventArgs.Exception).ToString();

            if (reportedExceptions.Contains(newHashCode))
            {
                labelRequiredInfo.Visible = false;
                dontSendReport.Enabled = true;
                cancelSending.Enabled = true;
                saveAsFile.Enabled = true;
            }
            else
            {
                labelRequiredInfo.Visible = true;
                dontSendReport.Enabled = false;
                cancelSending.Enabled = false;
                saveAsFile.Enabled = false;
                RegistryHelper.SaveHKLMRegistryString("ReportedExceptions", reportedExceptions + "," + newHashCode);
            }
        }
예제 #11
0
 static void TryAddFullExceptionTrace(ReportExceptionEventArgs e)
 {
     try {
         e.AddCustomProperty("Full exception trace", PrettyExceptions.FormatException(e.Exception));
     } catch {}
 }