wasSharp – Diff between revs 3 and 5

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 3 Rev 5
Line 16... Line 16...
16 // Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 // 16 // Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 //
17 /////////////////////////////////////////////////////////////////////////// 17 ///////////////////////////////////////////////////////////////////////////
18 /// <summary>RFC3986 URI Escapes a string</summary> 18 /// <summary>RFC3986 URI Escapes a string</summary>
19 /// <param name="data">a string to escape</param> 19 /// <param name="data">a string to escape</param>
20 /// <returns>an RFC3986 escaped string</returns> 20 /// <returns>an RFC3986 escaped string</returns>
21 public static string wasURIEscapeDataString(string data) 21 public static string URIEscapeDataString(string data)
22 { 22 {
23 // Uri.EscapeDataString can only handle 32766 characters at a time 23 // Uri.EscapeDataString can only handle 32766 characters at a time
24 return string.Join("", Enumerable.Range(0, (data.Length + 32765)/32766) 24 return string.Join("", Enumerable.Range(0, (data.Length + 32765)/32766)
25 .Select(o => Uri.EscapeDataString(data.Substring(o*32766, Math.Min(32766, data.Length - (o*32766))))) 25 .Select(o => Uri.EscapeDataString(data.Substring(o*32766, Math.Min(32766, data.Length - (o*32766)))))
26 .ToArray()); 26 .ToArray());
Line 30... Line 30...
30 // Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 // 30 // Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 //
31 /////////////////////////////////////////////////////////////////////////// 31 ///////////////////////////////////////////////////////////////////////////
32 /// <summary>URI unescapes an RFC3986 URI escaped string</summary> 32 /// <summary>URI unescapes an RFC3986 URI escaped string</summary>
33 /// <param name="data">a string to unescape</param> 33 /// <param name="data">a string to unescape</param>
34 /// <returns>the resulting string</returns> 34 /// <returns>the resulting string</returns>
35 public static string wasURIUnescapeDataString(string data) 35 public static string URIUnescapeDataString(string data)
36 { 36 {
37 // Uri.UnescapeDataString can only handle 32766 characters at a time 37 // Uri.UnescapeDataString can only handle 32766 characters at a time
38 return string.Join("", Enumerable.Range(0, (data.Length + 32765)/32766) 38 return string.Join("", Enumerable.Range(0, (data.Length + 32765)/32766)
39 .Select(o => Uri.UnescapeDataString(data.Substring(o*32766, Math.Min(32766, data.Length - (o*32766))))) 39 .Select(o => Uri.UnescapeDataString(data.Substring(o*32766, Math.Min(32766, data.Length - (o*32766)))))
40 .ToArray()); 40 .ToArray());
Line 44... Line 44...
44 // Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 // 44 // Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 //
45 /////////////////////////////////////////////////////////////////////////// 45 ///////////////////////////////////////////////////////////////////////////
46 /// <summary>RFC1738 URL Escapes a string</summary> 46 /// <summary>RFC1738 URL Escapes a string</summary>
47 /// <param name="data">a string to escape</param> 47 /// <param name="data">a string to escape</param>
48 /// <returns>an RFC1738 escaped string</returns> 48 /// <returns>an RFC1738 escaped string</returns>
49 public static string wasURLEscapeDataString(string data) 49 public static string URLEscapeDataString(string data)
50 { 50 {
51 return WebUtility.UrlEncode(data); 51 return WebUtility.UrlEncode(data);
52 } 52 }
Line 53... Line 53...
53   53  
54 /////////////////////////////////////////////////////////////////////////// 54 ///////////////////////////////////////////////////////////////////////////
55 // Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 // 55 // Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 //
56 /////////////////////////////////////////////////////////////////////////// 56 ///////////////////////////////////////////////////////////////////////////
57 /// <summary>RFC1738 URL Unescape a string</summary> 57 /// <summary>RFC1738 URL Unescape a string</summary>
58 /// <param name="data">a string to unescape</param> 58 /// <param name="data">a string to unescape</param>
59 /// <returns>an RFC1738 unescaped string</returns> 59 /// <returns>an RFC1738 unescaped string</returns>
60 public static string wasURLUnescapeDataString(string data) 60 public static string URLUnescapeDataString(string data)
61 { 61 {
62 return WebUtility.UrlDecode(data); 62 return WebUtility.UrlDecode(data);
63 } 63 }
64 } 64 }
65 } 65 }