Initial commit

This commit is contained in:
Chris Chen
2022-09-08 08:04:32 -07:00
commit 184db15773
4604 changed files with 503905 additions and 0 deletions
@@ -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}"));
}
}
}