Initial commit
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace LineMessaging
|
||||
{
|
||||
internal static class DateTimeExtensions
|
||||
{
|
||||
private static readonly DateTimeOffset UnixEpochDateTimeOffset = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero);
|
||||
private static readonly DateTime UnixEpochDateTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||
|
||||
internal static DateTime FromUnixTime(this long unixTime)
|
||||
{
|
||||
return UnixEpochDateTime.AddMilliseconds(unixTime).ToLocalTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace LineMessaging
|
||||
{
|
||||
internal static class DictionaryExtensions
|
||||
{
|
||||
internal static string ToQueryString(this Dictionary<string, object> source)
|
||||
{
|
||||
if (source == null) throw new ArgumentNullException();
|
||||
if (source.Count == 0) return string.Empty;
|
||||
return "?" + string.Join("&", source.Select(x => $"{x.Key}={x.Value}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user