Starting implement deserialize migration

This commit is contained in:
Absolutely disgusting
2025-10-23 19:11:17 +04:00
parent 4d6aee63fb
commit c9c37113d3
7 changed files with 48 additions and 11 deletions

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace _2DGAMELIB
{
public static class ObjExtensions
{
static readonly Dictionary<string, string> KeyMap = new()
{
["咳"] = "Cough"
};
public static void MigrateKeys(this Obj obj)
{
var newDict = new OrderedDictionary<string, Difs>();
foreach (var key in obj.Keys)
{
var newKey = KeyMap.TryGetValue(key, out var mapped) ? mapped : key;
newDict.Add(newKey, obj.Difss[key]);
}
obj.Difss = newDict;
}
}
}