mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-08-31 22:35:11 +00:00
Fixed Issue 26. Added a dialog to automatically send a crash report.
This commit is contained in:
249
GUI/CrashReportForm.Designer.cs
generated
Normal file
249
GUI/CrashReportForm.Designer.cs
generated
Normal file
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
|
||||
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 <m.moeller@gmx.ch>.
|
||||
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 {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) {
|
||||
if (disposing && (components != null)) {
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
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.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(467, 412);
|
||||
this.sendButton.Name = "sendButton";
|
||||
this.sendButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.sendButton.TabIndex = 1;
|
||||
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(548, 412);
|
||||
this.exitButton.Name = "exitButton";
|
||||
this.exitButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.exitButton.TabIndex = 2;
|
||||
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(604, 77);
|
||||
this.commentTextBox.TabIndex = 0;
|
||||
//
|
||||
// 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(637, 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, 290);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(3, 12, 3, 8);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(233, 13);
|
||||
this.label1.TabIndex = 6;
|
||||
this.label1.Text = "You can add additional information to the report.";
|
||||
//
|
||||
// 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, 314);
|
||||
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(611, 87);
|
||||
this.commentPanel.TabIndex = 7;
|
||||
//
|
||||
// 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(611, 188);
|
||||
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(604, 178);
|
||||
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(604, 178);
|
||||
this.textBox1.TabIndex = 2;
|
||||
//
|
||||
// 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(635, 447);
|
||||
this.ControlBox = false;
|
||||
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;
|
||||
}
|
||||
}
|
107
GUI/CrashReportForm.cs
Normal file
107
GUI/CrashReportForm.cs
Normal file
@@ -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 <m.moeller@gmx.ch>.
|
||||
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.Data;
|
||||
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();
|
||||
}
|
||||
reportTextBox.Text = s.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private void sendButton_Click(object sender, EventArgs e) {
|
||||
Version version = typeof(CrashReportForm).Assembly.GetName().Version;
|
||||
WebRequest request = WebRequest.Create(
|
||||
"http://openhardwaremonitor.org/report.php");
|
||||
request.Method = "POST";
|
||||
request.Timeout = 3000;
|
||||
request.ContentType = "application/x-www-form-urlencoded";
|
||||
|
||||
string report =
|
||||
"version=" + HttpUtility.UrlEncode(version.ToString()) + "&" +
|
||||
"report=" + HttpUtility.UrlEncode(reportTextBox.Text +
|
||||
commentTextBox.Text);
|
||||
byte[] byteArray = Encoding.UTF8.GetBytes(report);
|
||||
request.ContentLength = byteArray.Length;
|
||||
|
||||
Stream dataStream = request.GetRequestStream();
|
||||
dataStream.Write(byteArray, 0, byteArray.Length);
|
||||
dataStream.Close();
|
||||
try {
|
||||
WebResponse response = request.GetResponse();
|
||||
dataStream = response.GetResponseStream();
|
||||
StreamReader reader = new StreamReader(dataStream);
|
||||
string responseFromServer = reader.ReadToEnd();
|
||||
reader.Close();
|
||||
dataStream.Close();
|
||||
response.Close();
|
||||
} catch (WebException) {
|
||||
}
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
120
GUI/CrashReportForm.resx
Normal file
120
GUI/CrashReportForm.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
11
GUI/MainForm.Designer.cs
generated
11
GUI/MainForm.Designer.cs
generated
@@ -110,6 +110,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
this.exitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
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.columnsContextMenuStrip.SuspendLayout();
|
||||
this.menuStrip.SuspendLayout();
|
||||
this.splitContainer.Panel1.SuspendLayout();
|
||||
@@ -314,14 +315,14 @@ namespace OpenHardwareMonitor.GUI {
|
||||
// saveReportToolStripMenuItem
|
||||
//
|
||||
this.saveReportToolStripMenuItem.Name = "saveReportToolStripMenuItem";
|
||||
this.saveReportToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.saveReportToolStripMenuItem.Size = new System.Drawing.Size(145, 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(152, 22);
|
||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
|
||||
this.exitToolStripMenuItem.Text = "Exit";
|
||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||
//
|
||||
@@ -558,6 +559,11 @@ namespace OpenHardwareMonitor.GUI {
|
||||
this.saveFileDialog.RestoreDirectory = true;
|
||||
this.saveFileDialog.Title = "Save Report As";
|
||||
//
|
||||
// timer
|
||||
//
|
||||
this.timer.Interval = 1000;
|
||||
this.timer.Tick += new System.EventHandler(this.timer_Tick);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
@@ -634,6 +640,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
private System.Windows.Forms.ToolStripMenuItem flowsMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem startupMenuItem;
|
||||
private System.Windows.Forms.SaveFileDialog saveFileDialog;
|
||||
private System.Windows.Forms.Timer timer;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -113,9 +113,10 @@ namespace OpenHardwareMonitor.GUI {
|
||||
|
||||
computer.HardwareAdded += new HardwareEventHandler(HardwareAdded);
|
||||
computer.HardwareRemoved += new HardwareEventHandler(HardwareRemoved);
|
||||
computer.Updated += new UpdateEventHandler(Updated);
|
||||
computer.Open();
|
||||
|
||||
timer.Enabled = true;
|
||||
|
||||
plotColorPalette = new Color[14];
|
||||
plotColorPalette[0] = Color.Blue;
|
||||
plotColorPalette[1] = Color.OrangeRed;
|
||||
@@ -239,7 +240,8 @@ namespace OpenHardwareMonitor.GUI {
|
||||
Close();
|
||||
}
|
||||
|
||||
private void Updated() {
|
||||
private void timer_Tick(object sender, EventArgs e) {
|
||||
computer.Update();
|
||||
treeView.Invalidate();
|
||||
plotPanel.Invalidate();
|
||||
sensorSystemTray.Redraw();
|
||||
@@ -270,6 +272,8 @@ namespace OpenHardwareMonitor.GUI {
|
||||
Config.Set("mainForm.Height", Height);
|
||||
}
|
||||
|
||||
timer.Enabled = false;
|
||||
|
||||
sensorSystemTray.Dispose();
|
||||
notifyIcon.Dispose();
|
||||
computer.Close();
|
||||
|
@@ -132,6 +132,9 @@
|
||||
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>690, 17</value>
|
||||
</metadata>
|
||||
<metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>819, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>55</value>
|
||||
</metadata>
|
||||
|
41
GUI/ParameterForm.Designer.cs
generated
41
GUI/ParameterForm.Designer.cs
generated
@@ -1,4 +1,41 @@
|
||||
namespace OpenHardwareMonitor.GUI {
|
||||
/*
|
||||
|
||||
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 <m.moeller@gmx.ch>.
|
||||
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 ParameterForm {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@@ -160,6 +197,8 @@
|
||||
this.Controls.Add(this.captionLabel);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "ParameterForm";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
|
@@ -1,4 +1,41 @@
|
||||
using System;
|
||||
/*
|
||||
|
||||
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 <m.moeller@gmx.ch>.
|
||||
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.Text;
|
||||
|
@@ -192,7 +192,11 @@ namespace OpenHardwareMonitor.GUI {
|
||||
}
|
||||
|
||||
private Icon CreateLoadIcon() {
|
||||
try {
|
||||
graphics.Clear(Color.Transparent);
|
||||
} catch (ArgumentException) {
|
||||
graphics.Clear(Color.Black);
|
||||
}
|
||||
graphics.FillRectangle(darkBrush, 0.5f, -0.5f, 14, 16);
|
||||
float y = 0.16f * (100 - sensor.Value.Value);
|
||||
graphics.FillRectangle(brush, 0.5f, -0.5f + y, 14, 16 - y);
|
||||
|
@@ -357,7 +357,6 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
}
|
||||
|
||||
public void Update() {
|
||||
|
||||
for (int i = 0; i < coreTemperatures.Length; i++) {
|
||||
uint eax, edx;
|
||||
if (WinRing0.RdmsrTx(
|
||||
|
@@ -46,8 +46,6 @@ namespace OpenHardwareMonitor.Hardware {
|
||||
|
||||
public class Computer : IComputer {
|
||||
|
||||
private Timer timer;
|
||||
|
||||
private List<IGroup> groups = new List<IGroup>();
|
||||
|
||||
private bool open = false;
|
||||
@@ -91,19 +89,6 @@ namespace OpenHardwareMonitor.Hardware {
|
||||
Add(new HDD.HDDGroup());
|
||||
|
||||
open = true;
|
||||
|
||||
timer = new Timer(
|
||||
delegate(Object stateInfo) {
|
||||
#if !DEBUG
|
||||
try {
|
||||
#endif
|
||||
Update();
|
||||
#if !DEBUG
|
||||
} catch (Exception exception) {
|
||||
Utilities.CrashReport.Save(exception);
|
||||
}
|
||||
#endif
|
||||
}, null, 1000, 1000);
|
||||
}
|
||||
|
||||
private void SubHardwareUpdate(IHardware hardware) {
|
||||
@@ -113,14 +98,12 @@ namespace OpenHardwareMonitor.Hardware {
|
||||
}
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
public void Update() {
|
||||
foreach (IGroup group in groups)
|
||||
foreach (IHardware hardware in group.Hardware) {
|
||||
hardware.Update();
|
||||
SubHardwareUpdate(hardware);
|
||||
}
|
||||
if (Updated != null)
|
||||
Updated();
|
||||
}
|
||||
|
||||
public bool HDDEnabled {
|
||||
@@ -226,9 +209,6 @@ namespace OpenHardwareMonitor.Hardware {
|
||||
}
|
||||
|
||||
public void Close() {
|
||||
timer.Dispose();
|
||||
timer = null;
|
||||
|
||||
if (!open)
|
||||
return;
|
||||
|
||||
@@ -239,9 +219,7 @@ namespace OpenHardwareMonitor.Hardware {
|
||||
open = false;
|
||||
}
|
||||
|
||||
public event UpdateEventHandler Updated;
|
||||
public event HardwareEventHandler HardwareAdded;
|
||||
public event HardwareEventHandler HardwareRemoved;
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -40,7 +40,6 @@ using System.Collections.Generic;
|
||||
|
||||
namespace OpenHardwareMonitor.Hardware {
|
||||
|
||||
public delegate void UpdateEventHandler();
|
||||
public delegate void HardwareEventHandler(IHardware hardware);
|
||||
|
||||
public interface IComputer {
|
||||
@@ -51,7 +50,6 @@ namespace OpenHardwareMonitor.Hardware {
|
||||
|
||||
string GetReport();
|
||||
|
||||
event UpdateEventHandler Updated;
|
||||
event HardwareEventHandler HardwareAdded;
|
||||
event HardwareEventHandler HardwareRemoved;
|
||||
}
|
||||
|
@@ -54,10 +54,17 @@
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="GUI\CrashReportForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GUI\CrashReportForm.Designer.cs">
|
||||
<DependentUpon>CrashReportForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GUI\ParameterForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -99,7 +106,6 @@
|
||||
<Compile Include="Hardware\ATI\ATIGroup.cs" />
|
||||
<Compile Include="Hardware\ATI\ATIGPU.cs" />
|
||||
<Compile Include="Utilities\Config.cs" />
|
||||
<Compile Include="Utilities\CrashReport.cs" />
|
||||
<Compile Include="Utilities\EmbeddedResources.cs" />
|
||||
<Compile Include="GUI\HardwareNode.cs" />
|
||||
<Compile Include="Hardware\IGroup.cs" />
|
||||
@@ -179,6 +185,9 @@
|
||||
<EmbeddedResource Include="Resources\flow.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="GUI\CrashReportForm.resx">
|
||||
<DependentUpon>CrashReportForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Resources\mainboard.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
|
33
Program.cs
33
Program.cs
@@ -36,36 +36,39 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using OpenHardwareMonitor.GUI;
|
||||
|
||||
namespace OpenHardwareMonitor {
|
||||
static class Program {
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
public static class Program {
|
||||
|
||||
[STAThread]
|
||||
static void Main() {
|
||||
public static void Main() {
|
||||
#if !DEBUG
|
||||
try {
|
||||
AppDomain.CurrentDomain.UnhandledException +=
|
||||
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
|
||||
#endif
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
|
||||
using (GUI.MainForm form = new GUI.MainForm()) {
|
||||
form.FormClosed += delegate(Object sender, FormClosedEventArgs e) {
|
||||
Application.Exit();
|
||||
};
|
||||
Application.Run();
|
||||
}
|
||||
|
||||
#if !DEBUG
|
||||
} catch (Exception e) {
|
||||
Utilities.CrashReport.Save(e);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
public static void CurrentDomain_UnhandledException(object sender,
|
||||
UnhandledExceptionEventArgs args)
|
||||
{
|
||||
CrashReportForm form = new CrashReportForm();
|
||||
form.Exception = (Exception)args.ExceptionObject;
|
||||
form.ShowDialog();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,58 +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 <m.moeller@gmx.ch>.
|
||||
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.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenHardwareMonitor.Utilities {
|
||||
public class CrashReport {
|
||||
|
||||
public static void Save(Exception e) {
|
||||
using (TextWriter w =
|
||||
new StreamWriter("OpenHardwareMonitor.Crash.txt")) {
|
||||
w.WriteLine(e.ToString());
|
||||
w.WriteLine();
|
||||
if (e.InnerException != null) {
|
||||
w.WriteLine(e.InnerException.ToString());
|
||||
w.WriteLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user