Aetheria/Aetheria.State/AetheriaDocumentRegistry.cs

53 lines
2 KiB
C#
Raw Normal View History

2026-06-13 00:31:22 +01:00
using Aetheria.State.Documents;
using GameCult.Caching;
using GameCult.Networking;
namespace Aetheria.State;
public static class AetheriaDocumentRegistry
{
public static CultDocumentRegistry CreateCultCacheRegistry()
{
var registry = new CultDocumentRegistry();
foreach (var documentType in DocumentTypes)
{
registry.GetRequired(documentType);
}
return registry;
}
public static CultNetDocumentRegistry CreateCultNetRegistry(CultDocumentRegistry? cacheRegistry = null)
{
var registry = cacheRegistry ?? CreateCultCacheRegistry();
return new CultNetDocumentRegistry(
registry,
new[]
{
CultNetDocumentBinding.ForDocument<AetheriaWorldState>(registry),
CultNetDocumentBinding.ForDocument<AetheriaItemDefinition>(registry),
CultNetDocumentBinding.ForDocument<AetheriaCorporation>(registry),
CultNetDocumentBinding.ForDocument<AetheriaPlayerProfile>(registry),
CultNetDocumentBinding.ForDocument<AetheriaRuntimeSession>(registry),
2026-06-13 04:00:10 +01:00
CultNetDocumentBinding.ForDocument<AetheriaMigrationLedger>(registry),
CultNetDocumentBinding.ForDocument<AetheriaPlayerSettings>(registry),
CultNetDocumentBinding.ForDocument<AetheriaSavedRun>(registry),
CultNetDocumentBinding.ForDocument<AetheriaSavedZone>(registry),
CultNetDocumentBinding.ForDocument<AetheriaEntitySnapshot>(registry)
2026-06-13 00:31:22 +01:00
});
}
public static IReadOnlyList<Type> DocumentTypes { get; } =
[
typeof(AetheriaWorldState),
typeof(AetheriaItemDefinition),
typeof(AetheriaCorporation),
typeof(AetheriaPlayerProfile),
typeof(AetheriaRuntimeSession),
2026-06-13 04:00:10 +01:00
typeof(AetheriaMigrationLedger),
typeof(AetheriaPlayerSettings),
typeof(AetheriaSavedRun),
typeof(AetheriaSavedZone),
typeof(AetheriaEntitySnapshot)
2026-06-13 00:31:22 +01:00
];
}