public void SendReport(CrashReportDetails crashReport)
        {
            // Create xml file containing reportItems
            string prettyXml = "";

            using (System.IO.StringWriter stringWriter = new System.IO.StringWriter())
            {
                System.Xml.Serialization.XmlSerializerNamespaces ns = new System.Xml.Serialization.XmlSerializerNamespaces();
                ns.Add("", "");
                System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(crashReport.GetType(), crashReport.GetItemTypes());
                x.Serialize(stringWriter, crashReport, ns);
                prettyXml = stringWriter.ToString();
            }

            using (System.IO.StreamWriter streamWriter = new System.IO.StreamWriter(new System.IO.MemoryStream()))
            {
                streamWriter.WriteLine(prettyXml);
                streamWriter.Flush();
                streamWriter.BaseStream.Position = 0;
                ZipStore.AddStream(System.IO.Compression.ZipStorer.Compression.Deflate, "crashrpt.xml", streamWriter.BaseStream, DateTime.Now, "");
            }

            ZipStore.Close();

            // Upload File
            HttpUploadFile(HttpUrl, ZipStream.ToArray(), FileParamName, FileName, "application/x-zip-compressed", HttpParams);
        }
        public void SendReport(CrashReportDetails crashReport)
        {
            // Convert ReportItems to EmailBody
            string emailBody = "";

            using (System.IO.StringWriter stringWriter = new System.IO.StringWriter())
            {
                System.Xml.Serialization.XmlSerializerNamespaces ns = new System.Xml.Serialization.XmlSerializerNamespaces();
                ns.Add("", "");
                System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(crashReport.GetType(), crashReport.GetItemTypes());
                x.Serialize(stringWriter, crashReport, ns);
                emailBody = stringWriter.ToString();
            }

            using (MailMessage msg = new MailMessage())
            {
                msg.From = new MailAddress(EmailFromAddress);
                foreach (string s in EmailToAddress.Split(";".ToCharArray()))
                {
                    msg.To.Add(s);
                }
                if (String.IsNullOrEmpty(EmailSubject))
                {
                    msg.Subject = Application.ProductName + " - Error Report";
                }
                else
                {
                    msg.Subject = EmailSubject;
                }

                msg.Body = emailBody;

                SmtpClient smtp = null;
                if (String.IsNullOrEmpty(EmailHost))
                {
                    smtp = new SmtpClient();
                }
                else
                {
                    if (EmailPort == 0)
                    {
                        smtp = new SmtpClient(EmailHost);
                    }
                    else
                    {
                        smtp = new SmtpClient(EmailHost, EmailPort);
                    }
                }
                if (String.IsNullOrEmpty(EmailUsername) && String.IsNullOrEmpty(EmailPassword))
                {
                    smtp.UseDefaultCredentials = true;
                }
                else
                {
                    smtp.Credentials = new System.Net.NetworkCredential(EmailUsername, EmailPassword);
                }
                smtp.EnableSsl = EmailSSL;
                smtp.Send(msg);
            }
        }
        public void SendReport(CrashReportDetails crashReport)
        {
            if (String.IsNullOrEmpty(PadUrl))
            {
                return;
            }

            System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(PadUrl);
            //HACK: add proxy
            IWebProxy proxy = WebRequest.GetSystemWebProxy();

            proxy.Credentials   = System.Net.CredentialCache.DefaultCredentials;
            req.Proxy           = proxy;
            req.PreAuthenticate = true;
            //HACK: end add proxy
            req.Accept    = "text/html,application/xml";
            req.UserAgent = "Mozilla/5.0";  // Fix HTTP Error 406 Not acceptable - Security incident detected

            XmlDocument xmlDoc = new XmlDocument();

            using (WebResponse response = req.GetResponse())
            {
                xmlDoc.Load(response.GetResponseStream());
            }

            XmlNode appVerNode = xmlDoc.SelectSingleNode("/XML_DIZ_INFO/Program_Info/Program_Version");

            if (appVerNode != null)
            {
                Version appVer = new Version(appVerNode.InnerText);
                if (appVer > System.Reflection.Assembly.GetExecutingAssembly().GetName().Version)
                {
                    string  message    = "New version " + appVer.ToString() + " is available at application homepage.";
                    XmlNode appInfoURL = xmlDoc.SelectSingleNode("/XML_DIZ_INFO/Web_Info/Application_URLs/Application_Info_URL");
                    if (appInfoURL != null && !String.IsNullOrEmpty(appInfoURL.InnerText))
                    {
                        DialogResult res = MessageBox.Show(message + "\n\nCheck homepage for changelog and download?", "New update available", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                        if (res == DialogResult.OK)
                        {
                            System.Diagnostics.Process.Start(appInfoURL.InnerText);
                        }
                    }
                    else
                    {
                        MessageBox.Show(message, "New update available", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    return;
                }
            }

            if (PromptAlways)
            {
                MessageBox.Show("Using the latest version", "Check for updates", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        public ThreadExceptionDialogEx(Exception exception)
        {
            InitializeComponent();

            Text = Application.ProductName + " - Error Report";

            ShowInTaskbar = Application.OpenForms.Count == 0;

            _pictureBox.Image = SystemIcons.Error.ToBitmap();

            _reportText.Text  = "Unhandled exception has occurred in the application:";
            _reportText.Text += Environment.NewLine;
            _reportText.Text += Environment.NewLine + exception.Message;
            _reportText.Text += Environment.NewLine;
            _reportText.Text += Environment.NewLine + "Please press 'Send Report' to notify " + Application.CompanyName;

            CrashReport = new CrashReportDetails();
            CrashReport.Items.Add(new ExceptionReport(exception));
            CrashReport.Items.Add(new ApplicationReport());
            CrashReport.Items.Add(new SystemReport());
            CrashReport.Items.Add(new MemoryPerformanceReport());
        }
        public void SendReport(CrashReportDetails crashReport)
        {
            // Create xml file containing reportItems
            string prettyXml = "";
            using (System.IO.StringWriter stringWriter = new System.IO.StringWriter())
            {
                System.Xml.Serialization.XmlSerializerNamespaces ns = new System.Xml.Serialization.XmlSerializerNamespaces();
                ns.Add("", "");
                System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(crashReport.GetType(), crashReport.GetItemTypes());
                x.Serialize(stringWriter, crashReport, ns);
                prettyXml = stringWriter.ToString();
            }

            using (System.IO.StreamWriter streamWriter = new System.IO.StreamWriter(new System.IO.MemoryStream()))
            {
                streamWriter.WriteLine(prettyXml);
                streamWriter.Flush();
                streamWriter.BaseStream.Position = 0;
                ZipStore.AddStream(System.IO.Compression.ZipStorer.Compression.Deflate, "crashrpt.xml", streamWriter.BaseStream, DateTime.Now, "");
            }

            ZipStore.Close();
            ZipStream.Position = 0;

            // Upload File
            HttpUploadFile(HttpUrl, ZipStream, FileParamName, FileName, "application/x-zip-compressed", HttpParams);
        }
        public ThreadExceptionDialogEx(Exception exception)
        {
            InitializeComponent();

            Text = Application.ProductName + " - Error Report";

            ShowInTaskbar = Application.OpenForms.Count == 0;

            _pictureBox.Image = SystemIcons.Error.ToBitmap();

            _reportText.Text = "Unhandled exception has occurred in the application:";
            _reportText.Text += Environment.NewLine;
            _reportText.Text += Environment.NewLine + exception.Message;
            _reportText.Text += Environment.NewLine;
            _reportText.Text += Environment.NewLine + "Please press 'Send Report' to notify " + Application.CompanyName;

            CrashReport = new CrashReportDetails();
            CrashReport.Items.Add(new ExceptionReport(exception));
            CrashReport.Items.Add(new ApplicationReport());
            CrashReport.Items.Add(new SystemReport());
            CrashReport.Items.Add(new MemoryPerformanceReport());
        }
        public void SendReport(CrashReportDetails crashReport)
        {
            // Convert ReportItems to EmailBody
            string emailBody = "";

            using (System.IO.StringWriter stringWriter = new System.IO.StringWriter())
            {
                System.Xml.Serialization.XmlSerializerNamespaces ns = new System.Xml.Serialization.XmlSerializerNamespaces();
                ns.Add("", "");
                System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(crashReport.GetType(), crashReport.GetItemTypes());
                x.Serialize(stringWriter, crashReport, ns);
                emailBody = stringWriter.ToString();
            }

            using (MailMessage msg = new MailMessage())
            {
                msg.From = new MailAddress(EmailFromAddress);
                foreach (string s in EmailToAddress.Split(";".ToCharArray()))
                {
                    msg.To.Add(s);
                }
                if (String.IsNullOrEmpty(EmailSubject))
                    msg.Subject = Application.ProductName + " - Error Report";
                else
                    msg.Subject = EmailSubject;

                msg.Body = emailBody;

                SmtpClient smtp = null;
                if (String.IsNullOrEmpty(EmailHost))
                {
                    smtp = new SmtpClient();
                }
                else
                {
                    if (EmailPort == 0)
                        smtp = new SmtpClient(EmailHost);
                    else
                        smtp = new SmtpClient(EmailHost, EmailPort);
                }
                if (String.IsNullOrEmpty(EmailUsername) && String.IsNullOrEmpty(EmailPassword))
                    smtp.UseDefaultCredentials = true;
                else
                    smtp.Credentials = new System.Net.NetworkCredential(EmailUsername, EmailPassword);
                smtp.EnableSsl = EmailSSL;
                smtp.Send(msg);
            }
        }
        public void SendReport(CrashReportDetails crashReport)
        {
            if (String.IsNullOrEmpty(PadUrl))
                return;

            System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(PadUrl);
            //HACK: add proxy
            IWebProxy proxy = WebRequest.GetSystemWebProxy();
            proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
            req.Proxy = proxy;
            req.PreAuthenticate = true;
            //HACK: end add proxy

            XmlDocument xmlDoc = new XmlDocument();
            using (WebResponse response = req.GetResponse())
            {
                xmlDoc.Load(response.GetResponseStream());
            }

            XmlNode appVerNode = xmlDoc.SelectSingleNode("/XML_DIZ_INFO/Program_Info/Program_Version");
            if (appVerNode != null)
            {
                Version appVer = new Version(appVerNode.InnerText);
                if (appVer > System.Reflection.Assembly.GetExecutingAssembly().GetName().Version)
                {
                    string message = "New version " + appVer.ToString() + " is available at application homepage.";
                    XmlNode appInfoURL = xmlDoc.SelectSingleNode("/XML_DIZ_INFO/Web_Info/Application_URLs/Application_Info_URL");
                    if (appInfoURL != null && !String.IsNullOrEmpty(appInfoURL.InnerText))
                    {
                        DialogResult res = MessageBox.Show(message + "\n\nCheck homepage for changelog and download?", "New update available", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                        if (res == DialogResult.OK)
                            System.Diagnostics.Process.Start(appInfoURL.InnerText);
                    }
                    else
                    {
                        DialogResult res = MessageBox.Show(message, "New update available", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    return;
                }
            }

            if (PromptAlways)
                MessageBox.Show("Using the latest version", "Check for updates", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }