Added the remote web enhancement developed by Prince Samuel.
3 This Source Code Form is subject to the terms of the Mozilla Public
4 License, v. 2.0. If a copy of the MPL was not distributed with this
5 file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 Copyright (C) 2009-2010 Michael Möller <mmoeller@openhardwaremonitor.org>
16 using System.Windows.Forms;
18 namespace OpenHardwareMonitor.GUI {
19 public partial class ReportForm : Form {
21 private string report;
24 InitializeComponent();
26 titleLabel.Font = new Font(SystemFonts.DefaultFont, FontStyle.Bold);
27 reportTextBox.Font = new Font(FontFamily.GenericMonospace,
28 SystemFonts.DefaultFont.Size);
32 public string Report {
33 get { return report; }
36 reportTextBox.Text = report;
40 private void sendButton_Click(object sender, EventArgs e) {
41 Version version = typeof(CrashForm).Assembly.GetName().Version;
42 WebRequest request = WebRequest.Create(
43 "http://openhardwaremonitor.org/report.php");
44 request.Method = "POST";
45 request.Timeout = 5000;
46 request.ContentType = "application/x-www-form-urlencoded";
50 "version=" + Uri.EscapeDataString(version.ToString()) + "&" +
51 "report=" + Uri.EscapeDataString(reportTextBox.Text) + "&" +
52 "comment=" + Uri.EscapeDataString(commentTextBox.Text) + "&" +
53 "email=" + Uri.EscapeDataString(emailTextBox.Text);
54 byte[] byteArray = Encoding.UTF8.GetBytes(report);
55 request.ContentLength = byteArray.Length;
58 Stream dataStream = request.GetRequestStream();
59 dataStream.Write(byteArray, 0, byteArray.Length);
62 WebResponse response = request.GetResponse();
63 dataStream = response.GetResponseStream();
64 StreamReader reader = new StreamReader(dataStream);
65 string responseFromServer = reader.ReadToEnd();
71 } catch (WebException) {
72 MessageBox.Show("Sending the hardware report failed.", "Error",
73 MessageBoxButtons.OK, MessageBoxIcon.Error);