45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace ParadoxSaveParser.WebAPI.Database;
|
|
|
|
public enum SaveFileProcessingStatus
|
|
{
|
|
Initialized,
|
|
Uploaded,
|
|
Parsing,
|
|
SavingResults,
|
|
Done,
|
|
Error,
|
|
}
|
|
|
|
public class SaveFileMetadata
|
|
{
|
|
[SQLite.PrimaryKey]
|
|
[SQLite.NotNull]
|
|
public string id { get; init; } = null!;
|
|
|
|
[JsonConverter(typeof(JsonStringEnumConverter))]
|
|
[SQLite.NotNull]
|
|
public Game game { get; init; }
|
|
|
|
[JsonConverter(typeof(JsonStringEnumConverter))]
|
|
[SQLite.NotNull]
|
|
public SaveFileProcessingStatus status { get; set; }
|
|
|
|
[SQLite.NotNull]
|
|
public DateTime uploadDateTime { get; set; }
|
|
|
|
// if error occured during parsing, it's message is saved here
|
|
// status stays the same as when error occured
|
|
public string? errorMessage { get; set; }
|
|
|
|
|
|
public IOPath GetSaveFilePath() => Path.Concat(PathHelper.SAVES_DIR, id + ".eu4");
|
|
|
|
public IOPath GetParsedDataPath() => Path.Concat(PathHelper.PARSED_DIR, id + ".parsed.json");
|
|
|
|
public bool AssociatedFilesExist()
|
|
{
|
|
return File.Exists(GetSaveFilePath()) && File.Exists(GetParsedDataPath());
|
|
}
|
|
} |