Moved from ASP.Net to DTLib.Web, no more bloat!!!

This commit is contained in:
2025-03-23 01:32:14 +05:00
parent 52d5320899
commit e3b82d7de5
9 changed files with 141 additions and 93 deletions
+34
View File
@@ -0,0 +1,34 @@
using DTLib.Dtsod;
namespace ParadoxSaveParser.WebAPI;
public class Config
{
public const int ActualVersion = 1;
public int Version = ActualVersion;
public string BaseUrl = "http://127.0.0.1:8080/";
public static Config FromDtsod(DtsodV23 d)
{
var cfg = new Config
{
Version = d["version"],
BaseUrl = d["baseUrl"]
};
if (cfg.Version < ActualVersion)
throw new Exception($"config is obsolete (config v{cfg.Version} < program v{ActualVersion})");
if(cfg.Version > ActualVersion)
throw new Exception($"program is obsolete (config v{cfg.Version} > program v{ActualVersion})");
return cfg;
}
public DtsodV23 ToDtsod() =>
new()
{
{ "version", Version },
{ "baseUrl", BaseUrl },
};
public override string ToString() => ToDtsod().ToString();
}