2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-04-05 01:29:38 -04:00

Merge branch 'ui-overhaul' of https://github.com/Xjph/ObservatoryCore into ui-overhaul

This commit is contained in:
Fred K 2024-01-22 19:03:15 -05:00
commit 7e9c50be09
3 changed files with 23 additions and 16 deletions

View File

@ -1,4 +1,6 @@
namespace Observatory.Framework.Files.Journal
using System.Text.Json.Serialization;
namespace Observatory.Framework.Files.Journal
{
public class CarrierJumpRequest : JournalBase
{
@ -9,5 +11,10 @@
public string SystemName { get; init; }
public ulong SystemID { get; init; }
public string DepartureTime { get; init; }
[JsonIgnore]
public DateTime DepartureTimeDateTime {
get => ParseDateTime(DepartureTime);
}
}
}

View File

@ -12,10 +12,7 @@ namespace Observatory.Framework.Files.Journal
[JsonIgnore]
public DateTime TimestampDateTime
{
get
{
return DateTime.ParseExact(Timestamp, "yyyy-MM-ddTHH:mm:ssZ", null, System.Globalization.DateTimeStyles.AssumeUniversal);
}
get => ParseDateTime(Timestamp);
}
[JsonPropertyName("event")]
@ -43,5 +40,17 @@ namespace Observatory.Framework.Files.Journal
private string json;
// For use by Journal object classes for .*DateTime properties, like TimestampeDateTime, above.
internal static DateTime ParseDateTime(string value)
{
if (DateTime.TryParseExact(value, "yyyy-MM-ddTHH:mm:ssZ", null, System.Globalization.DateTimeStyles.AssumeUniversal, out DateTime dateTimeValue))
{
return dateTimeValue;
}
else
{
return new DateTime();
}
}
}
}

View File

@ -1,4 +1,5 @@
using Microsoft.VisualBasic.CompilerServices;
using Observatory.Framework.Files.Journal;
using System;
using System.Numerics;
@ -13,17 +14,7 @@ namespace Observatory.Framework.Files.ParameterTypes
public string Expiry { get; init; }
public DateTime ExpiryDateTime
{
get
{
if (DateTime.TryParseExact(Expiry, "yyyy-MM-ddTHH:mm:ssZ", null, System.Globalization.DateTimeStyles.AssumeUniversal, out DateTime expiryDateTime))
{
return expiryDateTime;
}
else
{
return new DateTime();
}
}
get => JournalBase.ParseDateTime(Expiry);
}
public bool IsComplete { get; init; }
public long CurrentTotal { get; init; }