corrade-vassal – Diff between revs 13 and 14

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 13 Rev 14
Line 4... Line 4...
4 // rights of fair usage, the disclaimer and warranty conditions. // 4 // rights of fair usage, the disclaimer and warranty conditions. //
5 /////////////////////////////////////////////////////////////////////////// 5 ///////////////////////////////////////////////////////////////////////////
Line 6... Line 6...
6   6  
7 using System; 7 using System;
-   8 using System.Linq;
8 using System.Linq; 9 using System.Linq.Expressions;
Line 9... Line 10...
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 //
-   18 ///////////////////////////////////////////////////////////////////////////
17 /////////////////////////////////////////////////////////////////////////// 19 /// <summary>RFC3986 URI Escapes a string</summary>
-   20 /// <remarks>
18 /// <summary>RFC3986 URI Escapes a string</summary> 21 /// data - a string to escape
19 /// <param name="data">a string to escape</param> 22 /// </remarks>
20 /// <returns>an RFC3986 escaped string</returns> -  
21 public static string URIEscapeDataString(string data) 23 /// <returns>an RFC3986 escaped string</returns>
22 { 24 public static Func<string, string> URIEscapeDataString =
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))))) -  
Line 26... Line 27...
26 .ToArray()); 27 .Select(o => Uri.EscapeDataString(data.Substring(o*32766, Math.Min(32766, data.Length - (o*32766)))))
27 } 28 .ToArray()))).Compile();
28   29  
29 /////////////////////////////////////////////////////////////////////////// 30 ///////////////////////////////////////////////////////////////////////////
-   31 // Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 //
30 // Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 // 32 ///////////////////////////////////////////////////////////////////////////
-   33 /// <summary>URI unescapes an RFC3986 URI escaped string</summary>
31 /////////////////////////////////////////////////////////////////////////// 34 /// <remarks>
32 /// <summary>URI unescapes an RFC3986 URI escaped string</summary> 35 /// data - a string to unescape
33 /// <param name="data">a string to unescape</param> -  
34 /// <returns>the resulting string</returns> 36 /// </remarks>
35 public static string URIUnescapeDataString(string data) 37 /// <returns>the resulting string</returns>
-   38 public static Func<string, string> URIUnescapeDataString =
36 { 39 ((Expression<Func<string, string>>)
37 // Uri.UnescapeDataString can only handle 32766 characters at a time 40 (data => string.Join("", Enumerable.Range(0, (data.Length + 32765)/32766)
38 return string.Join("", Enumerable.Range(0, (data.Length + 32765)/32766) -  
Line 39... Line 41...
39 .Select(o => Uri.UnescapeDataString(data.Substring(o*32766, Math.Min(32766, data.Length - (o*32766))))) 41 .Select(
40 .ToArray()); 42 o => Uri.UnescapeDataString(data.Substring(o*32766, Math.Min(32766, data.Length - (o*32766)))))
41 } 43 .ToArray()))).Compile();
42   44