# HG changeset patch # User moel.mich # Date 1278245557 0 # Node ID 522da3b8cb1aa2ebf4c018f0b019855038eee9f7 # Parent de70c4468b36bff655893ac618ba16066a5620af Fixed Issue 66. diff -r de70c4468b36 -r 522da3b8cb1a GUI/CrashForm.Designer.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/CrashForm.Designer.cs Sun Jul 04 12:12:37 2010 +0000 @@ -0,0 +1,279 @@ +/* + + Version: MPL 1.1/GPL 2.0/LGPL 2.1 + + The contents of this file are subject to the Mozilla Public License Version + 1.1 (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + for the specific language governing rights and limitations under the License. + + The Original Code is the Open Hardware Monitor code. + + The Initial Developer of the Original Code is + Michael Möller . + Portions created by the Initial Developer are Copyright (C) 2009-2010 + the Initial Developer. All Rights Reserved. + + Contributor(s): + + Alternatively, the contents of this file may be used under the terms of + either the GNU General Public License Version 2 or later (the "GPL"), or + the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + in which case the provisions of the GPL or the LGPL are applicable instead + of those above. If you wish to allow use of your version of this file only + under the terms of either the GPL or the LGPL, and not to allow others to + use your version of this file under the terms of the MPL, indicate your + decision by deleting the provisions above and replace them with the notice + and other provisions required by the GPL or the LGPL. If you do not delete + the provisions above, a recipient may use your version of this file under + the terms of any one of the MPL, the GPL or the LGPL. + +*/ + +namespace OpenHardwareMonitor.GUI { + partial class CrashForm { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + this.sendButton = new System.Windows.Forms.Button(); + this.exitButton = new System.Windows.Forms.Button(); + this.commentTextBox = new System.Windows.Forms.TextBox(); + this.titleLabel = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.commentPanel = new System.Windows.Forms.Panel(); + this.reportPanel = new System.Windows.Forms.Panel(); + this.reportTextBox = new System.Windows.Forms.TextBox(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.emailTextBox = new System.Windows.Forms.TextBox(); + this.commentPanel.SuspendLayout(); + this.reportPanel.SuspendLayout(); + this.SuspendLayout(); + // + // sendButton + // + this.sendButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.sendButton.Location = new System.Drawing.Point(449, 469); + this.sendButton.Name = "sendButton"; + this.sendButton.Size = new System.Drawing.Size(75, 23); + this.sendButton.TabIndex = 2; + this.sendButton.Text = "Send"; + this.sendButton.UseVisualStyleBackColor = true; + this.sendButton.Click += new System.EventHandler(this.sendButton_Click); + // + // exitButton + // + this.exitButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.exitButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.exitButton.Location = new System.Drawing.Point(530, 469); + this.exitButton.Name = "exitButton"; + this.exitButton.Size = new System.Drawing.Size(75, 23); + this.exitButton.TabIndex = 3; + this.exitButton.Text = "Exit"; + this.exitButton.UseVisualStyleBackColor = true; + // + // commentTextBox + // + this.commentTextBox.AcceptsReturn = true; + this.commentTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.commentTextBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.commentTextBox.Location = new System.Drawing.Point(4, 4); + this.commentTextBox.Multiline = true; + this.commentTextBox.Name = "commentTextBox"; + this.commentTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.commentTextBox.Size = new System.Drawing.Size(586, 77); + this.commentTextBox.TabIndex = 1; + // + // titleLabel + // + this.titleLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.titleLabel.BackColor = System.Drawing.SystemColors.Window; + this.titleLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.titleLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.titleLabel.Location = new System.Drawing.Point(-1, -1); + this.titleLabel.Name = "titleLabel"; + this.titleLabel.Padding = new System.Windows.Forms.Padding(10); + this.titleLabel.Size = new System.Drawing.Size(619, 52); + this.titleLabel.TabIndex = 4; + this.titleLabel.Text = "Open Hardware Monitor has encountered a problem and needs to close. We are sorry " + + "for the inconvenience."; + // + // label3 + // + this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.label3.AutoEllipsis = true; + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(9, 63); + this.label3.Margin = new System.Windows.Forms.Padding(3, 12, 3, 8); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(571, 13); + this.label3.TabIndex = 5; + this.label3.Text = "To help diagnose and fix the problem, you can send a crash report. The following " + + "report has been created automatically:"; + // + // label1 + // + this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.label1.AutoEllipsis = true; + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(9, 347); + this.label1.Margin = new System.Windows.Forms.Padding(3, 12, 3, 8); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(279, 13); + this.label1.TabIndex = 6; + this.label1.Text = "You can add additional information to the report (optional):"; + // + // commentPanel + // + this.commentPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.commentPanel.BackColor = System.Drawing.SystemColors.Window; + this.commentPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.commentPanel.Controls.Add(this.commentTextBox); + this.commentPanel.Location = new System.Drawing.Point(12, 371); + this.commentPanel.Margin = new System.Windows.Forms.Padding(3, 3, 3, 8); + this.commentPanel.Name = "commentPanel"; + this.commentPanel.Padding = new System.Windows.Forms.Padding(4, 4, 1, 4); + this.commentPanel.Size = new System.Drawing.Size(593, 87); + this.commentPanel.TabIndex = 1; + this.commentPanel.TabStop = true; + // + // reportPanel + // + this.reportPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.reportPanel.BackColor = System.Drawing.SystemColors.Window; + this.reportPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.reportPanel.Controls.Add(this.reportTextBox); + this.reportPanel.Controls.Add(this.textBox1); + this.reportPanel.Location = new System.Drawing.Point(12, 87); + this.reportPanel.Name = "reportPanel"; + this.reportPanel.Padding = new System.Windows.Forms.Padding(4, 4, 1, 4); + this.reportPanel.Size = new System.Drawing.Size(593, 212); + this.reportPanel.TabIndex = 8; + // + // reportTextBox + // + this.reportTextBox.BackColor = System.Drawing.SystemColors.Window; + this.reportTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.reportTextBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.reportTextBox.Location = new System.Drawing.Point(4, 4); + this.reportTextBox.Multiline = true; + this.reportTextBox.Name = "reportTextBox"; + this.reportTextBox.ReadOnly = true; + this.reportTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.reportTextBox.Size = new System.Drawing.Size(586, 202); + this.reportTextBox.TabIndex = 9; + this.reportTextBox.TabStop = false; + // + // textBox1 + // + this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBox1.Location = new System.Drawing.Point(4, 4); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(586, 202); + this.textBox1.TabIndex = 2; + // + // label2 + // + this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.label2.AutoEllipsis = true; + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(9, 318); + this.label2.Margin = new System.Windows.Forms.Padding(3, 12, 3, 8); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(171, 13); + this.label2.TabIndex = 9; + this.label2.Text = "Enter your email address (optional):"; + // + // emailTextBox + // + this.emailTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.emailTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.emailTextBox.Location = new System.Drawing.Point(188, 315); + this.emailTextBox.Name = "emailTextBox"; + this.emailTextBox.Size = new System.Drawing.Size(417, 20); + this.emailTextBox.TabIndex = 0; + // + // CrashReportForm + // + this.AcceptButton = this.sendButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.exitButton; + this.ClientSize = new System.Drawing.Size(617, 504); + this.ControlBox = false; + this.Controls.Add(this.emailTextBox); + this.Controls.Add(this.label2); + this.Controls.Add(this.reportPanel); + this.Controls.Add(this.commentPanel); + this.Controls.Add(this.label1); + this.Controls.Add(this.label3); + this.Controls.Add(this.titleLabel); + this.Controls.Add(this.exitButton); + this.Controls.Add(this.sendButton); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "CrashReportForm"; + this.ShowIcon = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Open Hardware Monitor"; + this.commentPanel.ResumeLayout(false); + this.commentPanel.PerformLayout(); + this.reportPanel.ResumeLayout(false); + this.reportPanel.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button sendButton; + private System.Windows.Forms.Button exitButton; + private System.Windows.Forms.TextBox commentTextBox; + private System.Windows.Forms.Label titleLabel; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Panel commentPanel; + private System.Windows.Forms.Panel reportPanel; + private System.Windows.Forms.TextBox reportTextBox; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox emailTextBox; + } +} \ No newline at end of file diff -r de70c4468b36 -r 522da3b8cb1a GUI/CrashForm.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/CrashForm.cs Sun Jul 04 12:12:37 2010 +0000 @@ -0,0 +1,121 @@ +/* + + Version: MPL 1.1/GPL 2.0/LGPL 2.1 + + The contents of this file are subject to the Mozilla Public License Version + 1.1 (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + for the specific language governing rights and limitations under the License. + + The Original Code is the Open Hardware Monitor code. + + The Initial Developer of the Original Code is + Michael Möller . + Portions created by the Initial Developer are Copyright (C) 2009-2010 + the Initial Developer. All Rights Reserved. + + Contributor(s): + + Alternatively, the contents of this file may be used under the terms of + either the GNU General Public License Version 2 or later (the "GPL"), or + the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + in which case the provisions of the GPL or the LGPL are applicable instead + of those above. If you wish to allow use of your version of this file only + under the terms of either the GPL or the LGPL, and not to allow others to + use your version of this file under the terms of the MPL, indicate your + decision by deleting the provisions above and replace them with the notice + and other provisions required by the GPL or the LGPL. If you do not delete + the provisions above, a recipient may use your version of this file under + the terms of any one of the MPL, the GPL or the LGPL. + +*/ + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.IO; +using System.Net; +using System.Text; +using System.Web; +using System.Windows.Forms; + +namespace OpenHardwareMonitor.GUI { + public partial class CrashForm : Form { + + private Exception exception; + + public CrashForm() { + InitializeComponent(); + } + + public Exception Exception { + get { return exception; } + set { + exception = value; + StringBuilder s = new StringBuilder(); + Version version = typeof(CrashForm).Assembly.GetName().Version; + s.Append("Version: "); s.AppendLine(version.ToString()); + s.AppendLine(); + s.AppendLine(exception.ToString()); + s.AppendLine(); + if (exception.InnerException != null) { + s.AppendLine(exception.InnerException.ToString()); + s.AppendLine(); + } + s.Append("Common Language Runtime: "); + s.AppendLine(Environment.Version.ToString()); + s.Append("Operating System: "); + s.AppendLine(Environment.OSVersion.ToString()); + s.Append("Process Type: "); + s.AppendLine(IntPtr.Size == 4 ? "32-Bit" : "64-Bit"); + reportTextBox.Text = s.ToString(); + } + } + + private void sendButton_Click(object sender, EventArgs e) { + try { + Version version = typeof(CrashForm).Assembly.GetName().Version; + WebRequest request = WebRequest.Create( + "http://openhardwaremonitor.org/report.php"); + request.Method = "POST"; + request.Timeout = 5000; + request.ContentType = "application/x-www-form-urlencoded"; + + string report = + "type=crash&" + + "version=" + HttpUtility.UrlEncode(version.ToString()) + "&" + + "report=" + HttpUtility.UrlEncode(reportTextBox.Text) + "&" + + "comment=" + HttpUtility.UrlEncode(commentTextBox.Text) + "&" + + "email=" + HttpUtility.UrlEncode(emailTextBox.Text); + byte[] byteArray = Encoding.UTF8.GetBytes(report); + request.ContentLength = byteArray.Length; + + try { + Stream dataStream = request.GetRequestStream(); + dataStream.Write(byteArray, 0, byteArray.Length); + dataStream.Close(); + + WebResponse response = request.GetResponse(); + dataStream = response.GetResponseStream(); + StreamReader reader = new StreamReader(dataStream); + string responseFromServer = reader.ReadToEnd(); + reader.Close(); + dataStream.Close(); + response.Close(); + + Close(); + } catch (WebException) { + MessageBox.Show("Sending the crash report failed.", "Error", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } catch { + } + } + } +} diff -r de70c4468b36 -r 522da3b8cb1a GUI/CrashForm.resx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/CrashForm.resx Sun Jul 04 12:12:37 2010 +0000 @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff -r de70c4468b36 -r 522da3b8cb1a GUI/CrashReportForm.Designer.cs --- a/GUI/CrashReportForm.Designer.cs Sat Jul 03 12:08:51 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,279 +0,0 @@ -/* - - Version: MPL 1.1/GPL 2.0/LGPL 2.1 - - The contents of this file are subject to the Mozilla Public License Version - 1.1 (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" basis, - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - for the specific language governing rights and limitations under the License. - - The Original Code is the Open Hardware Monitor code. - - The Initial Developer of the Original Code is - Michael Möller . - Portions created by the Initial Developer are Copyright (C) 2009-2010 - the Initial Developer. All Rights Reserved. - - Contributor(s): - - Alternatively, the contents of this file may be used under the terms of - either the GNU General Public License Version 2 or later (the "GPL"), or - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - in which case the provisions of the GPL or the LGPL are applicable instead - of those above. If you wish to allow use of your version of this file only - under the terms of either the GPL or the LGPL, and not to allow others to - use your version of this file under the terms of the MPL, indicate your - decision by deleting the provisions above and replace them with the notice - and other provisions required by the GPL or the LGPL. If you do not delete - the provisions above, a recipient may use your version of this file under - the terms of any one of the MPL, the GPL or the LGPL. - -*/ - -namespace OpenHardwareMonitor.GUI { - partial class CrashReportForm { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) { - if (disposing && (components != null)) { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() { - this.sendButton = new System.Windows.Forms.Button(); - this.exitButton = new System.Windows.Forms.Button(); - this.commentTextBox = new System.Windows.Forms.TextBox(); - this.titleLabel = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.commentPanel = new System.Windows.Forms.Panel(); - this.reportPanel = new System.Windows.Forms.Panel(); - this.reportTextBox = new System.Windows.Forms.TextBox(); - this.textBox1 = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); - this.emailTextBox = new System.Windows.Forms.TextBox(); - this.commentPanel.SuspendLayout(); - this.reportPanel.SuspendLayout(); - this.SuspendLayout(); - // - // sendButton - // - this.sendButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.sendButton.Location = new System.Drawing.Point(449, 469); - this.sendButton.Name = "sendButton"; - this.sendButton.Size = new System.Drawing.Size(75, 23); - this.sendButton.TabIndex = 2; - this.sendButton.Text = "Send"; - this.sendButton.UseVisualStyleBackColor = true; - this.sendButton.Click += new System.EventHandler(this.sendButton_Click); - // - // exitButton - // - this.exitButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.exitButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.exitButton.Location = new System.Drawing.Point(530, 469); - this.exitButton.Name = "exitButton"; - this.exitButton.Size = new System.Drawing.Size(75, 23); - this.exitButton.TabIndex = 3; - this.exitButton.Text = "Exit"; - this.exitButton.UseVisualStyleBackColor = true; - // - // commentTextBox - // - this.commentTextBox.AcceptsReturn = true; - this.commentTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.commentTextBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.commentTextBox.Location = new System.Drawing.Point(4, 4); - this.commentTextBox.Multiline = true; - this.commentTextBox.Name = "commentTextBox"; - this.commentTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.commentTextBox.Size = new System.Drawing.Size(586, 77); - this.commentTextBox.TabIndex = 1; - // - // titleLabel - // - this.titleLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.titleLabel.BackColor = System.Drawing.SystemColors.Window; - this.titleLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.titleLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.titleLabel.Location = new System.Drawing.Point(-1, -1); - this.titleLabel.Name = "titleLabel"; - this.titleLabel.Padding = new System.Windows.Forms.Padding(10); - this.titleLabel.Size = new System.Drawing.Size(619, 52); - this.titleLabel.TabIndex = 4; - this.titleLabel.Text = "Open Hardware Monitor has encountered a problem and needs to close. We are sorry " + - "for the inconvenience."; - // - // label3 - // - this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label3.AutoEllipsis = true; - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(9, 63); - this.label3.Margin = new System.Windows.Forms.Padding(3, 12, 3, 8); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(571, 13); - this.label3.TabIndex = 5; - this.label3.Text = "To help diagnose and fix the problem, you can send a crash report. The following " + - "report has been created automatically:"; - // - // label1 - // - this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label1.AutoEllipsis = true; - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(9, 347); - this.label1.Margin = new System.Windows.Forms.Padding(3, 12, 3, 8); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(279, 13); - this.label1.TabIndex = 6; - this.label1.Text = "You can add additional information to the report (optional):"; - // - // commentPanel - // - this.commentPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.commentPanel.BackColor = System.Drawing.SystemColors.Window; - this.commentPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.commentPanel.Controls.Add(this.commentTextBox); - this.commentPanel.Location = new System.Drawing.Point(12, 371); - this.commentPanel.Margin = new System.Windows.Forms.Padding(3, 3, 3, 8); - this.commentPanel.Name = "commentPanel"; - this.commentPanel.Padding = new System.Windows.Forms.Padding(4, 4, 1, 4); - this.commentPanel.Size = new System.Drawing.Size(593, 87); - this.commentPanel.TabIndex = 1; - this.commentPanel.TabStop = true; - // - // reportPanel - // - this.reportPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.reportPanel.BackColor = System.Drawing.SystemColors.Window; - this.reportPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.reportPanel.Controls.Add(this.reportTextBox); - this.reportPanel.Controls.Add(this.textBox1); - this.reportPanel.Location = new System.Drawing.Point(12, 87); - this.reportPanel.Name = "reportPanel"; - this.reportPanel.Padding = new System.Windows.Forms.Padding(4, 4, 1, 4); - this.reportPanel.Size = new System.Drawing.Size(593, 212); - this.reportPanel.TabIndex = 8; - // - // reportTextBox - // - this.reportTextBox.BackColor = System.Drawing.SystemColors.Window; - this.reportTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.reportTextBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.reportTextBox.Location = new System.Drawing.Point(4, 4); - this.reportTextBox.Multiline = true; - this.reportTextBox.Name = "reportTextBox"; - this.reportTextBox.ReadOnly = true; - this.reportTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.reportTextBox.Size = new System.Drawing.Size(586, 202); - this.reportTextBox.TabIndex = 9; - this.reportTextBox.TabStop = false; - // - // textBox1 - // - this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill; - this.textBox1.Location = new System.Drawing.Point(4, 4); - this.textBox1.Multiline = true; - this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(586, 202); - this.textBox1.TabIndex = 2; - // - // label2 - // - this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label2.AutoEllipsis = true; - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(9, 318); - this.label2.Margin = new System.Windows.Forms.Padding(3, 12, 3, 8); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(171, 13); - this.label2.TabIndex = 9; - this.label2.Text = "Enter your email address (optional):"; - // - // emailTextBox - // - this.emailTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.emailTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.emailTextBox.Location = new System.Drawing.Point(188, 315); - this.emailTextBox.Name = "emailTextBox"; - this.emailTextBox.Size = new System.Drawing.Size(417, 20); - this.emailTextBox.TabIndex = 0; - // - // CrashReportForm - // - this.AcceptButton = this.sendButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.exitButton; - this.ClientSize = new System.Drawing.Size(617, 504); - this.ControlBox = false; - this.Controls.Add(this.emailTextBox); - this.Controls.Add(this.label2); - this.Controls.Add(this.reportPanel); - this.Controls.Add(this.commentPanel); - this.Controls.Add(this.label1); - this.Controls.Add(this.label3); - this.Controls.Add(this.titleLabel); - this.Controls.Add(this.exitButton); - this.Controls.Add(this.sendButton); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "CrashReportForm"; - this.ShowIcon = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Open Hardware Monitor"; - this.commentPanel.ResumeLayout(false); - this.commentPanel.PerformLayout(); - this.reportPanel.ResumeLayout(false); - this.reportPanel.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Button sendButton; - private System.Windows.Forms.Button exitButton; - private System.Windows.Forms.TextBox commentTextBox; - private System.Windows.Forms.Label titleLabel; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Panel commentPanel; - private System.Windows.Forms.Panel reportPanel; - private System.Windows.Forms.TextBox reportTextBox; - private System.Windows.Forms.TextBox textBox1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox emailTextBox; - } -} \ No newline at end of file diff -r de70c4468b36 -r 522da3b8cb1a GUI/CrashReportForm.cs --- a/GUI/CrashReportForm.cs Sat Jul 03 12:08:51 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* - - Version: MPL 1.1/GPL 2.0/LGPL 2.1 - - The contents of this file are subject to the Mozilla Public License Version - 1.1 (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" basis, - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - for the specific language governing rights and limitations under the License. - - The Original Code is the Open Hardware Monitor code. - - The Initial Developer of the Original Code is - Michael Möller . - Portions created by the Initial Developer are Copyright (C) 2009-2010 - the Initial Developer. All Rights Reserved. - - Contributor(s): - - Alternatively, the contents of this file may be used under the terms of - either the GNU General Public License Version 2 or later (the "GPL"), or - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - in which case the provisions of the GPL or the LGPL are applicable instead - of those above. If you wish to allow use of your version of this file only - under the terms of either the GPL or the LGPL, and not to allow others to - use your version of this file under the terms of the MPL, indicate your - decision by deleting the provisions above and replace them with the notice - and other provisions required by the GPL or the LGPL. If you do not delete - the provisions above, a recipient may use your version of this file under - the terms of any one of the MPL, the GPL or the LGPL. - -*/ - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Net; -using System.Text; -using System.Web; -using System.Windows.Forms; - -namespace OpenHardwareMonitor.GUI { - public partial class CrashReportForm : Form { - - private Exception exception; - - public CrashReportForm() { - InitializeComponent(); - } - - public Exception Exception { - get { return exception; } - set { - exception = value; - StringBuilder s = new StringBuilder(); - Version version = typeof(CrashReportForm).Assembly.GetName().Version; - s.Append("Version: "); s.AppendLine(version.ToString()); - s.AppendLine(); - s.AppendLine(exception.ToString()); - s.AppendLine(); - if (exception.InnerException != null) { - s.AppendLine(exception.InnerException.ToString()); - s.AppendLine(); - } - s.Append("Common Language Runtime: "); - s.AppendLine(Environment.Version.ToString()); - s.Append("Operating System: "); - s.AppendLine(Environment.OSVersion.ToString()); - s.Append("Process Type: "); - s.AppendLine(IntPtr.Size == 4 ? "32-Bit" : "64-Bit"); - reportTextBox.Text = s.ToString(); - } - } - - private void sendButton_Click(object sender, EventArgs e) { - try { - Version version = typeof(CrashReportForm).Assembly.GetName().Version; - WebRequest request = WebRequest.Create( - "http://openhardwaremonitor.org/report.php"); - request.Method = "POST"; - request.Timeout = 5000; - request.ContentType = "application/x-www-form-urlencoded"; - - string report = - "version=" + HttpUtility.UrlEncode(version.ToString()) + "&" + - "report=" + HttpUtility.UrlEncode(reportTextBox.Text) + "&" + - "comment=" + HttpUtility.UrlEncode(commentTextBox.Text) + "&" + - "email=" + HttpUtility.UrlEncode(emailTextBox.Text); - byte[] byteArray = Encoding.UTF8.GetBytes(report); - request.ContentLength = byteArray.Length; - - try { - Stream dataStream = request.GetRequestStream(); - dataStream.Write(byteArray, 0, byteArray.Length); - dataStream.Close(); - - WebResponse response = request.GetResponse(); - dataStream = response.GetResponseStream(); - StreamReader reader = new StreamReader(dataStream); - string responseFromServer = reader.ReadToEnd(); - reader.Close(); - dataStream.Close(); - response.Close(); - - Close(); - } catch (WebException) { - MessageBox.Show("Sending the crash report failed.", "Error", - MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } catch { - } - } - } -} diff -r de70c4468b36 -r 522da3b8cb1a GUI/CrashReportForm.resx --- a/GUI/CrashReportForm.resx Sat Jul 03 12:08:51 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff -r de70c4468b36 -r 522da3b8cb1a GUI/MainForm.Designer.cs --- a/GUI/MainForm.Designer.cs Sat Jul 03 12:08:51 2010 +0000 +++ b/GUI/MainForm.Designer.cs Sun Jul 04 12:12:37 2010 +0000 @@ -102,6 +102,8 @@ this.sensorContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); this.timer = new System.Windows.Forms.Timer(this.components); + this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); + this.sumbitReportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip.SuspendLayout(); this.splitContainer.Panel1.SuspendLayout(); this.splitContainer.Panel2.SuspendLayout(); @@ -227,6 +229,8 @@ // this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.saveReportToolStripMenuItem, + this.sumbitReportToolStripMenuItem, + this.toolStripMenuItem2, this.exitToolStripMenuItem}); this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); @@ -235,14 +239,14 @@ // saveReportToolStripMenuItem // this.saveReportToolStripMenuItem.Name = "saveReportToolStripMenuItem"; - this.saveReportToolStripMenuItem.Size = new System.Drawing.Size(145, 22); + this.saveReportToolStripMenuItem.Size = new System.Drawing.Size(159, 22); this.saveReportToolStripMenuItem.Text = "Save Report..."; this.saveReportToolStripMenuItem.Click += new System.EventHandler(this.saveReportToolStripMenuItem_Click); // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(145, 22); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(159, 22); this.exitToolStripMenuItem.Text = "Exit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitClick); // @@ -296,7 +300,7 @@ this.valueMenuItem.CheckOnClick = true; this.valueMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.valueMenuItem.Name = "valueMenuItem"; - this.valueMenuItem.Size = new System.Drawing.Size(152, 22); + this.valueMenuItem.Size = new System.Drawing.Size(103, 22); this.valueMenuItem.Text = "Value"; this.valueMenuItem.CheckedChanged += new System.EventHandler(this.valueMenuItem_CheckedChanged); // @@ -306,7 +310,7 @@ this.minMenuItem.CheckOnClick = true; this.minMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.minMenuItem.Name = "minMenuItem"; - this.minMenuItem.Size = new System.Drawing.Size(152, 22); + this.minMenuItem.Size = new System.Drawing.Size(103, 22); this.minMenuItem.Text = "Min"; this.minMenuItem.CheckedChanged += new System.EventHandler(this.minMenuItem_CheckedChanged); // @@ -316,7 +320,7 @@ this.maxMenuItem.CheckOnClick = true; this.maxMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.maxMenuItem.Name = "maxMenuItem"; - this.maxMenuItem.Size = new System.Drawing.Size(152, 22); + this.maxMenuItem.Size = new System.Drawing.Size(103, 22); this.maxMenuItem.Text = "Max"; this.maxMenuItem.CheckedChanged += new System.EventHandler(this.maxMenuItem_CheckedChanged); // @@ -460,6 +464,18 @@ this.timer.Interval = 1000; this.timer.Tick += new System.EventHandler(this.timer_Tick); // + // toolStripMenuItem2 + // + this.toolStripMenuItem2.Name = "toolStripMenuItem2"; + this.toolStripMenuItem2.Size = new System.Drawing.Size(156, 6); + // + // sumbitReportToolStripMenuItem + // + this.sumbitReportToolStripMenuItem.Name = "sumbitReportToolStripMenuItem"; + this.sumbitReportToolStripMenuItem.Size = new System.Drawing.Size(159, 22); + this.sumbitReportToolStripMenuItem.Text = "Submit Report..."; + this.sumbitReportToolStripMenuItem.Click += new System.EventHandler(this.sumbitReportToolStripMenuItem_Click); + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -525,6 +541,8 @@ private System.Windows.Forms.ToolStripSeparator toolStripMenuItem4; private System.Windows.Forms.ToolStripMenuItem celciusToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem fahrenheitToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem sumbitReportToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2; } } diff -r de70c4468b36 -r 522da3b8cb1a GUI/MainForm.cs --- a/GUI/MainForm.cs Sat Jul 03 12:08:51 2010 +0000 +++ b/GUI/MainForm.cs Sun Jul 04 12:12:37 2010 +0000 @@ -455,5 +455,12 @@ fahrenheitToolStripMenuItem.Checked = true; UnitManager.TemperatureUnit = TemperatureUnit.Fahrenheit; } + + private void sumbitReportToolStripMenuItem_Click(object sender, EventArgs e) + { + ReportForm form = new ReportForm(); + form.Report = computer.GetReport(); + form.ShowDialog(); + } } } diff -r de70c4468b36 -r 522da3b8cb1a GUI/ReportForm.Designer.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/ReportForm.Designer.cs Sun Jul 04 12:12:37 2010 +0000 @@ -0,0 +1,273 @@ +/* + + Version: MPL 1.1/GPL 2.0/LGPL 2.1 + + The contents of this file are subject to the Mozilla Public License Version + 1.1 (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + for the specific language governing rights and limitations under the License. + + The Original Code is the Open Hardware Monitor code. + + The Initial Developer of the Original Code is + Michael Möller . + Portions created by the Initial Developer are Copyright (C) 2009-2010 + the Initial Developer. All Rights Reserved. + + Contributor(s): + + Alternatively, the contents of this file may be used under the terms of + either the GNU General Public License Version 2 or later (the "GPL"), or + the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + in which case the provisions of the GPL or the LGPL are applicable instead + of those above. If you wish to allow use of your version of this file only + under the terms of either the GPL or the LGPL, and not to allow others to + use your version of this file under the terms of the MPL, indicate your + decision by deleting the provisions above and replace them with the notice + and other provisions required by the GPL or the LGPL. If you do not delete + the provisions above, a recipient may use your version of this file under + the terms of any one of the MPL, the GPL or the LGPL. + +*/ + +namespace OpenHardwareMonitor.GUI { + partial class ReportForm { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + this.sendButton = new System.Windows.Forms.Button(); + this.exitButton = new System.Windows.Forms.Button(); + this.commentTextBox = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.commentPanel = new System.Windows.Forms.Panel(); + this.reportPanel = new System.Windows.Forms.Panel(); + this.reportTextBox = new System.Windows.Forms.TextBox(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.emailTextBox = new System.Windows.Forms.TextBox(); + this.titleLabel = new System.Windows.Forms.Label(); + this.commentPanel.SuspendLayout(); + this.reportPanel.SuspendLayout(); + this.SuspendLayout(); + // + // sendButton + // + this.sendButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.sendButton.Location = new System.Drawing.Point(472, 627); + this.sendButton.Name = "sendButton"; + this.sendButton.Size = new System.Drawing.Size(75, 23); + this.sendButton.TabIndex = 2; + this.sendButton.Text = "Send"; + this.sendButton.UseVisualStyleBackColor = true; + this.sendButton.Click += new System.EventHandler(this.sendButton_Click); + // + // exitButton + // + this.exitButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.exitButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.exitButton.Location = new System.Drawing.Point(553, 627); + this.exitButton.Name = "exitButton"; + this.exitButton.Size = new System.Drawing.Size(75, 23); + this.exitButton.TabIndex = 3; + this.exitButton.Text = "Canel"; + this.exitButton.UseVisualStyleBackColor = true; + // + // commentTextBox + // + this.commentTextBox.AcceptsReturn = true; + this.commentTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.commentTextBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.commentTextBox.Location = new System.Drawing.Point(4, 4); + this.commentTextBox.Multiline = true; + this.commentTextBox.Name = "commentTextBox"; + this.commentTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.commentTextBox.Size = new System.Drawing.Size(609, 77); + this.commentTextBox.TabIndex = 1; + // + // label3 + // + this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.label3.AutoEllipsis = true; + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(9, 39); + this.label3.Margin = new System.Windows.Forms.Padding(3, 12, 3, 8); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(253, 13); + this.label3.TabIndex = 5; + this.label3.Text = "The following report has been created automatically:"; + // + // label1 + // + this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.label1.AutoEllipsis = true; + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(9, 505); + this.label1.Margin = new System.Windows.Forms.Padding(3, 12, 3, 8); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(279, 13); + this.label1.TabIndex = 6; + this.label1.Text = "You can add additional information to the report (optional):"; + // + // commentPanel + // + this.commentPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.commentPanel.BackColor = System.Drawing.SystemColors.Window; + this.commentPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.commentPanel.Controls.Add(this.commentTextBox); + this.commentPanel.Location = new System.Drawing.Point(12, 529); + this.commentPanel.Margin = new System.Windows.Forms.Padding(3, 3, 3, 8); + this.commentPanel.Name = "commentPanel"; + this.commentPanel.Padding = new System.Windows.Forms.Padding(4, 4, 1, 4); + this.commentPanel.Size = new System.Drawing.Size(616, 87); + this.commentPanel.TabIndex = 1; + this.commentPanel.TabStop = true; + // + // reportPanel + // + this.reportPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.reportPanel.BackColor = System.Drawing.SystemColors.Window; + this.reportPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.reportPanel.Controls.Add(this.reportTextBox); + this.reportPanel.Controls.Add(this.textBox1); + this.reportPanel.Location = new System.Drawing.Point(12, 63); + this.reportPanel.Name = "reportPanel"; + this.reportPanel.Padding = new System.Windows.Forms.Padding(4, 4, 1, 4); + this.reportPanel.Size = new System.Drawing.Size(616, 394); + this.reportPanel.TabIndex = 8; + // + // reportTextBox + // + this.reportTextBox.BackColor = System.Drawing.SystemColors.Window; + this.reportTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.reportTextBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.reportTextBox.Location = new System.Drawing.Point(4, 4); + this.reportTextBox.Multiline = true; + this.reportTextBox.Name = "reportTextBox"; + this.reportTextBox.ReadOnly = true; + this.reportTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.reportTextBox.Size = new System.Drawing.Size(609, 384); + this.reportTextBox.TabIndex = 9; + this.reportTextBox.TabStop = false; + // + // textBox1 + // + this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBox1.Location = new System.Drawing.Point(4, 4); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(609, 384); + this.textBox1.TabIndex = 2; + // + // label2 + // + this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.label2.AutoEllipsis = true; + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(9, 476); + this.label2.Margin = new System.Windows.Forms.Padding(3, 12, 3, 8); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(171, 13); + this.label2.TabIndex = 9; + this.label2.Text = "Enter your email address (optional):"; + // + // emailTextBox + // + this.emailTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.emailTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.emailTextBox.Location = new System.Drawing.Point(188, 473); + this.emailTextBox.Name = "emailTextBox"; + this.emailTextBox.Size = new System.Drawing.Size(440, 20); + this.emailTextBox.TabIndex = 0; + // + // titleLabel + // + this.titleLabel.AutoSize = true; + this.titleLabel.Location = new System.Drawing.Point(9, 14); + this.titleLabel.Name = "titleLabel"; + this.titleLabel.Size = new System.Drawing.Size(409, 13); + this.titleLabel.TabIndex = 10; + this.titleLabel.Text = "Help improve the Open Hardware Monitor by submitting a report about your hardware" + + "."; + // + // ReportForm + // + this.AcceptButton = this.sendButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.exitButton; + this.ClientSize = new System.Drawing.Size(640, 662); + this.ControlBox = false; + this.Controls.Add(this.titleLabel); + this.Controls.Add(this.emailTextBox); + this.Controls.Add(this.label2); + this.Controls.Add(this.reportPanel); + this.Controls.Add(this.commentPanel); + this.Controls.Add(this.label1); + this.Controls.Add(this.label3); + this.Controls.Add(this.exitButton); + this.Controls.Add(this.sendButton); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "ReportForm"; + this.ShowIcon = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Open Hardware Monitor"; + this.commentPanel.ResumeLayout(false); + this.commentPanel.PerformLayout(); + this.reportPanel.ResumeLayout(false); + this.reportPanel.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button sendButton; + private System.Windows.Forms.Button exitButton; + private System.Windows.Forms.TextBox commentTextBox; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Panel commentPanel; + private System.Windows.Forms.Panel reportPanel; + private System.Windows.Forms.TextBox reportTextBox; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox emailTextBox; + private System.Windows.Forms.Label titleLabel; + } +} \ No newline at end of file diff -r de70c4468b36 -r 522da3b8cb1a GUI/ReportForm.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/ReportForm.cs Sun Jul 04 12:12:37 2010 +0000 @@ -0,0 +1,107 @@ +/* + + Version: MPL 1.1/GPL 2.0/LGPL 2.1 + + The contents of this file are subject to the Mozilla Public License Version + 1.1 (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + for the specific language governing rights and limitations under the License. + + The Original Code is the Open Hardware Monitor code. + + The Initial Developer of the Original Code is + Michael Möller . + Portions created by the Initial Developer are Copyright (C) 2009-2010 + the Initial Developer. All Rights Reserved. + + Contributor(s): + + Alternatively, the contents of this file may be used under the terms of + either the GNU General Public License Version 2 or later (the "GPL"), or + the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + in which case the provisions of the GPL or the LGPL are applicable instead + of those above. If you wish to allow use of your version of this file only + under the terms of either the GPL or the LGPL, and not to allow others to + use your version of this file under the terms of the MPL, indicate your + decision by deleting the provisions above and replace them with the notice + and other provisions required by the GPL or the LGPL. If you do not delete + the provisions above, a recipient may use your version of this file under + the terms of any one of the MPL, the GPL or the LGPL. + +*/ + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.IO; +using System.Net; +using System.Text; +using System.Web; +using System.Windows.Forms; + +namespace OpenHardwareMonitor.GUI { + public partial class ReportForm : Form { + + private string report; + + public ReportForm() { + InitializeComponent(); + try { + titleLabel.Font = new Font(SystemFonts.DefaultFont, FontStyle.Bold); + reportTextBox.Font = new Font(FontFamily.GenericMonospace, + SystemFonts.DefaultFont.Size); + } catch { } + } + + public string Report { + get { return report; } + set { + report = value; + reportTextBox.Text = report; + } + } + + private void sendButton_Click(object sender, EventArgs e) { + Version version = typeof(CrashForm).Assembly.GetName().Version; + WebRequest request = WebRequest.Create( + "http://openhardwaremonitor.org/report.php"); + request.Method = "POST"; + request.Timeout = 5000; + request.ContentType = "application/x-www-form-urlencoded"; + + string report = + "type=hardware&" + + "version=" + HttpUtility.UrlEncode(version.ToString()) + "&" + + "report=" + HttpUtility.UrlEncode(reportTextBox.Text) + "&" + + "comment=" + HttpUtility.UrlEncode(commentTextBox.Text) + "&" + + "email=" + HttpUtility.UrlEncode(emailTextBox.Text); + byte[] byteArray = Encoding.UTF8.GetBytes(report); + request.ContentLength = byteArray.Length; + + try { + Stream dataStream = request.GetRequestStream(); + dataStream.Write(byteArray, 0, byteArray.Length); + dataStream.Close(); + + WebResponse response = request.GetResponse(); + dataStream = response.GetResponseStream(); + StreamReader reader = new StreamReader(dataStream); + string responseFromServer = reader.ReadToEnd(); + reader.Close(); + dataStream.Close(); + response.Close(); + + Close(); + } catch (WebException) { + MessageBox.Show("Sending the hardware report failed.", "Error", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } +} diff -r de70c4468b36 -r 522da3b8cb1a GUI/ReportForm.resx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/ReportForm.resx Sun Jul 04 12:12:37 2010 +0000 @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff -r de70c4468b36 -r 522da3b8cb1a OpenHardwareMonitor.csproj --- a/OpenHardwareMonitor.csproj Sat Jul 03 12:08:51 2010 +0000 +++ b/OpenHardwareMonitor.csproj Sun Jul 04 12:12:37 2010 +0000 @@ -61,11 +61,17 @@ - + Form - - CrashReportForm.cs + + ReportForm.cs + + + Form + + + CrashForm.cs @@ -200,12 +206,15 @@ - - CrashReportForm.cs + + CrashForm.cs + + ReportForm.cs + diff -r de70c4468b36 -r 522da3b8cb1a Program.cs --- a/Program.cs Sat Jul 03 12:08:51 2010 +0000 +++ b/Program.cs Sun Jul 04 12:12:37 2010 +0000 @@ -102,7 +102,7 @@ } private static void ReportException(Exception e) { - CrashReportForm form = new CrashReportForm(); + CrashForm form = new CrashForm(); form.Exception = e; form.ShowDialog(); }