-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from Khiro95/dev
Update to v3.1
- Loading branch information
Showing
122 changed files
with
4,742 additions
and
367 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace AwqatSalaat.Data | ||
{ | ||
public class Country | ||
{ | ||
public string Name { get; } | ||
public string Code { get; } | ||
|
||
[JsonConstructor] | ||
private Country(string name, string code) | ||
{ | ||
Name = name; | ||
Code = code; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace AwqatSalaat.Data | ||
{ | ||
public enum LocationDetectionMode | ||
{ | ||
ByCountryCode, | ||
ByCoordinates, | ||
ByQuery | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace AwqatSalaat.Data | ||
{ | ||
public enum School | ||
{ | ||
Standard = 0, | ||
Hanafi = 1, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using AwqatSalaat.Data; | ||
using Newtonsoft.Json; | ||
using System.IO; | ||
|
||
namespace AwqatSalaat.Helpers | ||
{ | ||
public static class CountriesProvider | ||
{ | ||
private static Country[] s_countries; | ||
|
||
public static Country[] GetCountries() | ||
{ | ||
if (s_countries is null) | ||
{ | ||
var asm = typeof(CountriesProvider).Assembly; | ||
using (Stream stream = asm.GetManifestResourceStream("AwqatSalaat.Assets.countries.json")) | ||
{ | ||
s_countries = DeserializeFromStream<Country[]>(stream); | ||
} | ||
} | ||
|
||
return s_countries; | ||
} | ||
|
||
private static T DeserializeFromStream<T>(Stream stream) | ||
{ | ||
var serializer = new JsonSerializer(); | ||
|
||
using (var reader = new StreamReader(stream)) | ||
{ | ||
using (var jsonTextReader = new JsonTextReader(reader)) | ||
{ | ||
return serializer.Deserialize<T>(jsonTextReader); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using TimeZoneConverter; | ||
|
||
namespace AwqatSalaat.Helpers | ||
{ | ||
internal static class TimeZoneHelper | ||
{ | ||
private static readonly Dictionary<string, TimeZoneInfo> tzInfoCache = new Dictionary<string, TimeZoneInfo>(); | ||
|
||
public static string GetIanaTimeZone() | ||
{ | ||
var id = TimeZoneInfo.Local.Id; | ||
|
||
if (TZConvert.TryWindowsToIana(id, out string ianaTimeZone)) | ||
{ | ||
return ianaTimeZone; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
public static DateTime ConvertDateTimeToLocal(DateTime dateTime, string ianaTimeZone) | ||
{ | ||
TimeZoneInfo timeZoneInfo = null; | ||
|
||
if (!string.IsNullOrEmpty(ianaTimeZone) && !tzInfoCache.TryGetValue(ianaTimeZone, out timeZoneInfo)) | ||
{ | ||
if (TZConvert.TryIanaToWindows(ianaTimeZone, out string timeZoneId)) | ||
{ | ||
timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(timeZoneId); | ||
|
||
tzInfoCache[ianaTimeZone] = timeZoneInfo; | ||
} | ||
} | ||
|
||
if (timeZoneInfo is null || timeZoneInfo.BaseUtcOffset == TimeZoneInfo.Local.BaseUtcOffset) | ||
{ | ||
return dateTime; | ||
} | ||
|
||
dateTime = TimeZoneInfo.ConvertTimeToUtc(dateTime, timeZoneInfo); | ||
|
||
return TimeZoneInfo.ConvertTimeFromUtc(dateTime, TimeZoneInfo.Local); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.