Skip to content

Commit 91e5ea0

Browse files
committed
fixed nonce issue and basestring variable
1 parent 0bb3127 commit 91e5ea0

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

ApiUtilLib/ApiAuthorization.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,23 +220,26 @@ public static long NewTimestamp()
220220
return dto.ToUnixTimeMilliseconds();
221221
}
222222

223-
public static long NewNonce()
223+
public static string NewNonce()
224224
{
225225
long nonce = 0;
226+
byte[] data = null;
226227
using (RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider())
227228
{
228229
// Buffer storage.
229-
byte[] data = new byte[8];
230+
data = new byte[8];
230231

231232
// Fill buffer.
232233
rng.GetBytes(data);
233234

234235
// Convert to int 64.
235-
nonce = BitConverter.ToInt64(data, 0);
236+
//nonce = BitConverter.ToInt64(data, 0);
237+
236238
}
237239

238240
Logger.LogEnterExit(LoggerBase.Args(nonce.ToString()));
239-
return nonce;
241+
//return nonce;
242+
return System.Convert.ToBase64String(data);
240243
}
241244

242245
public static String Token(

ApiUtilLib/ApiList.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,17 @@ public string ToString(string delimiter = "&", bool sort = true, bool quote = fa
2929

3030
foreach (var item in sortedList)
3131
{
32-
list.Add(string.Format(format, item.Key, item.Value));
32+
format = "{0}={1}";
33+
if (quote) format = "{0}=\"{1}\"";
34+
35+
if (item.Value == null && !quote)
36+
{
37+
list.Add(string.Format("{0}", item.Key, item.Value));
38+
}
39+
else
40+
{
41+
list.Add(string.Format(format, item.Key, item.Value));
42+
}
3343
}
3444
}
3545
else

0 commit comments

Comments
 (0)