separated classes into files
This commit is contained in:
@@ -11,41 +11,6 @@ using ParadoxSaveParser.Lib;
|
||||
|
||||
namespace ParadoxSaveParser.WebAPI;
|
||||
|
||||
public enum SaveFileProcessingStatus
|
||||
{
|
||||
Initialized, Uploading, Parsing, SavingResults, Done, Error
|
||||
}
|
||||
|
||||
public enum Game
|
||||
{
|
||||
Unknown, EU4
|
||||
}
|
||||
|
||||
public class SaveFileMetadata
|
||||
{
|
||||
public required string id { get; init; }
|
||||
public required Game game { get; init; }
|
||||
public required SaveFileProcessingStatus status { get; set; }
|
||||
|
||||
public string? errorMesage { get; set; }
|
||||
|
||||
private static readonly JsonSerializerOptions _jsonOptions = new() { WriteIndented = true };
|
||||
public void SaveToFile()
|
||||
{
|
||||
using var metaFile = File.Open(PathHelper.GetMetaFilePath(id), FileMode.CreateNew, FileAccess.Write);
|
||||
JsonSerializer.Serialize(metaFile, this, _jsonOptions);
|
||||
}
|
||||
}
|
||||
|
||||
public static class PathHelper
|
||||
{
|
||||
|
||||
public const string DATA_DIR = "data";
|
||||
public static string SAVES_DIR = Path.Join(DATA_DIR, "saves");
|
||||
public static string GetMetaFilePath(string save_id) => Path.Join(SAVES_DIR, save_id + ".meta.json");
|
||||
public static string GetEU4SaveFilePath(string save_id) => Path.Join(SAVES_DIR, save_id + ".eu4");
|
||||
}
|
||||
|
||||
public class Program
|
||||
{
|
||||
private static ConcurrentDictionary<string, SaveFileMetadata> _saveMetadataStorage = new();
|
||||
|
||||
Reference in New Issue
Block a user