mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-17 05:35:07 +00:00
fix: Temp fix for annoying CompiledOn DateTime parsing bug
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using ICD.Common.Utils.IO;
|
using System.Globalization;
|
||||||
|
using ICD.Common.Utils.IO;
|
||||||
using ICD.Common.Utils.Services;
|
using ICD.Common.Utils.Services;
|
||||||
using ICD.Common.Utils.Services.Logging;
|
using ICD.Common.Utils.Services.Logging;
|
||||||
#if SIMPLSHARP
|
#if SIMPLSHARP
|
||||||
@@ -46,9 +47,28 @@ namespace ICD.Common.Utils
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
string dateString;
|
string dateString;
|
||||||
return ProgComments.TryGetValue(COMPILED_ON_KEY, out dateString)
|
if (!ProgComments.TryGetValue(COMPILED_ON_KEY, out dateString))
|
||||||
? DateTime.Parse(dateString).ToUniversalTime()
|
return DateTime.MinValue;
|
||||||
: DateTime.MinValue;
|
|
||||||
|
// Crestron writes compile time in system local time with no sense of localization...
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return DateTime.Parse(dateString).ToUniversalTime();
|
||||||
|
}
|
||||||
|
catch (FormatException)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try again with dd/mm/yyyy
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return DateTime.ParseExact(dateString, "dd/MM/yyyy hh:mm:ss", CultureInfo.InvariantCulture).ToUniversalTime();
|
||||||
|
}
|
||||||
|
catch (FormatException)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
return DateTime.MinValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user