Aetheria/Assets/Scripts/Gameplay/LegacyCatalogBoundary.cs

28 lines
1 KiB
C#
Raw Normal View History

2026-06-13 06:33:12 +01:00
using System.IO;
public static class LegacyCatalogBoundary
{
2026-06-13 07:11:16 +01:00
private static LegacyCatalogCache _catalogCache;
2026-06-13 06:33:12 +01:00
public static string GetStateFilePath(DirectoryInfo gameDataDirectory)
{
return Path.Combine(gameDataDirectory.FullName, "aetheria-world.cc");
}
public static string GetLegacyCatalogPath(DirectoryInfo gameDataDirectory)
{
return Path.Combine(gameDataDirectory.FullName, "AetherDB.msgpack");
}
2026-06-13 07:41:21 +01:00
public static ILegacyCatalogReader GetCatalog(DirectoryInfo gameDataDirectory)
2026-06-13 06:33:12 +01:00
{
if (_catalogCache != null) return _catalogCache;
2026-06-13 07:11:16 +01:00
_catalogCache = new LegacyCatalogCache();
2026-06-13 06:33:12 +01:00
_catalogCache.AddBackingStore(new SingleFileMessagePackBackingStore(GetLegacyCatalogPath(gameDataDirectory)));
_catalogCache.AddBackingStore(new MultiFileMessagePackBackingStore(gameDataDirectory.FullName), typeof(NameFile));
_catalogCache.PullAllBackingStores();
DatabaseLinkBase.BindLegacyCatalog(_catalogCache);
2026-06-13 06:33:12 +01:00
return _catalogCache;
}
}