Aetheria/Aetheria.State.Unity/AetheriaRuntimeCatalogClient.cs

41 lines
1.1 KiB
C#

using Aetheria.State.Documents;
using GameCult.Aetheria.State.Unity;
namespace Aetheria.State.Unity;
public sealed class AetheriaRuntimeCatalogClient : IAsyncDisposable, IDisposable
{
private readonly AetheriaStateNode _node;
private AetheriaRuntimeCatalogClient(AetheriaStateNode node)
{
_node = node;
}
public static async Task<AetheriaRuntimeCatalogClient> OpenAsync(string statePath)
{
var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-unity-runtime-catalog").ConfigureAwait(false);
return new AetheriaRuntimeCatalogClient(node);
}
public AetheriaRuntimeCatalogSnapshot ReadCatalog()
{
var catalog = _node.ReadCatalogSnapshot();
return AetheriaRuntimeCatalogSnapshotMapper.FromCatalog(catalog);
}
public async Task<EveSurfaceState?> ReadCatalogSurfaceAsync()
{
return await _node.GetCatalogSurfaceAsync().ConfigureAwait(false);
}
public ValueTask DisposeAsync()
{
return _node.DisposeAsync();
}
public void Dispose()
{
_node.Dispose();
}
}