Centralize observed daemon state access
This commit is contained in:
parent
a035a55fc3
commit
5992a6f0a2
4 changed files with 55 additions and 51 deletions
|
|
@ -3282,10 +3282,7 @@ static void RequireEveRuntimeBootstrap(string root)
|
|||
"EveSurfaceCommandRequest request",
|
||||
"request.ProviderId, \"aetheria.daemon\"",
|
||||
"AetheriaClient",
|
||||
"using var frame = client.State.ReactiveDaemonFrame();",
|
||||
"using var soaView = TryReactiveDaemonSoaView(client);",
|
||||
"using var zoneRender = client.State.ReactiveZoneRender();",
|
||||
"AetheriaRuntimeObservedDaemonState.TryCreateCurrent(frame, soaView, zoneRender, out var current)",
|
||||
"client.State.CurrentObservedDaemon()",
|
||||
"new AetheriaRuntimeDaemonOperationClient(",
|
||||
"AetheriaRuntimeDaemonSurfaceCommandCatalog.TrySubmitArgumentless(",
|
||||
"AetheriaRuntimeDaemonSurfaceCommandCatalog.CommandPrefix"
|
||||
|
|
@ -3301,6 +3298,9 @@ static void RequireEveRuntimeBootstrap(string root)
|
|||
}
|
||||
|
||||
if (daemonSurfaceCommands.Contains("AetheriaRuntimeStateReader.TryReadObservedDaemonState", StringComparison.Ordinal) ||
|
||||
daemonSurfaceCommands.Contains("client.State.ReactiveDaemonFrame()", StringComparison.Ordinal) ||
|
||||
daemonSurfaceCommands.Contains("TryReactiveDaemonSoaView(client)", StringComparison.Ordinal) ||
|
||||
daemonSurfaceCommands.Contains("client.State.ReactiveZoneRender()", StringComparison.Ordinal) ||
|
||||
daemonSurfaceCommands.Contains("client.State.ReactiveObservedDaemon()", StringComparison.Ordinal) ||
|
||||
daemonSurfaceCommands.Contains("observedState.TryCurrent(out var current)", StringComparison.Ordinal))
|
||||
{
|
||||
|
|
@ -15091,10 +15091,7 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
|
|||
var requiredManagedClientConnectionSymbols = new[]
|
||||
{
|
||||
"public AetheriaClientState State => _state;",
|
||||
"using var frame = State.ReactiveDaemonFrame();",
|
||||
"using var soaView = TryReactiveDaemonSoaView();",
|
||||
"using var zoneRender = State.ReactiveZoneRender();",
|
||||
"AetheriaRuntimeObservedDaemonState.TryCreateCurrent(frame, soaView, zoneRender, out var current)"
|
||||
"var observed = State.CurrentObservedDaemon();"
|
||||
};
|
||||
var missingManagedClientConnectionSymbols = requiredManagedClientConnectionSymbols
|
||||
.Where(symbol => !aetheriaClient.Contains(symbol, StringComparison.Ordinal))
|
||||
|
|
@ -15106,7 +15103,10 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
|
|||
string.Join(", ", missingManagedClientConnectionSymbols));
|
||||
}
|
||||
|
||||
if (aetheriaClient.Contains("State.ReactiveObservedDaemon()", StringComparison.Ordinal) ||
|
||||
if (aetheriaClient.Contains("State.ReactiveDaemonFrame()", StringComparison.Ordinal) ||
|
||||
aetheriaClient.Contains("TryReactiveDaemonSoaView()", StringComparison.Ordinal) ||
|
||||
aetheriaClient.Contains("State.ReactiveZoneRender()", StringComparison.Ordinal) ||
|
||||
aetheriaClient.Contains("State.ReactiveObservedDaemon()", StringComparison.Ordinal) ||
|
||||
aetheriaClient.Contains("Aetheria() => State", StringComparison.Ordinal) ||
|
||||
aetheriaClient.Contains("observedState.TryCurrent(out var current)", StringComparison.Ordinal))
|
||||
{
|
||||
|
|
@ -15121,7 +15121,8 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
|
|||
"public Task<TDocument> LatestAsync<TDocument>()",
|
||||
"public Observable<TDocument> Watch<TDocument>()",
|
||||
"public Task<CultMeshReactiveDocument<TDocument>> ReactiveAsync<TDocument>(",
|
||||
"public CultMeshReactiveDocument<TDocument> Reactive<TDocument>("
|
||||
"public CultMeshReactiveDocument<TDocument> Reactive<TDocument>(",
|
||||
"public AetheriaRuntimeObservedDaemonState? CurrentObservedDaemon("
|
||||
};
|
||||
var missingManagedStateAccessSymbols = requiredManagedStateAccessSymbols
|
||||
.Where(symbol => !aetheriaClientState.Contains(symbol, StringComparison.Ordinal))
|
||||
|
|
@ -15133,6 +15134,24 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
|
|||
string.Join(", ", missingManagedStateAccessSymbols));
|
||||
}
|
||||
|
||||
var requiredManagedObservedDaemonSymbols = new[]
|
||||
{
|
||||
"public AetheriaRuntimeObservedDaemonState? CurrentObservedDaemon(",
|
||||
"using var frame = ReactiveDaemonFrame(options);",
|
||||
"using var soaView = TryReactiveDaemonSoaView(options);",
|
||||
"using var zoneRender = ReactiveZoneRender(options);",
|
||||
"AetheriaRuntimeObservedDaemonState.TryCreateCurrent(frame, soaView, zoneRender, out var current)"
|
||||
};
|
||||
var missingManagedObservedDaemonSymbols = requiredManagedObservedDaemonSymbols
|
||||
.Where(symbol => !aetheriaClientState.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
if (missingManagedObservedDaemonSymbols.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"AetheriaClientState must compose current observed daemon state from managed typed reactive documents: " +
|
||||
string.Join(", ", missingManagedObservedDaemonSymbols));
|
||||
}
|
||||
|
||||
var requiredObservedDaemonStateSymbols = new[]
|
||||
{
|
||||
"AetheriaRuntimeDaemonSoaViewIndex.Build(soaView)",
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using GameCult.Eve.Surface;
|
||||
using GameCult.Mesh;
|
||||
|
||||
#nullable enable
|
||||
|
||||
|
|
@ -161,12 +159,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
ThrowIfDisposed();
|
||||
if (submit == null) throw new ArgumentNullException(nameof(submit));
|
||||
|
||||
using var frame = State.ReactiveDaemonFrame();
|
||||
using var soaView = TryReactiveDaemonSoaView();
|
||||
using var zoneRender = State.ReactiveZoneRender();
|
||||
var observed = AetheriaRuntimeObservedDaemonState.TryCreateCurrent(frame, soaView, zoneRender, out var current)
|
||||
? current
|
||||
: null;
|
||||
var observed = State.CurrentObservedDaemon();
|
||||
var operationClient = new AetheriaRuntimeDaemonOperationClient(
|
||||
StatePath,
|
||||
_clientId,
|
||||
|
|
@ -179,18 +172,6 @@ namespace GameCult.Aetheria.State.Verse
|
|||
return submit(operationClient, observed);
|
||||
}
|
||||
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeDaemonSoaViewDocument>? TryReactiveDaemonSoaView()
|
||||
{
|
||||
try
|
||||
{
|
||||
return State.ReactiveDaemonSoaView();
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void ThrowIfDisposed()
|
||||
{
|
||||
if (_disposed)
|
||||
|
|
|
|||
|
|
@ -256,6 +256,30 @@ namespace GameCult.Aetheria.State.Verse
|
|||
return LatestObservedDaemonAsync().ConfigureAwait(false).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public AetheriaRuntimeObservedDaemonState? CurrentObservedDaemon(
|
||||
CultMeshReactiveDocumentOptions? options = null)
|
||||
{
|
||||
using var frame = ReactiveDaemonFrame(options);
|
||||
using var soaView = TryReactiveDaemonSoaView(options);
|
||||
using var zoneRender = ReactiveZoneRender(options);
|
||||
return AetheriaRuntimeObservedDaemonState.TryCreateCurrent(frame, soaView, zoneRender, out var current)
|
||||
? current
|
||||
: null;
|
||||
}
|
||||
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeDaemonSoaViewDocument>? TryReactiveDaemonSoaView(
|
||||
CultMeshReactiveDocumentOptions? options)
|
||||
{
|
||||
try
|
||||
{
|
||||
return ReactiveDaemonSoaView(options);
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<AetheriaRuntimeDaemonSoaViewDocument?> TryLatestDaemonSoaViewAsync()
|
||||
{
|
||||
try
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using GameCult.Eve.Surface;
|
||||
using GameCult.Mesh;
|
||||
|
||||
#nullable enable
|
||||
|
||||
|
|
@ -23,12 +21,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
return false;
|
||||
}
|
||||
|
||||
using var frame = client.State.ReactiveDaemonFrame();
|
||||
using var soaView = TryReactiveDaemonSoaView(client);
|
||||
using var zoneRender = client.State.ReactiveZoneRender();
|
||||
var observed = AetheriaRuntimeObservedDaemonState.TryCreateCurrent(frame, soaView, zoneRender, out var current)
|
||||
? current
|
||||
: null;
|
||||
var observed = client.State.CurrentObservedDaemon();
|
||||
var operationClient = new AetheriaRuntimeDaemonOperationClient(
|
||||
client.StatePath,
|
||||
string.IsNullOrWhiteSpace(request.ClientId) ? AetheriaRuntimeDaemonOperationClient.DefaultClientId : request.ClientId,
|
||||
|
|
@ -41,19 +34,6 @@ namespace GameCult.Aetheria.State.Verse
|
|||
out envelope);
|
||||
}
|
||||
|
||||
private static CultMeshReactiveDocument<AetheriaRuntimeDaemonSoaViewDocument>? TryReactiveDaemonSoaView(
|
||||
AetheriaClient client)
|
||||
{
|
||||
try
|
||||
{
|
||||
return client.State.ReactiveDaemonSoaView();
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool TryResolveKind(EveSurfaceCommandRequest request, out AetheriaRuntimeDaemonCommandKinds kind)
|
||||
{
|
||||
kind = AetheriaRuntimeDaemonCommandKinds.None;
|
||||
|
|
|
|||
Loading…
Reference in a new issue