add fileheader entry class for detecting odyssey

This commit is contained in:
2022-11-24 16:10:27 +01:00
parent a713e450fe
commit 821b030213
5 changed files with 91 additions and 6 deletions

View File

@@ -1,13 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EDPlayerJournal.Entries;
namespace EDPlayerJournal.Entries;
public class CommanderEntry : Entry {
public string? Name { get; set; }
public string? FID { get; set; }
protected override void Initialise() {
Name = JSON.Value<string>("Name") ?? "";
FID = JSON.Value<string>("FID") ?? "";

View File

@@ -17,6 +17,7 @@ public class Entry {
{ Events.CommitCrime, typeof(CommitCrimeEntry) },
{ Events.Died, typeof(DiedEntry) },
{ Events.Docked, typeof(DockedEntry) },
{ Events.FileHeader, typeof(FileHeaderEntry) },
{ Events.FactionKillBond, typeof(FactionKillBondEntry) },
{ Events.FSDJump, typeof(FSDJumpEntry) },
{ Events.HullDamage, typeof(HullDamageEntry) },

View File

@@ -8,6 +8,7 @@ public class Events {
public static readonly string Docked = "Docked";
public static readonly string FactionKillBond = "FactionKillBond";
public static readonly string FighterDestroyed = "FighterDestroyed";
public static readonly string FileHeader = "Fileheader";
public static readonly string FSDJump = "FSDJump";
public static readonly string HullDamage = "HullDamage";
public static readonly string LoadGame = "LoadGame";

View File

@@ -0,0 +1,37 @@
namespace EDPlayerJournal.Entries;
public class FileHeaderEntry : Entry {
/// <summary>
/// File part.
/// </summary>
public ulong Part { get; set; } = 1;
/// <summary>
/// Local language of the file.
/// </summary>
public string? Language { get; set; }
/// <summary>
/// Whether the file is for an Odyssey version
/// </summary>
public bool Odyssey { get; set; } = false;
/// <summary>
/// Game version in question (3.8 or 4.0)
/// </summary>
public string GameVersion { get; set; } = "3.8";
/// <summary>
/// Build version (SVN revision number).
/// </summary>
public string? Build { get; set; }
protected override void Initialise() {
Part = JSON.Value<ulong?>("part") ?? 1;
Language = JSON.Value<string?>("language") ?? string.Empty;
// If this entry is not there then its a legacy entry
Odyssey = JSON.Value<bool?>("Odyssey") ?? false;
GameVersion = JSON.Value<string?>("gameversion") ?? "3.8";
Build = JSON.Value<string?>("build");
}
}