diff --git a/GreenshotPlugin/Controls/GreenshotForm.cs b/GreenshotPlugin/Controls/GreenshotForm.cs
index 969e4e184..5f9e12cb0 100644
--- a/GreenshotPlugin/Controls/GreenshotForm.cs
+++ b/GreenshotPlugin/Controls/GreenshotForm.cs
@@ -1,4 +1,24 @@
-using System;
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ *
+ * For more information see: http://getgreenshot.org/
+ * The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
diff --git a/GreenshotPlugin/Core/EncryptionHelper.cs b/GreenshotPlugin/Core/EncryptionHelper.cs
index c714b4bc3..30eb502fd 100644
--- a/GreenshotPlugin/Core/EncryptionHelper.cs
+++ b/GreenshotPlugin/Core/EncryptionHelper.cs
@@ -1,4 +1,24 @@
-using System;
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ *
+ * For more information see: http://getgreenshot.org/
+ * The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;
diff --git a/GreenshotPlugin/Core/NetworkHelper.cs b/GreenshotPlugin/Core/NetworkHelper.cs
index 24d08095f..17249c3fb 100644
--- a/GreenshotPlugin/Core/NetworkHelper.cs
+++ b/GreenshotPlugin/Core/NetworkHelper.cs
@@ -23,7 +23,8 @@ using System.Drawing;
using System.IO;
using System.Net;
using System.Text;
-
+using System.Collections.Specialized;
+using System.Text.RegularExpressions;
using Greenshot.IniFile;
namespace GreenshotPlugin.Core {
@@ -132,5 +133,54 @@ namespace GreenshotPlugin.Core {
}
return proxyToUse;
}
+
+ ///
+ /// UrlEncodes a string without the requirement for System.Web
+ ///
+ ///
+ ///
+ // [Obsolete("Use System.Uri.EscapeDataString instead")]
+ public static string UrlEncode(string text) {
+ if (!string.IsNullOrEmpty(text)) {
+ // Sytem.Uri provides reliable parsing, but doesn't encode spaces.
+ return System.Uri.EscapeDataString(text).Replace("%20", "+");
+ }
+ return null;
+ }
+
+ ///
+ /// UrlDecodes a string without requiring System.Web
+ ///
+ /// String to decode.
+ /// decoded string
+ public static string UrlDecode(string text) {
+ // pre-process for + sign space formatting since System.Uri doesn't handle it
+ // plus literals are encoded as %2b normally so this should be safe
+ text = text.Replace("+", " ");
+ return System.Uri.UnescapeDataString(text);
+ }
+
+ ///
+ /// ParseQueryString without the requirement for System.Web
+ ///
+ ///
+ ///
+ public static NameValueCollection ParseQueryString(string s) {
+ NameValueCollection nvc = new NameValueCollection();
+ // remove anything other than query string from url
+ if (s.Contains("?")) {
+ s = s.Substring(s.IndexOf('?') + 1);
+ }
+ foreach (string vp in Regex.Split(s, "&")) {
+ string[] singlePair = Regex.Split(vp, "=");
+ if (singlePair.Length == 2) {
+ nvc.Add(singlePair[0], singlePair[1]);
+ } else {
+ // only one key with no value specified in query string
+ nvc.Add(singlePair[0], string.Empty);
+ }
+ }
+ return nvc;
+ }
}
}