corrade-vassal – Diff between revs 13 and 14

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 13 Rev 14
1 /////////////////////////////////////////////////////////////////////////// 1 ///////////////////////////////////////////////////////////////////////////
2 // Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3 // 2 // Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3 //
3 // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // 3 // Please see: http://www.gnu.org/licenses/gpl.html for legal details, //
4 // rights of fair usage, the disclaimer and warranty conditions. // 4 // rights of fair usage, the disclaimer and warranty conditions. //
5 /////////////////////////////////////////////////////////////////////////// 5 ///////////////////////////////////////////////////////////////////////////
6   6  
7 using System; 7 using System;
8 using System.Linq; 8 using System.Linq;
-   9 using System.Linq.Expressions;
9 using System.Net; 10 using System.Net;
10   11  
11 namespace wasSharp 12 namespace wasSharp
12 { 13 {
13 public class Web 14 public class Web
14 { 15 {
15 /////////////////////////////////////////////////////////////////////////// 16 ///////////////////////////////////////////////////////////////////////////
16 // Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 // 17 // Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 //
17 /////////////////////////////////////////////////////////////////////////// 18 ///////////////////////////////////////////////////////////////////////////
18 /// <summary>RFC3986 URI Escapes a string</summary> 19 /// <summary>RFC3986 URI Escapes a string</summary>
-   20 /// <remarks>
19 /// <param name="data">a string to escape</param> 21 /// data - a string to escape
-   22 /// </remarks>
20 /// <returns>an RFC3986 escaped string</returns> 23 /// <returns>an RFC3986 escaped string</returns>
21 public static string URIEscapeDataString(string data) 24 public static Func<string, string> URIEscapeDataString =
22 { -  
23 // Uri.EscapeDataString can only handle 32766 characters at a time 25 ((Expression<Func<string, string>>)
24 return string.Join("", Enumerable.Range(0, (data.Length + 32765)/32766) 26 (data => 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))))) 27 .Select(o => Uri.EscapeDataString(data.Substring(o*32766, Math.Min(32766, data.Length - (o*32766)))))
26 .ToArray()); 28 .ToArray()))).Compile();
27 } -  
28   29  
29 /////////////////////////////////////////////////////////////////////////// 30 ///////////////////////////////////////////////////////////////////////////
30 // Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 // 31 // Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 //
31 /////////////////////////////////////////////////////////////////////////// 32 ///////////////////////////////////////////////////////////////////////////
32 /// <summary>URI unescapes an RFC3986 URI escaped string</summary> 33 /// <summary>URI unescapes an RFC3986 URI escaped string</summary>
-   34 /// <remarks>
33 /// <param name="data">a string to unescape</param> 35 /// data - a string to unescape
-   36 /// </remarks>
34 /// <returns>the resulting string</returns> 37 /// <returns>the resulting string</returns>
35 public static string URIUnescapeDataString(string data) 38 public static Func<string, string> URIUnescapeDataString =
36 { -  
37 // Uri.UnescapeDataString can only handle 32766 characters at a time 39 ((Expression<Func<string, string>>)
38 return string.Join("", Enumerable.Range(0, (data.Length + 32765)/32766) 40 (data => string.Join("", Enumerable.Range(0, (data.Length + 32765)/32766)
-   41 .Select(
39 .Select(o => Uri.UnescapeDataString(data.Substring(o*32766, Math.Min(32766, data.Length - (o*32766))))) 42 o => Uri.UnescapeDataString(data.Substring(o*32766, Math.Min(32766, data.Length - (o*32766)))))
40 .ToArray()); 43 .ToArray()))).Compile();
41 } -  
42   44  
43 /////////////////////////////////////////////////////////////////////////// 45 ///////////////////////////////////////////////////////////////////////////
44 // Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 // 46 // Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 //
45 /////////////////////////////////////////////////////////////////////////// 47 ///////////////////////////////////////////////////////////////////////////
46 /// <summary>RFC1738 URL Escapes a string</summary> 48 /// <summary>RFC1738 URL Escapes a string</summary>
47 /// <param name="data">a string to escape</param> 49 /// <param name="data">a string to escape</param>
48 /// <returns>an RFC1738 escaped string</returns> 50 /// <returns>an RFC1738 escaped string</returns>
49 public static string URLEscapeDataString(string data) 51 public static string URLEscapeDataString(string data)
50 { 52 {
51 return WebUtility.UrlEncode(data); 53 return WebUtility.UrlEncode(data);
52 } 54 }
53   55  
54 /////////////////////////////////////////////////////////////////////////// 56 ///////////////////////////////////////////////////////////////////////////
55 // Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 // 57 // Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 //
56 /////////////////////////////////////////////////////////////////////////// 58 ///////////////////////////////////////////////////////////////////////////
57 /// <summary>RFC1738 URL Unescape a string</summary> 59 /// <summary>RFC1738 URL Unescape a string</summary>
58 /// <param name="data">a string to unescape</param> 60 /// <param name="data">a string to unescape</param>
59 /// <returns>an RFC1738 unescaped string</returns> 61 /// <returns>an RFC1738 unescaped string</returns>
60 public static string URLUnescapeDataString(string data) 62 public static string URLUnescapeDataString(string data)
61 { 63 {
62 return WebUtility.UrlDecode(data); 64 return WebUtility.UrlDecode(data);
63 } 65 }
64 } 66 }
65 } 67 }
66   68  
67
Generated by GNU Enscript 1.6.5.90.
69
Generated by GNU Enscript 1.6.5.90.
68   70  
69   71  
70   72