wasSharp – Diff between revs 55 and 56

Subversion Repositories:
Rev:
Show entire fileRegard whitespace
Rev 55 Rev 56
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.Collections.Generic;
8 using System.Collections.Generic; 9 using System.IO;
-   10 using System.Linq;
-   11 using System.Text;
Line 9... Line 12...
9 using System.Linq; 12 using System.Threading.Tasks;
10   13  
11 namespace wasSharp.Languages 14 namespace wasSharp.Languages
12 { 15 {
Line 100... Line 103...
100   103  
101 /////////////////////////////////////////////////////////////////////////// 104 ///////////////////////////////////////////////////////////////////////////
102 // Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 // 105 // Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 //
103 /////////////////////////////////////////////////////////////////////////// 106 ///////////////////////////////////////////////////////////////////////////
104 /// <summary> 107 /// <summary>
105 /// Serialises a dictionary to key-value data. 108 /// Serializes a dictionary to key-value data.
-   109 /// </summary>
106 /// </summary> 110 /// <param name="data">an input string</param>
107 /// <returns>a key-value data encoded string</returns> 111 /// <returns>a key-value data encoded string</returns>
108 public static string Encode(IEnumerable<KeyValuePair<string, string>> data) 112 public static string Encode(IEnumerable<KeyValuePair<string, string>> data)
109 { 113 {
110 return string.Join("&", data.AsParallel().Select(o => string.Join("=", o.Key, o.Value))); 114 return string.Join("&", data.AsParallel().Select(o => string.Join("=", o.Key, o.Value)));
Line 111... Line 115...
111 } 115 }
-   116  
-   117 ///////////////////////////////////////////////////////////////////////////
-   118 // Copyright (C) 2018 Wizardry and Steamworks - License: GNU GPLv3 //
-   119 ///////////////////////////////////////////////////////////////////////////
-   120 /// <summary>
-   121 /// Asynchronously serializes a dictionary to key-value data.
-   122 /// </summary>
-   123 /// <param name="data">an input string</param>
-   124 /// <returns>a key-value data encoded string</returns>
-   125 public static string Encode(IEnumerable<KeyValuePair<Task<string>, Task<string>>> data)
-   126 {
-   127 return string.Join("&", data.AsParallel().Select(o => string.Join("=", o.Key.Result, o.Value.Result)));
-   128 }
112   129  
113 /////////////////////////////////////////////////////////////////////////// 130 ///////////////////////////////////////////////////////////////////////////
114 // Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 // 131 // Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 //
115 /////////////////////////////////////////////////////////////////////////// 132 ///////////////////////////////////////////////////////////////////////////
116 /// <summary> 133 /// <summary>
117 /// Escapes a dictionary's keys and values for sending as POST data. 134 /// Escapes a dictionary's keys and values for sending as POST data.
118 /// </summary> 135 /// </summary>
119 public static IEnumerable<KeyValuePair<string, string>> Escape(IEnumerable<KeyValuePair<string, string>> data, 136 public static IEnumerable<KeyValuePair<string, string>> Escape(IEnumerable<KeyValuePair<string, string>> data,
120 Func<string, string> func) 137 Func<string, string> func)
121 { 138 {
-   139 return data.AsParallel().ToDictionary(o => func(o.Key), p => func(p.Value));
-   140 }
-   141  
-   142 ///////////////////////////////////////////////////////////////////////////
-   143 // Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 //
-   144 ///////////////////////////////////////////////////////////////////////////
-   145 /// <summary>
-   146 /// Escapes a dictionary's keys and values for sending as POST data.
-   147 /// </summary>
-   148 public static IEnumerable<KeyValuePair<Task<string>, Task<string>>> EscapeAsync(IEnumerable<KeyValuePair<string, string>> data,
-   149 Func<string, Task<string>> func)
-   150 {
122 return data.AsParallel().ToDictionary(o => func(o.Key), p => func(p.Value)); 151 return data.AsParallel().ToDictionary(async o => await func(o.Key), async p => await func(p.Value));
123 } 152 }