2024-03-01 11:11:57 +01:00

28 lines
737 B
C#

// ReSharper disable InconsistentNaming
// ReSharper disable MemberCanBePrivate.Global
using Newtonsoft.Json;
namespace SteamGameTimeTrack;
public struct GameTime
{
public int appid, playtime_forever;
public DateTime? GameStarted;
public string name;
[JsonIgnore]
public TimeSpan PlayTime => TimeSpan.FromMinutes(playtime_forever);
[JsonIgnore]
public TimeSpan? Session => GameStarted is not null ? DateTime.UtcNow.Subtract(GameStarted.Value) : null;
public GameTime Clone()
{
return new GameTime()
{
appid = this.appid,
GameStarted = this.GameStarted,
name = this.name,
playtime_forever = this.playtime_forever
};
}
}