muffin v7.5.11
This commit is contained in:
parent
addf2d530f
commit
3102923ce2
522 changed files with 41082 additions and 211592 deletions
42
Questionable/Questionable.LgbWorker/LgbWorkerManifest.cs
Normal file
42
Questionable/Questionable.LgbWorker/LgbWorkerManifest.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Questionable.LgbWorker;
|
||||
|
||||
internal sealed class LgbWorkerManifest
|
||||
{
|
||||
[JsonPropertyName("sqpackPath")]
|
||||
public string SqpackPath { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("gameVersion")]
|
||||
public string GameVersion { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("npcCachePath")]
|
||||
public string NpcCachePath { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("boundaryCachePath")]
|
||||
public string BoundaryCachePath { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("territories")]
|
||||
public List<TerritoryEntry> Territories { get; set; } = new List<TerritoryEntry>();
|
||||
|
||||
[JsonPropertyName("levelEntries")]
|
||||
public List<LevelEntry> LevelEntries { get; set; } = new List<LevelEntry>();
|
||||
|
||||
public static LgbWorkerManifest Load(string path)
|
||||
{
|
||||
using FileStream utf8Json = File.OpenRead(path);
|
||||
LgbWorkerManifest? obj = JsonSerializer.Deserialize<LgbWorkerManifest>(utf8Json) ?? throw new InvalidDataException("Manifest deserialized to null");
|
||||
if (string.IsNullOrWhiteSpace(obj.SqpackPath))
|
||||
{
|
||||
throw new InvalidDataException("SqpackPath is missing");
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(obj.GameVersion))
|
||||
{
|
||||
throw new InvalidDataException("GameVersion is missing");
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue