32 lines
852 B
C#
32 lines
852 B
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace ParadoxSaveParser.WebAPI;
|
|
|
|
public enum SaveFileProcessingStatus
|
|
{
|
|
Initialized, Uploading, Uploaded, Parsing, SavingResults, Done
|
|
}
|
|
|
|
public enum Game
|
|
{
|
|
Unknown, EU4
|
|
}
|
|
|
|
public class SaveFileMetadata
|
|
{
|
|
public required string id { get; init; }
|
|
|
|
[JsonConverter(typeof(JsonStringEnumConverter))]
|
|
public required Game game { get; init; }
|
|
|
|
[JsonConverter(typeof(JsonStringEnumConverter))]
|
|
public required SaveFileProcessingStatus status { get; set; }
|
|
|
|
|
|
private static readonly JsonSerializerOptions _jsonOptions = new() { WriteIndented = true };
|
|
public void SaveToFile()
|
|
{
|
|
using var metaFile = File.OpenWrite(PathHelper.GetMetaFilePath(id));
|
|
JsonSerializer.Serialize(metaFile, this, _jsonOptions);
|
|
}
|
|
} |