add properties for IsLive and IsLegacy
This commit is contained in:
parent
d2aadf9882
commit
bb74d72b13
@ -26,6 +26,22 @@ public class FileHeaderEntry : Entry {
|
||||
/// </summary>
|
||||
public string? Build { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the version is legacy (3.X)
|
||||
/// <summary>
|
||||
public bool IsLegacy {
|
||||
get {
|
||||
return GameVersion.StartsWith("3.");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the version is live (4.x)
|
||||
/// </summary>
|
||||
public bool IsLive {
|
||||
get { return !IsLegacy; }
|
||||
}
|
||||
|
||||
protected override void Initialise() {
|
||||
Part = JSON.Value<ulong?>("part") ?? 1;
|
||||
Language = JSON.Value<string?>("language") ?? string.Empty;
|
||||
|
@ -21,6 +21,8 @@ public class FileHeaderTest {
|
||||
Assert.AreEqual(header.Language, "English/UK");
|
||||
Assert.AreEqual(header.Odyssey, true);
|
||||
Assert.AreEqual(header.GameVersion, "4.0.0.1450");
|
||||
Assert.AreEqual(header.IsLegacy, false);
|
||||
Assert.AreEqual(header.IsLive, true);
|
||||
// Someone at FDev messed up string building there.
|
||||
Assert.AreEqual(header.Build, "r286858/r0 ");
|
||||
}
|
||||
@ -44,6 +46,8 @@ public class FileHeaderTest {
|
||||
Assert.AreEqual(header.Language, """English\UK""");
|
||||
Assert.AreEqual(header.Odyssey, false);
|
||||
Assert.AreEqual(header.GameVersion, "3.5.3.400 EDH");
|
||||
Assert.AreEqual(header.IsLegacy, true);
|
||||
Assert.AreEqual(header.IsLive, false);
|
||||
// ~73k commits in two years. Not bad.
|
||||
Assert.AreEqual(header.Build, "r213094/r0 ");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user