Added a check if all required files are available at startup. Improved the crash reporting.
This commit is contained in:
Generated
+48
-18
@@ -70,6 +70,8 @@ namespace OpenHardwareMonitor.GUI {
|
||||
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();
|
||||
@@ -77,10 +79,10 @@ namespace OpenHardwareMonitor.GUI {
|
||||
// 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.Location = new System.Drawing.Point(449, 469);
|
||||
this.sendButton.Name = "sendButton";
|
||||
this.sendButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.sendButton.TabIndex = 1;
|
||||
this.sendButton.TabIndex = 2;
|
||||
this.sendButton.Text = "Send";
|
||||
this.sendButton.UseVisualStyleBackColor = true;
|
||||
this.sendButton.Click += new System.EventHandler(this.sendButton_Click);
|
||||
@@ -89,10 +91,10 @@ namespace OpenHardwareMonitor.GUI {
|
||||
//
|
||||
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.Location = new System.Drawing.Point(530, 469);
|
||||
this.exitButton.Name = "exitButton";
|
||||
this.exitButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.exitButton.TabIndex = 2;
|
||||
this.exitButton.TabIndex = 3;
|
||||
this.exitButton.Text = "Exit";
|
||||
this.exitButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
@@ -105,8 +107,8 @@ namespace OpenHardwareMonitor.GUI {
|
||||
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;
|
||||
this.commentTextBox.Size = new System.Drawing.Size(586, 77);
|
||||
this.commentTextBox.TabIndex = 1;
|
||||
//
|
||||
// titleLabel
|
||||
//
|
||||
@@ -118,7 +120,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
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.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.";
|
||||
@@ -135,7 +137,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
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.";
|
||||
"report has been created automatically:";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
@@ -143,12 +145,12 @@ namespace OpenHardwareMonitor.GUI {
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label1.AutoEllipsis = true;
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(9, 290);
|
||||
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(233, 13);
|
||||
this.label1.Size = new System.Drawing.Size(279, 13);
|
||||
this.label1.TabIndex = 6;
|
||||
this.label1.Text = "You can add additional information to the report.";
|
||||
this.label1.Text = "You can add additional information to the report (optional):";
|
||||
//
|
||||
// commentPanel
|
||||
//
|
||||
@@ -157,12 +159,13 @@ namespace OpenHardwareMonitor.GUI {
|
||||
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.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(611, 87);
|
||||
this.commentPanel.TabIndex = 7;
|
||||
this.commentPanel.Size = new System.Drawing.Size(593, 87);
|
||||
this.commentPanel.TabIndex = 1;
|
||||
this.commentPanel.TabStop = true;
|
||||
//
|
||||
// reportPanel
|
||||
//
|
||||
@@ -176,7 +179,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
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.Size = new System.Drawing.Size(593, 212);
|
||||
this.reportPanel.TabIndex = 8;
|
||||
//
|
||||
// reportTextBox
|
||||
@@ -189,7 +192,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
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.Size = new System.Drawing.Size(586, 202);
|
||||
this.reportTextBox.TabIndex = 9;
|
||||
this.reportTextBox.TabStop = false;
|
||||
//
|
||||
@@ -200,17 +203,42 @@ namespace OpenHardwareMonitor.GUI {
|
||||
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.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(635, 447);
|
||||
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);
|
||||
@@ -245,5 +273,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
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;
|
||||
}
|
||||
}
|
||||
+11
-4
@@ -61,7 +61,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
exception = value;
|
||||
StringBuilder s = new StringBuilder();
|
||||
Version version = typeof(CrashReportForm).Assembly.GetName().Version;
|
||||
s.Append("Version: "); s.AppendLine(version.ToString());
|
||||
s.Append("Version: "); s.AppendLine(version.ToString());
|
||||
s.AppendLine();
|
||||
s.AppendLine(exception.ToString());
|
||||
s.AppendLine();
|
||||
@@ -69,7 +69,13 @@ namespace OpenHardwareMonitor.GUI {
|
||||
s.AppendLine(exception.InnerException.ToString());
|
||||
s.AppendLine();
|
||||
}
|
||||
reportTextBox.Text = s.ToString();
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,8 +90,9 @@ namespace OpenHardwareMonitor.GUI {
|
||||
|
||||
string report =
|
||||
"version=" + HttpUtility.UrlEncode(version.ToString()) + "&" +
|
||||
"report=" + HttpUtility.UrlEncode(reportTextBox.Text +
|
||||
commentTextBox.Text);
|
||||
"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;
|
||||
|
||||
|
||||
+34
@@ -57,6 +57,9 @@ namespace OpenHardwareMonitor {
|
||||
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
|
||||
#endif
|
||||
|
||||
if (!AllRequiredFilesAvailable())
|
||||
Environment.Exit(0);
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
using (GUI.MainForm form = new GUI.MainForm()) {
|
||||
@@ -67,6 +70,37 @@ namespace OpenHardwareMonitor {
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsFileAvailable(string fileName) {
|
||||
string path = Path.GetDirectoryName(Application.ExecutablePath) +
|
||||
Path.DirectorySeparatorChar;
|
||||
|
||||
if (!File.Exists(path + fileName)) {
|
||||
MessageBox.Show("The following file could not be found: " + fileName +
|
||||
"\nPlease extract all files from the zip archive.", "Error",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool AllRequiredFilesAvailable() {
|
||||
if (!IsFileAvailable("Aga.Controls.dll"))
|
||||
return false;
|
||||
|
||||
if (IntPtr.Size == 4) {
|
||||
if (!IsFileAvailable("WinRing0.dll"))
|
||||
return false;
|
||||
if (!IsFileAvailable("WinRing0.sys"))
|
||||
return false;
|
||||
} else {
|
||||
if (!IsFileAvailable("WinRing0x64.dll"))
|
||||
return false;
|
||||
if (!IsFileAvailable("WinRing0x64.sys"))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void ReportException(Exception e) {
|
||||
CrashReportForm form = new CrashReportForm();
|
||||
form.Exception = e;
|
||||
|
||||
Reference in New Issue
Block a user