Fixed Issue 26. Added a dialog to automatically send a crash report.
authormoel.mich
Fri, 02 Apr 2010 16:05:07 +0000
changeset 86b4f0f206173d
parent 85 ec4ccaa1210d
child 87 ecdc3bcef083
Fixed Issue 26. Added a dialog to automatically send a crash report.
GUI/CrashReportForm.Designer.cs
GUI/CrashReportForm.cs
GUI/CrashReportForm.resx
GUI/MainForm.Designer.cs
GUI/MainForm.cs
GUI/MainForm.resx
GUI/ParameterForm.Designer.cs
GUI/ParameterForm.cs
GUI/SensorNotifyIcon.cs
Hardware/CPU/IntelCPU.cs
Hardware/Computer.cs
Hardware/IComputer.cs
Hardware/TBalancer/TBalancer.cs
OpenHardwareMonitor.csproj
Program.cs
Utilities/CrashReport.cs
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/GUI/CrashReportForm.Designer.cs	Fri Apr 02 16:05:07 2010 +0000
     1.3 @@ -0,0 +1,249 @@
     1.4 +/*
     1.5 +  
     1.6 +  Version: MPL 1.1/GPL 2.0/LGPL 2.1
     1.7 +
     1.8 +  The contents of this file are subject to the Mozilla Public License Version
     1.9 +  1.1 (the "License"); you may not use this file except in compliance with
    1.10 +  the License. You may obtain a copy of the License at
    1.11 + 
    1.12 +  http://www.mozilla.org/MPL/
    1.13 +
    1.14 +  Software distributed under the License is distributed on an "AS IS" basis,
    1.15 +  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    1.16 +  for the specific language governing rights and limitations under the License.
    1.17 +
    1.18 +  The Original Code is the Open Hardware Monitor code.
    1.19 +
    1.20 +  The Initial Developer of the Original Code is 
    1.21 +  Michael Möller <m.moeller@gmx.ch>.
    1.22 +  Portions created by the Initial Developer are Copyright (C) 2009-2010
    1.23 +  the Initial Developer. All Rights Reserved.
    1.24 +
    1.25 +  Contributor(s):
    1.26 +
    1.27 +  Alternatively, the contents of this file may be used under the terms of
    1.28 +  either the GNU General Public License Version 2 or later (the "GPL"), or
    1.29 +  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    1.30 +  in which case the provisions of the GPL or the LGPL are applicable instead
    1.31 +  of those above. If you wish to allow use of your version of this file only
    1.32 +  under the terms of either the GPL or the LGPL, and not to allow others to
    1.33 +  use your version of this file under the terms of the MPL, indicate your
    1.34 +  decision by deleting the provisions above and replace them with the notice
    1.35 +  and other provisions required by the GPL or the LGPL. If you do not delete
    1.36 +  the provisions above, a recipient may use your version of this file under
    1.37 +  the terms of any one of the MPL, the GPL or the LGPL.
    1.38 + 
    1.39 +*/
    1.40 +
    1.41 +namespace OpenHardwareMonitor.GUI {
    1.42 +  partial class CrashReportForm {
    1.43 +    /// <summary>
    1.44 +    /// Required designer variable.
    1.45 +    /// </summary>
    1.46 +    private System.ComponentModel.IContainer components = null;
    1.47 +
    1.48 +    /// <summary>
    1.49 +    /// Clean up any resources being used.
    1.50 +    /// </summary>
    1.51 +    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    1.52 +    protected override void Dispose(bool disposing) {
    1.53 +      if (disposing && (components != null)) {
    1.54 +        components.Dispose();
    1.55 +      }
    1.56 +      base.Dispose(disposing);
    1.57 +    }
    1.58 +
    1.59 +    #region Windows Form Designer generated code
    1.60 +
    1.61 +    /// <summary>
    1.62 +    /// Required method for Designer support - do not modify
    1.63 +    /// the contents of this method with the code editor.
    1.64 +    /// </summary>
    1.65 +    private void InitializeComponent() {
    1.66 +      this.sendButton = new System.Windows.Forms.Button();
    1.67 +      this.exitButton = new System.Windows.Forms.Button();
    1.68 +      this.commentTextBox = new System.Windows.Forms.TextBox();
    1.69 +      this.titleLabel = new System.Windows.Forms.Label();
    1.70 +      this.label3 = new System.Windows.Forms.Label();
    1.71 +      this.label1 = new System.Windows.Forms.Label();
    1.72 +      this.commentPanel = new System.Windows.Forms.Panel();
    1.73 +      this.reportPanel = new System.Windows.Forms.Panel();
    1.74 +      this.reportTextBox = new System.Windows.Forms.TextBox();
    1.75 +      this.textBox1 = new System.Windows.Forms.TextBox();
    1.76 +      this.commentPanel.SuspendLayout();
    1.77 +      this.reportPanel.SuspendLayout();
    1.78 +      this.SuspendLayout();
    1.79 +      // 
    1.80 +      // sendButton
    1.81 +      // 
    1.82 +      this.sendButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    1.83 +      this.sendButton.Location = new System.Drawing.Point(467, 412);
    1.84 +      this.sendButton.Name = "sendButton";
    1.85 +      this.sendButton.Size = new System.Drawing.Size(75, 23);
    1.86 +      this.sendButton.TabIndex = 1;
    1.87 +      this.sendButton.Text = "Send";
    1.88 +      this.sendButton.UseVisualStyleBackColor = true;
    1.89 +      this.sendButton.Click += new System.EventHandler(this.sendButton_Click);
    1.90 +      // 
    1.91 +      // exitButton
    1.92 +      // 
    1.93 +      this.exitButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    1.94 +      this.exitButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
    1.95 +      this.exitButton.Location = new System.Drawing.Point(548, 412);
    1.96 +      this.exitButton.Name = "exitButton";
    1.97 +      this.exitButton.Size = new System.Drawing.Size(75, 23);
    1.98 +      this.exitButton.TabIndex = 2;
    1.99 +      this.exitButton.Text = "Exit";
   1.100 +      this.exitButton.UseVisualStyleBackColor = true;
   1.101 +      // 
   1.102 +      // commentTextBox
   1.103 +      // 
   1.104 +      this.commentTextBox.AcceptsReturn = true;
   1.105 +      this.commentTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
   1.106 +      this.commentTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
   1.107 +      this.commentTextBox.Location = new System.Drawing.Point(4, 4);
   1.108 +      this.commentTextBox.Multiline = true;
   1.109 +      this.commentTextBox.Name = "commentTextBox";
   1.110 +      this.commentTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
   1.111 +      this.commentTextBox.Size = new System.Drawing.Size(604, 77);
   1.112 +      this.commentTextBox.TabIndex = 0;
   1.113 +      // 
   1.114 +      // titleLabel
   1.115 +      // 
   1.116 +      this.titleLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
   1.117 +                  | System.Windows.Forms.AnchorStyles.Right)));
   1.118 +      this.titleLabel.BackColor = System.Drawing.SystemColors.Window;
   1.119 +      this.titleLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
   1.120 +      this.titleLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
   1.121 +      this.titleLabel.Location = new System.Drawing.Point(-1, -1);
   1.122 +      this.titleLabel.Name = "titleLabel";
   1.123 +      this.titleLabel.Padding = new System.Windows.Forms.Padding(10);
   1.124 +      this.titleLabel.Size = new System.Drawing.Size(637, 52);
   1.125 +      this.titleLabel.TabIndex = 4;
   1.126 +      this.titleLabel.Text = "Open Hardware Monitor has encountered a problem and needs to close. We are sorry " +
   1.127 +          "for the inconvenience.";
   1.128 +      // 
   1.129 +      // label3
   1.130 +      // 
   1.131 +      this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
   1.132 +                  | System.Windows.Forms.AnchorStyles.Right)));
   1.133 +      this.label3.AutoEllipsis = true;
   1.134 +      this.label3.AutoSize = true;
   1.135 +      this.label3.Location = new System.Drawing.Point(9, 63);
   1.136 +      this.label3.Margin = new System.Windows.Forms.Padding(3, 12, 3, 8);
   1.137 +      this.label3.Name = "label3";
   1.138 +      this.label3.Size = new System.Drawing.Size(571, 13);
   1.139 +      this.label3.TabIndex = 5;
   1.140 +      this.label3.Text = "To help diagnose and fix the problem, you can send a crash report. The following " +
   1.141 +          "report has been created automatically.";
   1.142 +      // 
   1.143 +      // label1
   1.144 +      // 
   1.145 +      this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
   1.146 +                  | System.Windows.Forms.AnchorStyles.Right)));
   1.147 +      this.label1.AutoEllipsis = true;
   1.148 +      this.label1.AutoSize = true;
   1.149 +      this.label1.Location = new System.Drawing.Point(9, 290);
   1.150 +      this.label1.Margin = new System.Windows.Forms.Padding(3, 12, 3, 8);
   1.151 +      this.label1.Name = "label1";
   1.152 +      this.label1.Size = new System.Drawing.Size(233, 13);
   1.153 +      this.label1.TabIndex = 6;
   1.154 +      this.label1.Text = "You can add additional information to the report.";
   1.155 +      // 
   1.156 +      // commentPanel
   1.157 +      // 
   1.158 +      this.commentPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
   1.159 +                  | System.Windows.Forms.AnchorStyles.Right)));
   1.160 +      this.commentPanel.BackColor = System.Drawing.SystemColors.Window;
   1.161 +      this.commentPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
   1.162 +      this.commentPanel.Controls.Add(this.commentTextBox);
   1.163 +      this.commentPanel.Location = new System.Drawing.Point(12, 314);
   1.164 +      this.commentPanel.Margin = new System.Windows.Forms.Padding(3, 3, 3, 8);
   1.165 +      this.commentPanel.Name = "commentPanel";
   1.166 +      this.commentPanel.Padding = new System.Windows.Forms.Padding(4, 4, 1, 4);
   1.167 +      this.commentPanel.Size = new System.Drawing.Size(611, 87);
   1.168 +      this.commentPanel.TabIndex = 7;
   1.169 +      // 
   1.170 +      // reportPanel
   1.171 +      // 
   1.172 +      this.reportPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
   1.173 +                  | System.Windows.Forms.AnchorStyles.Left)
   1.174 +                  | System.Windows.Forms.AnchorStyles.Right)));
   1.175 +      this.reportPanel.BackColor = System.Drawing.SystemColors.Window;
   1.176 +      this.reportPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
   1.177 +      this.reportPanel.Controls.Add(this.reportTextBox);
   1.178 +      this.reportPanel.Controls.Add(this.textBox1);
   1.179 +      this.reportPanel.Location = new System.Drawing.Point(12, 87);
   1.180 +      this.reportPanel.Name = "reportPanel";
   1.181 +      this.reportPanel.Padding = new System.Windows.Forms.Padding(4, 4, 1, 4);
   1.182 +      this.reportPanel.Size = new System.Drawing.Size(611, 188);
   1.183 +      this.reportPanel.TabIndex = 8;
   1.184 +      // 
   1.185 +      // reportTextBox
   1.186 +      // 
   1.187 +      this.reportTextBox.BackColor = System.Drawing.SystemColors.Window;
   1.188 +      this.reportTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
   1.189 +      this.reportTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
   1.190 +      this.reportTextBox.Location = new System.Drawing.Point(4, 4);
   1.191 +      this.reportTextBox.Multiline = true;
   1.192 +      this.reportTextBox.Name = "reportTextBox";
   1.193 +      this.reportTextBox.ReadOnly = true;
   1.194 +      this.reportTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
   1.195 +      this.reportTextBox.Size = new System.Drawing.Size(604, 178);
   1.196 +      this.reportTextBox.TabIndex = 9;
   1.197 +      this.reportTextBox.TabStop = false;
   1.198 +      // 
   1.199 +      // textBox1
   1.200 +      // 
   1.201 +      this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
   1.202 +      this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill;
   1.203 +      this.textBox1.Location = new System.Drawing.Point(4, 4);
   1.204 +      this.textBox1.Multiline = true;
   1.205 +      this.textBox1.Name = "textBox1";
   1.206 +      this.textBox1.Size = new System.Drawing.Size(604, 178);
   1.207 +      this.textBox1.TabIndex = 2;
   1.208 +      // 
   1.209 +      // CrashReportForm
   1.210 +      // 
   1.211 +      this.AcceptButton = this.sendButton;
   1.212 +      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
   1.213 +      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
   1.214 +      this.CancelButton = this.exitButton;
   1.215 +      this.ClientSize = new System.Drawing.Size(635, 447);
   1.216 +      this.ControlBox = false;
   1.217 +      this.Controls.Add(this.reportPanel);
   1.218 +      this.Controls.Add(this.commentPanel);
   1.219 +      this.Controls.Add(this.label1);
   1.220 +      this.Controls.Add(this.label3);
   1.221 +      this.Controls.Add(this.titleLabel);
   1.222 +      this.Controls.Add(this.exitButton);
   1.223 +      this.Controls.Add(this.sendButton);
   1.224 +      this.MaximizeBox = false;
   1.225 +      this.MinimizeBox = false;
   1.226 +      this.Name = "CrashReportForm";
   1.227 +      this.ShowIcon = false;
   1.228 +      this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
   1.229 +      this.Text = "Open Hardware Monitor";
   1.230 +      this.commentPanel.ResumeLayout(false);
   1.231 +      this.commentPanel.PerformLayout();
   1.232 +      this.reportPanel.ResumeLayout(false);
   1.233 +      this.reportPanel.PerformLayout();
   1.234 +      this.ResumeLayout(false);
   1.235 +      this.PerformLayout();
   1.236 +
   1.237 +    }
   1.238 +
   1.239 +    #endregion
   1.240 +
   1.241 +    private System.Windows.Forms.Button sendButton;
   1.242 +    private System.Windows.Forms.Button exitButton;
   1.243 +    private System.Windows.Forms.TextBox commentTextBox;
   1.244 +    private System.Windows.Forms.Label titleLabel;
   1.245 +    private System.Windows.Forms.Label label3;
   1.246 +    private System.Windows.Forms.Label label1;
   1.247 +    private System.Windows.Forms.Panel commentPanel;
   1.248 +    private System.Windows.Forms.Panel reportPanel;
   1.249 +    private System.Windows.Forms.TextBox reportTextBox;
   1.250 +    private System.Windows.Forms.TextBox textBox1;
   1.251 +  }
   1.252 +}
   1.253 \ No newline at end of file
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/GUI/CrashReportForm.cs	Fri Apr 02 16:05:07 2010 +0000
     2.3 @@ -0,0 +1,107 @@
     2.4 +/*
     2.5 +  
     2.6 +  Version: MPL 1.1/GPL 2.0/LGPL 2.1
     2.7 +
     2.8 +  The contents of this file are subject to the Mozilla Public License Version
     2.9 +  1.1 (the "License"); you may not use this file except in compliance with
    2.10 +  the License. You may obtain a copy of the License at
    2.11 + 
    2.12 +  http://www.mozilla.org/MPL/
    2.13 +
    2.14 +  Software distributed under the License is distributed on an "AS IS" basis,
    2.15 +  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    2.16 +  for the specific language governing rights and limitations under the License.
    2.17 +
    2.18 +  The Original Code is the Open Hardware Monitor code.
    2.19 +
    2.20 +  The Initial Developer of the Original Code is 
    2.21 +  Michael Möller <m.moeller@gmx.ch>.
    2.22 +  Portions created by the Initial Developer are Copyright (C) 2009-2010
    2.23 +  the Initial Developer. All Rights Reserved.
    2.24 +
    2.25 +  Contributor(s):
    2.26 +
    2.27 +  Alternatively, the contents of this file may be used under the terms of
    2.28 +  either the GNU General Public License Version 2 or later (the "GPL"), or
    2.29 +  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    2.30 +  in which case the provisions of the GPL or the LGPL are applicable instead
    2.31 +  of those above. If you wish to allow use of your version of this file only
    2.32 +  under the terms of either the GPL or the LGPL, and not to allow others to
    2.33 +  use your version of this file under the terms of the MPL, indicate your
    2.34 +  decision by deleting the provisions above and replace them with the notice
    2.35 +  and other provisions required by the GPL or the LGPL. If you do not delete
    2.36 +  the provisions above, a recipient may use your version of this file under
    2.37 +  the terms of any one of the MPL, the GPL or the LGPL.
    2.38 + 
    2.39 +*/
    2.40 +
    2.41 +using System;
    2.42 +using System.Collections.Generic;
    2.43 +using System.ComponentModel;
    2.44 +using System.Data;
    2.45 +using System.Drawing;
    2.46 +using System.IO;
    2.47 +using System.Net;
    2.48 +using System.Text;
    2.49 +using System.Web;
    2.50 +using System.Windows.Forms;
    2.51 +
    2.52 +namespace OpenHardwareMonitor.GUI {
    2.53 +  public partial class CrashReportForm : Form {
    2.54 +
    2.55 +    private Exception exception;
    2.56 +
    2.57 +    public CrashReportForm() {
    2.58 +      InitializeComponent();
    2.59 +    }
    2.60 +
    2.61 +    public Exception Exception {
    2.62 +      get { return exception; }
    2.63 +      set {
    2.64 +        exception = value;
    2.65 +        StringBuilder s = new StringBuilder();
    2.66 +        Version version = typeof(CrashReportForm).Assembly.GetName().Version;
    2.67 +        s.Append("Version: "); s.AppendLine(version.ToString());
    2.68 +        s.AppendLine();
    2.69 +        s.AppendLine(exception.ToString());
    2.70 +        s.AppendLine();
    2.71 +        if (exception.InnerException != null) {
    2.72 +          s.AppendLine(exception.InnerException.ToString());
    2.73 +          s.AppendLine();
    2.74 +        }
    2.75 +        reportTextBox.Text = s.ToString();
    2.76 +      }
    2.77 +    }
    2.78 +
    2.79 +    private void sendButton_Click(object sender, EventArgs e) {
    2.80 +      Version version = typeof(CrashReportForm).Assembly.GetName().Version;
    2.81 +      WebRequest request = WebRequest.Create(
    2.82 +        "http://openhardwaremonitor.org/report.php");
    2.83 +      request.Method = "POST";
    2.84 +      request.Timeout = 3000;
    2.85 +      request.ContentType = "application/x-www-form-urlencoded";
    2.86 +
    2.87 +      string report = 
    2.88 +        "version=" + HttpUtility.UrlEncode(version.ToString()) + "&" +
    2.89 +        "report=" + HttpUtility.UrlEncode(reportTextBox.Text + 
    2.90 +        commentTextBox.Text);
    2.91 +      byte[] byteArray = Encoding.UTF8.GetBytes(report);          
    2.92 +      request.ContentLength = byteArray.Length;
    2.93 +    
    2.94 +      Stream dataStream = request.GetRequestStream();
    2.95 +      dataStream.Write(byteArray, 0, byteArray.Length);    
    2.96 +      dataStream.Close();
    2.97 +      try {
    2.98 +        WebResponse response = request.GetResponse();
    2.99 +        dataStream = response.GetResponseStream();
   2.100 +        StreamReader reader = new StreamReader(dataStream);
   2.101 +        string responseFromServer = reader.ReadToEnd();
   2.102 +        reader.Close();
   2.103 +        dataStream.Close();
   2.104 +        response.Close();
   2.105 +      } catch (WebException) {
   2.106 +      }
   2.107 +      Close();      
   2.108 +    }
   2.109 +  }  
   2.110 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/GUI/CrashReportForm.resx	Fri Apr 02 16:05:07 2010 +0000
     3.3 @@ -0,0 +1,120 @@
     3.4 +<?xml version="1.0" encoding="utf-8"?>
     3.5 +<root>
     3.6 +  <!-- 
     3.7 +    Microsoft ResX Schema 
     3.8 +    
     3.9 +    Version 2.0
    3.10 +    
    3.11 +    The primary goals of this format is to allow a simple XML format 
    3.12 +    that is mostly human readable. The generation and parsing of the 
    3.13 +    various data types are done through the TypeConverter classes 
    3.14 +    associated with the data types.
    3.15 +    
    3.16 +    Example:
    3.17 +    
    3.18 +    ... ado.net/XML headers & schema ...
    3.19 +    <resheader name="resmimetype">text/microsoft-resx</resheader>
    3.20 +    <resheader name="version">2.0</resheader>
    3.21 +    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    3.22 +    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    3.23 +    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    3.24 +    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    3.25 +    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
    3.26 +        <value>[base64 mime encoded serialized .NET Framework object]</value>
    3.27 +    </data>
    3.28 +    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
    3.29 +        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
    3.30 +        <comment>This is a comment</comment>
    3.31 +    </data>
    3.32 +                
    3.33 +    There are any number of "resheader" rows that contain simple 
    3.34 +    name/value pairs.
    3.35 +    
    3.36 +    Each data row contains a name, and value. The row also contains a 
    3.37 +    type or mimetype. Type corresponds to a .NET class that support 
    3.38 +    text/value conversion through the TypeConverter architecture. 
    3.39 +    Classes that don't support this are serialized and stored with the 
    3.40 +    mimetype set.
    3.41 +    
    3.42 +    The mimetype is used for serialized objects, and tells the 
    3.43 +    ResXResourceReader how to depersist the object. This is currently not 
    3.44 +    extensible. For a given mimetype the value must be set accordingly:
    3.45 +    
    3.46 +    Note - application/x-microsoft.net.object.binary.base64 is the format 
    3.47 +    that the ResXResourceWriter will generate, however the reader can 
    3.48 +    read any of the formats listed below.
    3.49 +    
    3.50 +    mimetype: application/x-microsoft.net.object.binary.base64
    3.51 +    value   : The object must be serialized with 
    3.52 +            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
    3.53 +            : and then encoded with base64 encoding.
    3.54 +    
    3.55 +    mimetype: application/x-microsoft.net.object.soap.base64
    3.56 +    value   : The object must be serialized with 
    3.57 +            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
    3.58 +            : and then encoded with base64 encoding.
    3.59 +
    3.60 +    mimetype: application/x-microsoft.net.object.bytearray.base64
    3.61 +    value   : The object must be serialized into a byte array 
    3.62 +            : using a System.ComponentModel.TypeConverter
    3.63 +            : and then encoded with base64 encoding.
    3.64 +    -->
    3.65 +  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    3.66 +    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    3.67 +    <xsd:element name="root" msdata:IsDataSet="true">
    3.68 +      <xsd:complexType>
    3.69 +        <xsd:choice maxOccurs="unbounded">
    3.70 +          <xsd:element name="metadata">
    3.71 +            <xsd:complexType>
    3.72 +              <xsd:sequence>
    3.73 +                <xsd:element name="value" type="xsd:string" minOccurs="0" />
    3.74 +              </xsd:sequence>
    3.75 +              <xsd:attribute name="name" use="required" type="xsd:string" />
    3.76 +              <xsd:attribute name="type" type="xsd:string" />
    3.77 +              <xsd:attribute name="mimetype" type="xsd:string" />
    3.78 +              <xsd:attribute ref="xml:space" />
    3.79 +            </xsd:complexType>
    3.80 +          </xsd:element>
    3.81 +          <xsd:element name="assembly">
    3.82 +            <xsd:complexType>
    3.83 +              <xsd:attribute name="alias" type="xsd:string" />
    3.84 +              <xsd:attribute name="name" type="xsd:string" />
    3.85 +            </xsd:complexType>
    3.86 +          </xsd:element>
    3.87 +          <xsd:element name="data">
    3.88 +            <xsd:complexType>
    3.89 +              <xsd:sequence>
    3.90 +                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
    3.91 +                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
    3.92 +              </xsd:sequence>
    3.93 +              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
    3.94 +              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
    3.95 +              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
    3.96 +              <xsd:attribute ref="xml:space" />
    3.97 +            </xsd:complexType>
    3.98 +          </xsd:element>
    3.99 +          <xsd:element name="resheader">
   3.100 +            <xsd:complexType>
   3.101 +              <xsd:sequence>
   3.102 +                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
   3.103 +              </xsd:sequence>
   3.104 +              <xsd:attribute name="name" type="xsd:string" use="required" />
   3.105 +            </xsd:complexType>
   3.106 +          </xsd:element>
   3.107 +        </xsd:choice>
   3.108 +      </xsd:complexType>
   3.109 +    </xsd:element>
   3.110 +  </xsd:schema>
   3.111 +  <resheader name="resmimetype">
   3.112 +    <value>text/microsoft-resx</value>
   3.113 +  </resheader>
   3.114 +  <resheader name="version">
   3.115 +    <value>2.0</value>
   3.116 +  </resheader>
   3.117 +  <resheader name="reader">
   3.118 +    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   3.119 +  </resheader>
   3.120 +  <resheader name="writer">
   3.121 +    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   3.122 +  </resheader>
   3.123 +</root>
   3.124 \ No newline at end of file
     4.1 --- a/GUI/MainForm.Designer.cs	Sat Mar 27 19:55:09 2010 +0000
     4.2 +++ b/GUI/MainForm.Designer.cs	Fri Apr 02 16:05:07 2010 +0000
     4.3 @@ -110,6 +110,7 @@
     4.4        this.exitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
     4.5        this.sensorContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
     4.6        this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
     4.7 +      this.timer = new System.Windows.Forms.Timer(this.components);
     4.8        this.columnsContextMenuStrip.SuspendLayout();
     4.9        this.menuStrip.SuspendLayout();
    4.10        this.splitContainer.Panel1.SuspendLayout();
    4.11 @@ -314,14 +315,14 @@
    4.12        // saveReportToolStripMenuItem
    4.13        // 
    4.14        this.saveReportToolStripMenuItem.Name = "saveReportToolStripMenuItem";
    4.15 -      this.saveReportToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
    4.16 +      this.saveReportToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
    4.17        this.saveReportToolStripMenuItem.Text = "Save Report...";
    4.18        this.saveReportToolStripMenuItem.Click += new System.EventHandler(this.saveReportToolStripMenuItem_Click);
    4.19        // 
    4.20        // exitToolStripMenuItem
    4.21        // 
    4.22        this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
    4.23 -      this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
    4.24 +      this.exitToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
    4.25        this.exitToolStripMenuItem.Text = "Exit";
    4.26        this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
    4.27        // 
    4.28 @@ -558,6 +559,11 @@
    4.29        this.saveFileDialog.RestoreDirectory = true;
    4.30        this.saveFileDialog.Title = "Save Report As";
    4.31        // 
    4.32 +      // timer
    4.33 +      // 
    4.34 +      this.timer.Interval = 1000;
    4.35 +      this.timer.Tick += new System.EventHandler(this.timer_Tick);
    4.36 +      // 
    4.37        // MainForm
    4.38        // 
    4.39        this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
    4.40 @@ -634,6 +640,7 @@
    4.41      private System.Windows.Forms.ToolStripMenuItem flowsMenuItem;
    4.42      private System.Windows.Forms.ToolStripMenuItem startupMenuItem;
    4.43      private System.Windows.Forms.SaveFileDialog saveFileDialog;
    4.44 +    private System.Windows.Forms.Timer timer;
    4.45    }
    4.46  }
    4.47  
     5.1 --- a/GUI/MainForm.cs	Sat Mar 27 19:55:09 2010 +0000
     5.2 +++ b/GUI/MainForm.cs	Fri Apr 02 16:05:07 2010 +0000
     5.3 @@ -113,9 +113,10 @@
     5.4  
     5.5        computer.HardwareAdded += new HardwareEventHandler(HardwareAdded);
     5.6        computer.HardwareRemoved += new HardwareEventHandler(HardwareRemoved);
     5.7 -      computer.Updated += new UpdateEventHandler(Updated);
     5.8        computer.Open();
     5.9  
    5.10 +      timer.Enabled = true;
    5.11 +
    5.12        plotColorPalette = new Color[14];
    5.13        plotColorPalette[0] = Color.Blue;
    5.14        plotColorPalette[1] = Color.OrangeRed;
    5.15 @@ -239,7 +240,8 @@
    5.16        Close();      
    5.17      }
    5.18  
    5.19 -    private void Updated() {          
    5.20 +    private void timer_Tick(object sender, EventArgs e) {
    5.21 +      computer.Update();  
    5.22        treeView.Invalidate();
    5.23        plotPanel.Invalidate();
    5.24        sensorSystemTray.Redraw();
    5.25 @@ -269,7 +271,9 @@
    5.26          Config.Set("mainForm.Width", Width);
    5.27          Config.Set("mainForm.Height", Height);
    5.28        }
    5.29 -           
    5.30 +
    5.31 +      timer.Enabled = false;
    5.32 +
    5.33        sensorSystemTray.Dispose();
    5.34        notifyIcon.Dispose();
    5.35        computer.Close();
     6.1 --- a/GUI/MainForm.resx	Sat Mar 27 19:55:09 2010 +0000
     6.2 +++ b/GUI/MainForm.resx	Fri Apr 02 16:05:07 2010 +0000
     6.3 @@ -132,6 +132,9 @@
     6.4    <metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     6.5      <value>690, 17</value>
     6.6    </metadata>
     6.7 +  <metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     6.8 +    <value>819, 17</value>
     6.9 +  </metadata>
    6.10    <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    6.11      <value>55</value>
    6.12    </metadata>
     7.1 --- a/GUI/ParameterForm.Designer.cs	Sat Mar 27 19:55:09 2010 +0000
     7.2 +++ b/GUI/ParameterForm.Designer.cs	Fri Apr 02 16:05:07 2010 +0000
     7.3 @@ -1,4 +1,41 @@
     7.4 -namespace OpenHardwareMonitor.GUI {
     7.5 +/*
     7.6 +  
     7.7 +  Version: MPL 1.1/GPL 2.0/LGPL 2.1
     7.8 +
     7.9 +  The contents of this file are subject to the Mozilla Public License Version
    7.10 +  1.1 (the "License"); you may not use this file except in compliance with
    7.11 +  the License. You may obtain a copy of the License at
    7.12 + 
    7.13 +  http://www.mozilla.org/MPL/
    7.14 +
    7.15 +  Software distributed under the License is distributed on an "AS IS" basis,
    7.16 +  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    7.17 +  for the specific language governing rights and limitations under the License.
    7.18 +
    7.19 +  The Original Code is the Open Hardware Monitor code.
    7.20 +
    7.21 +  The Initial Developer of the Original Code is 
    7.22 +  Michael Möller <m.moeller@gmx.ch>.
    7.23 +  Portions created by the Initial Developer are Copyright (C) 2009-2010
    7.24 +  the Initial Developer. All Rights Reserved.
    7.25 +
    7.26 +  Contributor(s):
    7.27 +
    7.28 +  Alternatively, the contents of this file may be used under the terms of
    7.29 +  either the GNU General Public License Version 2 or later (the "GPL"), or
    7.30 +  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    7.31 +  in which case the provisions of the GPL or the LGPL are applicable instead
    7.32 +  of those above. If you wish to allow use of your version of this file only
    7.33 +  under the terms of either the GPL or the LGPL, and not to allow others to
    7.34 +  use your version of this file under the terms of the MPL, indicate your
    7.35 +  decision by deleting the provisions above and replace them with the notice
    7.36 +  and other provisions required by the GPL or the LGPL. If you do not delete
    7.37 +  the provisions above, a recipient may use your version of this file under
    7.38 +  the terms of any one of the MPL, the GPL or the LGPL.
    7.39 + 
    7.40 +*/
    7.41 +
    7.42 +namespace OpenHardwareMonitor.GUI {
    7.43    partial class ParameterForm {
    7.44      /// <summary>
    7.45      /// Required designer variable.
    7.46 @@ -160,6 +197,8 @@
    7.47        this.Controls.Add(this.captionLabel);
    7.48        this.Controls.Add(this.cancelButton);
    7.49        this.Controls.Add(this.okButton);
    7.50 +      this.MaximizeBox = false;
    7.51 +      this.MinimizeBox = false;
    7.52        this.Name = "ParameterForm";
    7.53        this.ShowIcon = false;
    7.54        this.ShowInTaskbar = false;
     8.1 --- a/GUI/ParameterForm.cs	Sat Mar 27 19:55:09 2010 +0000
     8.2 +++ b/GUI/ParameterForm.cs	Fri Apr 02 16:05:07 2010 +0000
     8.3 @@ -1,4 +1,41 @@
     8.4 -using System;
     8.5 +/*
     8.6 +  
     8.7 +  Version: MPL 1.1/GPL 2.0/LGPL 2.1
     8.8 +
     8.9 +  The contents of this file are subject to the Mozilla Public License Version
    8.10 +  1.1 (the "License"); you may not use this file except in compliance with
    8.11 +  the License. You may obtain a copy of the License at
    8.12 + 
    8.13 +  http://www.mozilla.org/MPL/
    8.14 +
    8.15 +  Software distributed under the License is distributed on an "AS IS" basis,
    8.16 +  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    8.17 +  for the specific language governing rights and limitations under the License.
    8.18 +
    8.19 +  The Original Code is the Open Hardware Monitor code.
    8.20 +
    8.21 +  The Initial Developer of the Original Code is 
    8.22 +  Michael Möller <m.moeller@gmx.ch>.
    8.23 +  Portions created by the Initial Developer are Copyright (C) 2009-2010
    8.24 +  the Initial Developer. All Rights Reserved.
    8.25 +
    8.26 +  Contributor(s):
    8.27 +
    8.28 +  Alternatively, the contents of this file may be used under the terms of
    8.29 +  either the GNU General Public License Version 2 or later (the "GPL"), or
    8.30 +  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    8.31 +  in which case the provisions of the GPL or the LGPL are applicable instead
    8.32 +  of those above. If you wish to allow use of your version of this file only
    8.33 +  under the terms of either the GPL or the LGPL, and not to allow others to
    8.34 +  use your version of this file under the terms of the MPL, indicate your
    8.35 +  decision by deleting the provisions above and replace them with the notice
    8.36 +  and other provisions required by the GPL or the LGPL. If you do not delete
    8.37 +  the provisions above, a recipient may use your version of this file under
    8.38 +  the terms of any one of the MPL, the GPL or the LGPL.
    8.39 + 
    8.40 +*/
    8.41 +
    8.42 +using System;
    8.43  using System.Collections.Generic;
    8.44  using System.ComponentModel;
    8.45  using System.Text;
     9.1 --- a/GUI/SensorNotifyIcon.cs	Sat Mar 27 19:55:09 2010 +0000
     9.2 +++ b/GUI/SensorNotifyIcon.cs	Fri Apr 02 16:05:07 2010 +0000
     9.3 @@ -191,8 +191,12 @@
     9.4        return IconFactory.Create(bytes, 16, 16, PixelFormat.Format32bppArgb);
     9.5      }
     9.6  
     9.7 -    private Icon CreateLoadIcon() {
     9.8 -      graphics.Clear(Color.Transparent);
     9.9 +    private Icon CreateLoadIcon() {      
    9.10 +      try {
    9.11 +        graphics.Clear(Color.Transparent);
    9.12 +      } catch (ArgumentException) {
    9.13 +        graphics.Clear(Color.Black);
    9.14 +      }
    9.15        graphics.FillRectangle(darkBrush, 0.5f, -0.5f, 14, 16);
    9.16        float y = 0.16f * (100 - sensor.Value.Value);
    9.17        graphics.FillRectangle(brush, 0.5f, -0.5f + y, 14, 16 - y);
    10.1 --- a/Hardware/CPU/IntelCPU.cs	Sat Mar 27 19:55:09 2010 +0000
    10.2 +++ b/Hardware/CPU/IntelCPU.cs	Fri Apr 02 16:05:07 2010 +0000
    10.3 @@ -356,8 +356,7 @@
    10.4          (timeEnd - timeBegin);
    10.5      }
    10.6  
    10.7 -    public void Update() {
    10.8 -
    10.9 +    public void Update() {      
   10.10        for (int i = 0; i < coreTemperatures.Length; i++) {
   10.11          uint eax, edx;
   10.12          if (WinRing0.RdmsrTx(
    11.1 --- a/Hardware/Computer.cs	Sat Mar 27 19:55:09 2010 +0000
    11.2 +++ b/Hardware/Computer.cs	Fri Apr 02 16:05:07 2010 +0000
    11.3 @@ -46,8 +46,6 @@
    11.4  
    11.5    public class Computer : IComputer {
    11.6  
    11.7 -    private Timer timer;
    11.8 -
    11.9      private List<IGroup> groups = new List<IGroup>();
   11.10  
   11.11      private bool open = false;
   11.12 @@ -91,19 +89,6 @@
   11.13          Add(new HDD.HDDGroup());
   11.14  
   11.15        open = true;
   11.16 -
   11.17 -      timer = new Timer(
   11.18 -        delegate(Object stateInfo) {
   11.19 -          #if !DEBUG
   11.20 -          try {
   11.21 -          #endif
   11.22 -            Update();
   11.23 -          #if !DEBUG
   11.24 -          } catch (Exception exception) {
   11.25 -            Utilities.CrashReport.Save(exception);
   11.26 -          }
   11.27 -          #endif
   11.28 -        }, null, 1000, 1000);
   11.29      }
   11.30  
   11.31      private void SubHardwareUpdate(IHardware hardware) {
   11.32 @@ -113,14 +98,12 @@
   11.33        }
   11.34      }
   11.35  
   11.36 -    private void Update() {
   11.37 +    public void Update() {
   11.38        foreach (IGroup group in groups)
   11.39          foreach (IHardware hardware in group.Hardware) {
   11.40            hardware.Update();
   11.41            SubHardwareUpdate(hardware);
   11.42          }
   11.43 -      if (Updated != null)
   11.44 -        Updated();
   11.45      }
   11.46  
   11.47      public bool HDDEnabled {
   11.48 @@ -226,9 +209,6 @@
   11.49      }
   11.50  
   11.51      public void Close() {      
   11.52 -      timer.Dispose();
   11.53 -      timer = null;
   11.54 -
   11.55        if (!open)
   11.56          return;
   11.57  
   11.58 @@ -239,9 +219,7 @@
   11.59        open = false;
   11.60      }
   11.61  
   11.62 -    public event UpdateEventHandler Updated;
   11.63      public event HardwareEventHandler HardwareAdded;
   11.64      public event HardwareEventHandler HardwareRemoved;
   11.65 -
   11.66    }
   11.67  }
    12.1 --- a/Hardware/IComputer.cs	Sat Mar 27 19:55:09 2010 +0000
    12.2 +++ b/Hardware/IComputer.cs	Fri Apr 02 16:05:07 2010 +0000
    12.3 @@ -40,7 +40,6 @@
    12.4  
    12.5  namespace OpenHardwareMonitor.Hardware {
    12.6  
    12.7 -  public delegate void UpdateEventHandler();
    12.8    public delegate void HardwareEventHandler(IHardware hardware);
    12.9  
   12.10    public interface IComputer {
   12.11 @@ -51,7 +50,6 @@
   12.12  
   12.13      string GetReport();
   12.14  
   12.15 -    event UpdateEventHandler Updated;
   12.16      event HardwareEventHandler HardwareAdded;
   12.17      event HardwareEventHandler HardwareRemoved;
   12.18    }
    13.1 --- a/Hardware/TBalancer/TBalancer.cs	Sat Mar 27 19:55:09 2010 +0000
    13.2 +++ b/Hardware/TBalancer/TBalancer.cs	Fri Apr 02 16:05:07 2010 +0000
    13.3 @@ -221,7 +221,7 @@
    13.4            } else {
    13.5              DeactivateSensor(sensorhubFlows[i]);
    13.6            }
    13.7 -
    13.8 +        
    13.9          for (int i = 0; i < fans.Length; i++) {
   13.10            float maxRPM = 11.5f * ((data[149 + 2 * i] << 8) | data[148 + 2 * i]);
   13.11  
   13.12 @@ -325,7 +325,7 @@
   13.13        } catch (Exception) { }
   13.14      }
   13.15  
   13.16 -    public void Update() {
   13.17 +    public void Update() {      
   13.18        try {
   13.19          while (serialPort.IsOpen && serialPort.BytesToRead >= 285)
   13.20            ReadData();
   13.21 @@ -337,7 +337,7 @@
   13.22        } catch (InvalidOperationException) {
   13.23          foreach (Sensor sensor in active)
   13.24            sensor.Value = null;
   13.25 -      }
   13.26 +      }      
   13.27      }
   13.28  
   13.29      public void Close() {
    14.1 --- a/OpenHardwareMonitor.csproj	Sat Mar 27 19:55:09 2010 +0000
    14.2 +++ b/OpenHardwareMonitor.csproj	Fri Apr 02 16:05:07 2010 +0000
    14.3 @@ -54,10 +54,17 @@
    14.4      <Reference Include="System.Data" />
    14.5      <Reference Include="System.Drawing" />
    14.6      <Reference Include="System.Management" />
    14.7 +    <Reference Include="System.Web" />
    14.8      <Reference Include="System.Windows.Forms" />
    14.9      <Reference Include="System.Xml" />
   14.10    </ItemGroup>
   14.11    <ItemGroup>
   14.12 +    <Compile Include="GUI\CrashReportForm.cs">
   14.13 +      <SubType>Form</SubType>
   14.14 +    </Compile>
   14.15 +    <Compile Include="GUI\CrashReportForm.Designer.cs">
   14.16 +      <DependentUpon>CrashReportForm.cs</DependentUpon>
   14.17 +    </Compile>
   14.18      <Compile Include="GUI\ParameterForm.cs">
   14.19        <SubType>Form</SubType>
   14.20      </Compile>
   14.21 @@ -99,7 +106,6 @@
   14.22      <Compile Include="Hardware\ATI\ATIGroup.cs" />
   14.23      <Compile Include="Hardware\ATI\ATIGPU.cs" />
   14.24      <Compile Include="Utilities\Config.cs" />
   14.25 -    <Compile Include="Utilities\CrashReport.cs" />
   14.26      <Compile Include="Utilities\EmbeddedResources.cs" />
   14.27      <Compile Include="GUI\HardwareNode.cs" />
   14.28      <Compile Include="Hardware\IGroup.cs" />
   14.29 @@ -179,6 +185,9 @@
   14.30      <EmbeddedResource Include="Resources\flow.png" />
   14.31    </ItemGroup>
   14.32    <ItemGroup>
   14.33 +    <EmbeddedResource Include="GUI\CrashReportForm.resx">
   14.34 +      <DependentUpon>CrashReportForm.cs</DependentUpon>
   14.35 +    </EmbeddedResource>
   14.36      <EmbeddedResource Include="Resources\mainboard.png" />
   14.37    </ItemGroup>
   14.38    <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
    15.1 --- a/Program.cs	Sat Mar 27 19:55:09 2010 +0000
    15.2 +++ b/Program.cs	Fri Apr 02 16:05:07 2010 +0000
    15.3 @@ -36,36 +36,39 @@
    15.4  */
    15.5  
    15.6  using System;
    15.7 +using System.IO;
    15.8 +using System.Text;
    15.9 +using System.Threading;
   15.10  using System.Windows.Forms;
   15.11 -
   15.12 +using OpenHardwareMonitor.GUI;
   15.13  
   15.14  namespace OpenHardwareMonitor {
   15.15 -  static class Program {
   15.16 -    /// <summary>
   15.17 -    /// The main entry point for the application.
   15.18 -    /// </summary>
   15.19 +  public static class Program {
   15.20 +
   15.21      [STAThread]
   15.22 -    static void Main() {
   15.23 +    public static void Main() {
   15.24        #if !DEBUG
   15.25 -      try {
   15.26 +        AppDomain.CurrentDomain.UnhandledException += 
   15.27 +          new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
   15.28        #endif
   15.29 -        Application.EnableVisualStyles();
   15.30 -        Application.SetCompatibleTextRenderingDefault(false);
   15.31  
   15.32 -        using (GUI.MainForm form = new GUI.MainForm()) {
   15.33 -          form.FormClosed += delegate(Object sender, FormClosedEventArgs e) {
   15.34 -            Application.Exit();
   15.35 -          };
   15.36 -          Application.Run();
   15.37 -        }
   15.38 -        
   15.39 -      #if !DEBUG
   15.40 -      } catch (Exception e) {
   15.41 -        Utilities.CrashReport.Save(e);
   15.42 +      Application.EnableVisualStyles();
   15.43 +      Application.SetCompatibleTextRenderingDefault(false);
   15.44 +      using (GUI.MainForm form = new GUI.MainForm()) {
   15.45 +        form.FormClosed += delegate(Object sender, FormClosedEventArgs e) {
   15.46 +          Application.Exit();
   15.47 +        };        
   15.48 +        Application.Run();
   15.49        }
   15.50 -      #endif
   15.51      }
   15.52  
   15.53 -    
   15.54 +    public static void CurrentDomain_UnhandledException(object sender, 
   15.55 +      UnhandledExceptionEventArgs args) 
   15.56 +    {
   15.57 +      CrashReportForm form = new CrashReportForm();
   15.58 +      form.Exception = (Exception)args.ExceptionObject;
   15.59 +      form.ShowDialog();
   15.60 +      Environment.Exit(0);
   15.61 +    }   
   15.62    }
   15.63  }
    16.1 --- a/Utilities/CrashReport.cs	Sat Mar 27 19:55:09 2010 +0000
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,58 +0,0 @@
    16.4 -/*
    16.5 -  
    16.6 -  Version: MPL 1.1/GPL 2.0/LGPL 2.1
    16.7 -
    16.8 -  The contents of this file are subject to the Mozilla Public License Version
    16.9 -  1.1 (the "License"); you may not use this file except in compliance with
   16.10 -  the License. You may obtain a copy of the License at
   16.11 - 
   16.12 -  http://www.mozilla.org/MPL/
   16.13 -
   16.14 -  Software distributed under the License is distributed on an "AS IS" basis,
   16.15 -  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
   16.16 -  for the specific language governing rights and limitations under the License.
   16.17 -
   16.18 -  The Original Code is the Open Hardware Monitor code.
   16.19 -
   16.20 -  The Initial Developer of the Original Code is 
   16.21 -  Michael Möller <m.moeller@gmx.ch>.
   16.22 -  Portions created by the Initial Developer are Copyright (C) 2009-2010
   16.23 -  the Initial Developer. All Rights Reserved.
   16.24 -
   16.25 -  Contributor(s):
   16.26 -
   16.27 -  Alternatively, the contents of this file may be used under the terms of
   16.28 -  either the GNU General Public License Version 2 or later (the "GPL"), or
   16.29 -  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
   16.30 -  in which case the provisions of the GPL or the LGPL are applicable instead
   16.31 -  of those above. If you wish to allow use of your version of this file only
   16.32 -  under the terms of either the GPL or the LGPL, and not to allow others to
   16.33 -  use your version of this file under the terms of the MPL, indicate your
   16.34 -  decision by deleting the provisions above and replace them with the notice
   16.35 -  and other provisions required by the GPL or the LGPL. If you do not delete
   16.36 -  the provisions above, a recipient may use your version of this file under
   16.37 -  the terms of any one of the MPL, the GPL or the LGPL.
   16.38 - 
   16.39 -*/
   16.40 -
   16.41 -using System;
   16.42 -using System.Collections.Generic;
   16.43 -using System.IO;
   16.44 -using System.Text;
   16.45 -
   16.46 -namespace OpenHardwareMonitor.Utilities {
   16.47 -  public class CrashReport {
   16.48 -
   16.49 -    public static void Save(Exception e) {
   16.50 -       using (TextWriter w =
   16.51 -          new StreamWriter("OpenHardwareMonitor.Crash.txt")) {
   16.52 -          w.WriteLine(e.ToString());
   16.53 -          w.WriteLine();
   16.54 -          if (e.InnerException != null) {
   16.55 -            w.WriteLine(e.InnerException.ToString());
   16.56 -            w.WriteLine();          
   16.57 -          }
   16.58 -        }
   16.59 -    }
   16.60 -  }
   16.61 -}