From f078c78c222fb5db0ae8c431e14cf69986ae800b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=B6ller?= Date: Sat, 2 Oct 2010 18:15:46 +0000 Subject: [PATCH] Replaced HttpUtility.UrlEncode with Uri.EscapeDataString and deleted the reference to the System.Web assembly. The System.Web assembly seems to be missing on some .NET 4.0 installations (and the overhead of using it is a bit large, just for the UrlEncode method). --- GUI/CrashForm.cs | 14 +++++--------- GUI/ReportForm.cs | 13 +++++-------- OpenHardwareMonitor.csproj | 1 - 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/GUI/CrashForm.cs b/GUI/CrashForm.cs index 8d7e011..dd91e56 100644 --- a/GUI/CrashForm.cs +++ b/GUI/CrashForm.cs @@ -36,13 +36,9 @@ */ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; using System.IO; using System.Net; using System.Text; -using System.Web; using System.Windows.Forms; namespace OpenHardwareMonitor.GUI { @@ -88,11 +84,11 @@ namespace OpenHardwareMonitor.GUI { request.ContentType = "application/x-www-form-urlencoded"; string report = - "type=crash&" + - "version=" + HttpUtility.UrlEncode(version.ToString()) + "&" + - "report=" + HttpUtility.UrlEncode(reportTextBox.Text) + "&" + - "comment=" + HttpUtility.UrlEncode(commentTextBox.Text) + "&" + - "email=" + HttpUtility.UrlEncode(emailTextBox.Text); + "type=crash&" + + "version=" + Uri.EscapeDataString(version.ToString()) + "&" + + "report=" + Uri.EscapeDataString(reportTextBox.Text) + "&" + + "comment=" + Uri.EscapeDataString(commentTextBox.Text) + "&" + + "email=" + Uri.EscapeDataString(emailTextBox.Text); byte[] byteArray = Encoding.UTF8.GetBytes(report); request.ContentLength = byteArray.Length; diff --git a/GUI/ReportForm.cs b/GUI/ReportForm.cs index fd3a7b1..5d33d79 100644 --- a/GUI/ReportForm.cs +++ b/GUI/ReportForm.cs @@ -36,13 +36,10 @@ */ using System; -using System.Collections.Generic; -using System.ComponentModel; using System.Drawing; using System.IO; using System.Net; using System.Text; -using System.Web; using System.Windows.Forms; namespace OpenHardwareMonitor.GUI { @@ -76,11 +73,11 @@ namespace OpenHardwareMonitor.GUI { request.ContentType = "application/x-www-form-urlencoded"; string report = - "type=hardware&" + - "version=" + HttpUtility.UrlEncode(version.ToString()) + "&" + - "report=" + HttpUtility.UrlEncode(reportTextBox.Text) + "&" + - "comment=" + HttpUtility.UrlEncode(commentTextBox.Text) + "&" + - "email=" + HttpUtility.UrlEncode(emailTextBox.Text); + "type=hardware&" + + "version=" + Uri.EscapeDataString(version.ToString()) + "&" + + "report=" + Uri.EscapeDataString(reportTextBox.Text) + "&" + + "comment=" + Uri.EscapeDataString(commentTextBox.Text) + "&" + + "email=" + Uri.EscapeDataString(emailTextBox.Text); byte[] byteArray = Encoding.UTF8.GetBytes(report); request.ContentLength = byteArray.Length; diff --git a/OpenHardwareMonitor.csproj b/OpenHardwareMonitor.csproj index 65a3216..67b7e6e 100644 --- a/OpenHardwareMonitor.csproj +++ b/OpenHardwareMonitor.csproj @@ -61,7 +61,6 @@ -