Aetheria/Assets/Scripts/Gameplay/LegacyCatalogBoundary.cs
2026-06-13 06:38:33 +01:00

27 lines
964 B
C#

using System.IO;
public static class LegacyCatalogBoundary
{
private static CultCache _catalogCache;
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");
}
public static CultCache GetCatalogCache(DirectoryInfo gameDataDirectory)
{
if (_catalogCache != null) return _catalogCache;
_catalogCache = new CultCache(readOnly: true);
_catalogCache.AddBackingStore(new SingleFileMessagePackBackingStore(GetLegacyCatalogPath(gameDataDirectory)));
_catalogCache.AddBackingStore(new MultiFileMessagePackBackingStore(gameDataDirectory.FullName), typeof(NameFile));
_catalogCache.PullAllBackingStores();
return _catalogCache;
}
}