вроде написан экстрактор команд и хабовый экстрактор команд
This commit is contained in:
@@ -1,39 +1,42 @@
|
|||||||
using mROA.Abstract;
|
using mROA.Abstract;
|
||||||
|
using mROA.Implementation.Frontend;
|
||||||
|
|
||||||
namespace mROA.Implementation.Backend;
|
namespace mROA.Implementation.Backend;
|
||||||
|
|
||||||
public class HubRequestExtractor : IInjectableModule
|
public class HubRequestExtractor : IInjectableModule
|
||||||
{
|
{
|
||||||
private IExecuteModule _executeModule;
|
|
||||||
private IConnectionHub _hub;
|
private IConnectionHub _hub;
|
||||||
|
|
||||||
|
private IContextRepository? _contextRepository;
|
||||||
|
private IMethodRepository? _methodRepository;
|
||||||
|
private ISerializationToolkit? _serializationToolkit;
|
||||||
public void Inject<T>(T dependency)
|
public void Inject<T>(T dependency)
|
||||||
{
|
{
|
||||||
switch (dependency)
|
switch (dependency)
|
||||||
{
|
{
|
||||||
case IExecuteModule executeModule:
|
|
||||||
_executeModule = executeModule;
|
|
||||||
break;
|
|
||||||
case IConnectionHub connectionHub:
|
case IConnectionHub connectionHub:
|
||||||
_hub = connectionHub;
|
_hub = connectionHub;
|
||||||
_hub.OnConnected += HubOnOnConnected;
|
_hub.OnConnected += HubOnOnConnected;
|
||||||
break;
|
break;
|
||||||
|
case IContextRepository contextRepository:
|
||||||
|
_contextRepository = contextRepository;
|
||||||
|
break;
|
||||||
|
case IMethodRepository methodRepository:
|
||||||
|
_methodRepository = methodRepository;
|
||||||
|
break;
|
||||||
|
case ISerializationToolkit serializationToolkit:
|
||||||
|
_serializationToolkit = serializationToolkit;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void HubOnOnConnected(IRepresentationModule interaction)
|
private void HubOnOnConnected(IRepresentationModule interaction)
|
||||||
{
|
{
|
||||||
try
|
var extractor = new RequestExtractor();
|
||||||
{
|
extractor.Inject(interaction);
|
||||||
while (true)
|
extractor.Inject(_contextRepository);
|
||||||
{
|
extractor.Inject(_methodRepository);
|
||||||
var messageReceiving = await interaction.GetMessage<DefaultCallRequest>(messageType: MessageType.CallRequest);
|
extractor.Inject(_serializationToolkit);
|
||||||
|
_ = extractor.StartExtraction();
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user