Добавление IDisposable
This commit is contained in:
@@ -31,7 +31,21 @@ namespace Example.Backend
|
|||||||
|
|
||||||
public async Task AsyncTest(CancellationToken token)
|
public async Task AsyncTest(CancellationToken token)
|
||||||
{
|
{
|
||||||
await Task.Delay(TimeSpan.FromSeconds(5), token);
|
Console.WriteLine("Async Test");
|
||||||
|
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
if (token.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Waiting canceled");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Console.WriteLine("Waiting...");
|
||||||
|
await Task.Delay(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Console.WriteLine("Waited until the end");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Example.Shared;
|
using Example.Shared;
|
||||||
@@ -18,5 +19,10 @@ namespace Example.Backend
|
|||||||
// throw new Exception("The method or operation is not implemented.");
|
// throw new Exception("The method or operation is not implemented.");
|
||||||
return new Page {Text = text};
|
return new Page {Text = text};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Console.WriteLine("Dispose printer with name {0}", Name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,6 +20,11 @@ namespace Example.Frontend
|
|||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
return new ClientBasedPage();
|
return new ClientBasedPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ClientBasedPage : IPage
|
public class ClientBasedPage : IPage
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Diagnostics;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Example.Frontend;
|
using Example.Frontend;
|
||||||
using Example.Shared;
|
using Example.Shared;
|
||||||
using mROA.Codegen;
|
using mROA.Codegen;
|
||||||
@@ -44,10 +45,12 @@ class Program
|
|||||||
|
|
||||||
//правильный порядок команд 8-5-10-7
|
//правильный порядок команд 8-5-10-7
|
||||||
var printer = factory.Create("Test");
|
var printer = factory.Create("Test");
|
||||||
|
using (var disposingPrinter = printer.Value)
|
||||||
|
{
|
||||||
Console.WriteLine("Printer created");
|
Console.WriteLine("Printer created");
|
||||||
Thread.Sleep(100);
|
Thread.Sleep(100);
|
||||||
|
|
||||||
var name = printer.Value.GetName();
|
var name = disposingPrinter.GetName();
|
||||||
Console.WriteLine("Printer name : {0}", name);
|
Console.WriteLine("Printer name : {0}", name);
|
||||||
|
|
||||||
Thread.Sleep(100);
|
Thread.Sleep(100);
|
||||||
@@ -68,12 +71,24 @@ class Program
|
|||||||
|
|
||||||
Console.WriteLine(string.Join(", ", names));
|
Console.WriteLine(string.Join(", ", names));
|
||||||
|
|
||||||
var page = printer.Value.Print("Test Page", new CancellationToken()).GetAwaiter().GetResult();
|
var page = disposingPrinter.Print("Test Page", new CancellationToken()).GetAwaiter().GetResult();
|
||||||
Console.WriteLine("Page printed");
|
Console.WriteLine("Page printed");
|
||||||
var data = page.Value.GetData();
|
var data = page.Value.GetData();
|
||||||
Console.WriteLine("Data : {0}", Encoding.UTF8.GetString(data));
|
Console.WriteLine("Data : {0}", Encoding.UTF8.GetString(data));
|
||||||
|
}
|
||||||
|
|
||||||
// var loadSingleton = context.GetSingleObject(typeof(ILoadTest)) as ILoadTest;
|
|
||||||
|
var loadSingleton = context.GetSingleObject(typeof(ILoadTest)) as ILoadTest;
|
||||||
|
|
||||||
|
|
||||||
|
var cts = new CancellationTokenSource();
|
||||||
|
var token = cts.Token;
|
||||||
|
var t = Task.Run(async () => await loadSingleton!.AsyncTest(token));
|
||||||
|
|
||||||
|
Thread.Sleep(5000);
|
||||||
|
cts.Cancel();
|
||||||
|
Console.WriteLine($"Token state {cts.Token.IsCancellationRequested}");
|
||||||
|
Console.ReadKey();
|
||||||
//
|
//
|
||||||
// const int iterations = 10000;
|
// const int iterations = 10000;
|
||||||
// var timer = Stopwatch.StartNew();
|
// var timer = Stopwatch.StartNew();
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using mROA.Implementation;
|
using mROA.Implementation;
|
||||||
@@ -6,7 +7,7 @@ using mROA.Implementation.Attributes;
|
|||||||
namespace Example.Shared
|
namespace Example.Shared
|
||||||
{
|
{
|
||||||
[SharedObjectInterface]
|
[SharedObjectInterface]
|
||||||
public interface IPrinter
|
public interface IPrinter : IDisposable
|
||||||
{
|
{
|
||||||
string GetName();
|
string GetName();
|
||||||
Task<SharedObject<IPage>> Print(string text, CancellationToken cancellationToken);
|
Task<SharedObject<IPage>> Print(string text, CancellationToken cancellationToken);
|
||||||
|
|||||||
@@ -233,6 +233,9 @@ namespace mROA.Codegen
|
|||||||
|
|
||||||
public MethodInfo GetMethod(int id)
|
public MethodInfo GetMethod(int id)
|
||||||
{{
|
{{
|
||||||
|
if (id == -1)
|
||||||
|
return typeof(IDisposable).GetMethod(""Dispose"");
|
||||||
|
|
||||||
if (_methods.Count <= id)
|
if (_methods.Count <= id)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ namespace mROA.Implementation.Backend
|
|||||||
public ICommandExecution Execute(ICallRequest command, IContextRepository contextRepository,
|
public ICommandExecution Execute(ICallRequest command, IContextRepository contextRepository,
|
||||||
IRepresentationModule representationModule)
|
IRepresentationModule representationModule)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine(command.GetType().Name);
|
||||||
|
|
||||||
if (_cancellationRepo is null)
|
if (_cancellationRepo is null)
|
||||||
throw new NullReferenceException("Method repository was not defined");
|
throw new NullReferenceException("Method repository was not defined");
|
||||||
|
|
||||||
@@ -30,6 +32,19 @@ namespace mROA.Implementation.Backend
|
|||||||
if (contextRepository is null)
|
if (contextRepository is null)
|
||||||
throw new NullReferenceException("Context repository was not defined");
|
throw new NullReferenceException("Context repository was not defined");
|
||||||
|
|
||||||
|
if (command is CancelRequest)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Final cancelling request");
|
||||||
|
var cts = _cancellationRepo.GetCancellation(command.Id);
|
||||||
|
cts.Cancel();
|
||||||
|
_cancellationRepo.FreeCancelation(command.Id);
|
||||||
|
return new FinalCommandExecution
|
||||||
|
{
|
||||||
|
Id = command.Id,
|
||||||
|
CommandId = command.CommandId
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
var currentCommand = _methodRepo.GetMethod(command.CommandId);
|
var currentCommand = _methodRepo.GetMethod(command.CommandId);
|
||||||
if (currentCommand == null)
|
if (currentCommand == null)
|
||||||
throw new Exception($"Command {command.CommandId} not found");
|
throw new Exception($"Command {command.CommandId} not found");
|
||||||
@@ -48,7 +63,14 @@ namespace mROA.Implementation.Backend
|
|||||||
return ExecuteAsync(currentCommand, context, parameter, command, _cancellationRepo,
|
return ExecuteAsync(currentCommand, context, parameter, command, _cancellationRepo,
|
||||||
representationModule);
|
representationModule);
|
||||||
|
|
||||||
return Execute(currentCommand, context, parameter, command);
|
var result = Execute(currentCommand, context, parameter, command);
|
||||||
|
|
||||||
|
if (command.CommandId == -1)
|
||||||
|
{
|
||||||
|
contextRepository.ClearObject(command.ObjectId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ICommandExecution Execute(MethodInfo currentCommand, object context, object? parameter,
|
private static ICommandExecution Execute(MethodInfo currentCommand, object context, object? parameter,
|
||||||
@@ -57,9 +79,10 @@ namespace mROA.Implementation.Backend
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var finalResult = currentCommand.Invoke(context, parameter is null
|
var finalResult = currentCommand.Invoke(context, parameter is null
|
||||||
? new object[0]
|
? Array.Empty<object>()
|
||||||
: new[]
|
: new[]
|
||||||
{ parameter });
|
{ parameter });
|
||||||
|
|
||||||
return new TypedFinalCommandExecution
|
return new TypedFinalCommandExecution
|
||||||
{
|
{
|
||||||
CommandId = command.CommandId, Result = finalResult,
|
CommandId = command.CommandId, Result = finalResult,
|
||||||
@@ -77,13 +100,14 @@ namespace mROA.Implementation.Backend
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ICommandExecution ExecuteAsync(MethodInfo currentCommand, object context, object? parameter,
|
private ICommandExecution ExecuteAsync(MethodInfo currentCommand, object context, object? parameter,
|
||||||
ICallRequest command, ICancellationRepository cancellationRepository,
|
ICallRequest command, ICancellationRepository cancellationRepository,
|
||||||
IRepresentationModule representationModule)
|
IRepresentationModule representationModule)
|
||||||
{
|
{
|
||||||
var tokenSource = new CancellationTokenSource();
|
var tokenSource = new CancellationTokenSource();
|
||||||
cancellationRepository.RegisterCancellation(command.Id, tokenSource);
|
cancellationRepository.RegisterCancellation(command.Id, tokenSource);
|
||||||
var token = tokenSource.Token;
|
var token = tokenSource.Token;
|
||||||
|
token.Register(() => Console.WriteLine($"Cancellation requested check {command.Id}"));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = (Task)currentCommand.Invoke(context, parameter is null
|
var result = (Task)currentCommand.Invoke(context, parameter is null
|
||||||
@@ -94,11 +118,16 @@ namespace mROA.Implementation.Backend
|
|||||||
|
|
||||||
result.ContinueWith(_ =>
|
result.ContinueWith(_ =>
|
||||||
{
|
{
|
||||||
|
if (token.IsCancellationRequested)
|
||||||
|
return;
|
||||||
|
|
||||||
var payload = new FinalCommandExecution
|
var payload = new FinalCommandExecution
|
||||||
{
|
{
|
||||||
Id = command.Id,
|
Id = command.Id,
|
||||||
CommandId = command.CommandId
|
CommandId = command.CommandId
|
||||||
};
|
};
|
||||||
|
_cancellationRepo.FreeCancelation(command.Id);
|
||||||
|
|
||||||
var multiClientOwnershipRepository =
|
var multiClientOwnershipRepository =
|
||||||
TransmissionConfig.OwnershipRepository as MultiClientOwnershipRepository;
|
TransmissionConfig.OwnershipRepository as MultiClientOwnershipRepository;
|
||||||
multiClientOwnershipRepository?.RegisterOwnership(representationModule.Id);
|
multiClientOwnershipRepository?.RegisterOwnership(representationModule.Id);
|
||||||
@@ -121,7 +150,7 @@ namespace mROA.Implementation.Backend
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ICommandExecution TypedExecuteAsync(MethodInfo currentCommand, object context, object? parameter,
|
private ICommandExecution TypedExecuteAsync(MethodInfo currentCommand, object context, object? parameter,
|
||||||
ICallRequest command, ICancellationRepository cancellationRepository,
|
ICallRequest command, ICancellationRepository cancellationRepository,
|
||||||
IRepresentationModule representationModule)
|
IRepresentationModule representationModule)
|
||||||
{
|
{
|
||||||
@@ -147,6 +176,8 @@ namespace mROA.Implementation.Backend
|
|||||||
CommandId = command.CommandId,
|
CommandId = command.CommandId,
|
||||||
Type = finalResult?.GetType()
|
Type = finalResult?.GetType()
|
||||||
};
|
};
|
||||||
|
_cancellationRepo.FreeCancelation(command.Id);
|
||||||
|
|
||||||
var multiClientOwnershipRepository =
|
var multiClientOwnershipRepository =
|
||||||
TransmissionConfig.OwnershipRepository as MultiClientOwnershipRepository;
|
TransmissionConfig.OwnershipRepository as MultiClientOwnershipRepository;
|
||||||
multiClientOwnershipRepository?.RegisterOwnership(representationModule.Id);
|
multiClientOwnershipRepository?.RegisterOwnership(representationModule.Id);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||||
|
|
||||||
@@ -21,6 +22,15 @@ namespace mROA.Implementation
|
|||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public Type? ParameterType { get; set; }
|
public Type? ParameterType { get; set; }
|
||||||
|
|
||||||
public object? Parameter { get; set; }
|
public object? Parameter { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class CancelRequest : ICallRequest
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public int CommandId { get; set; } = -2;
|
||||||
|
public int ObjectId { get; set; } = -2;
|
||||||
|
public object? Parameter { get; set; } = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using mROA.Abstract;
|
using mROA.Abstract;
|
||||||
using mROA.Implementation.Backend;
|
using mROA.Implementation.Backend;
|
||||||
@@ -54,17 +55,39 @@ namespace mROA.Implementation.Frontend
|
|||||||
|
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
var multiClientOwnershipRepository = TransmissionConfig.OwnershipRepository as MultiClientOwnershipRepository;
|
var multiClientOwnershipRepository =
|
||||||
|
TransmissionConfig.OwnershipRepository as MultiClientOwnershipRepository;
|
||||||
multiClientOwnershipRepository?.RegisterOwnership(_representationModule.Id);
|
multiClientOwnershipRepository?.RegisterOwnership(_representationModule.Id);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
var request =
|
Console.WriteLine("Waiting for request...");
|
||||||
_representationModule!.GetMessage<DefaultCallRequest>(messageType: MessageType.CallRequest);
|
var tokenSource = new CancellationTokenSource();
|
||||||
|
var token = tokenSource.Token;
|
||||||
|
var defaultRequest =
|
||||||
|
_representationModule!.GetMessageAsync<DefaultCallRequest>(
|
||||||
|
messageType: MessageType.CallRequest, token: token);
|
||||||
|
var cancelRequest =
|
||||||
|
_representationModule!.GetMessageAsync<CancelRequest>(
|
||||||
|
messageType: MessageType.CancelRequest, token: token);
|
||||||
|
|
||||||
// Console.WriteLine("Executing {0}", request.Id);
|
Task.WaitAny(defaultRequest, cancelRequest);
|
||||||
|
|
||||||
|
Console.WriteLine("Request received");
|
||||||
|
|
||||||
|
if (cancelRequest.IsCompleted)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Cancelling request");
|
||||||
|
var req = cancelRequest.Result;
|
||||||
|
tokenSource.Cancel();
|
||||||
|
_executeModule.Execute(req, _contextRepository, _representationModule);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tokenSource.Cancel();
|
||||||
|
var request = defaultRequest.Result;
|
||||||
|
|
||||||
if (request.Parameter is not null)
|
if (request.Parameter is not null)
|
||||||
{
|
{
|
||||||
@@ -94,11 +117,11 @@ namespace mROA.Implementation.Frontend
|
|||||||
_representationModule.PostCallMessage(request.Id, resultType, result, result.GetType());
|
_representationModule.PostCallMessage(request.Id, resultType, result, result.GetType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
multiClientOwnershipRepository?.FreeOwnership();
|
multiClientOwnershipRepository?.FreeOwnership();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,10 +86,11 @@ namespace mROA.Implementation
|
|||||||
// Console.WriteLine("Receiving {0}", Encoding.Default.GetString(_buffer[..len]));
|
// Console.WriteLine("Receiving {0}", Encoding.Default.GetString(_buffer[..len]));
|
||||||
|
|
||||||
var message = _serialization.Deserialize<NetworkMessage>(localSpan.Span);
|
var message = _serialization.Deserialize<NetworkMessage>(localSpan.Span);
|
||||||
_messageBuffer.Add(message!);
|
Console.WriteLine($"Received Message {message.SchemaId} - {message.Id}");
|
||||||
|
_messageBuffer.Add(message);
|
||||||
_currentReceiving = Task.Run(async () => await GetNextMessage());
|
_currentReceiving = Task.Run(async () => await GetNextMessage());
|
||||||
|
|
||||||
return message!;
|
return message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Threading;
|
using System;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using mROA.Abstract;
|
using mROA.Abstract;
|
||||||
using mROA.Implementation.CommandExecution;
|
using mROA.Implementation.CommandExecution;
|
||||||
@@ -7,7 +8,7 @@ using mROA.Implementation.CommandExecution;
|
|||||||
|
|
||||||
namespace mROA.Implementation
|
namespace mROA.Implementation
|
||||||
{
|
{
|
||||||
public abstract class RemoteObjectBase
|
public abstract class RemoteObjectBase : IDisposable
|
||||||
{
|
{
|
||||||
private readonly int _id;
|
private readonly int _id;
|
||||||
private readonly IRepresentationModule _representationModule;
|
private readonly IRepresentationModule _representationModule;
|
||||||
@@ -46,6 +47,7 @@ namespace mROA.Implementation
|
|||||||
if (cancellationToken.IsCancellationRequested)
|
if (cancellationToken.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
await _representationModule.PostCallMessageAsync(request.Id, MessageType.CancelRequest, request.Id);
|
await _representationModule.PostCallMessageAsync(request.Id, MessageType.CancelRequest, request.Id);
|
||||||
|
localTokenSource.Cancel();
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,21 +78,42 @@ namespace mROA.Implementation
|
|||||||
_representationModule.GetMessageAsync<ExceptionCommandExecution>(requestId: request.Id,
|
_representationModule.GetMessageAsync<ExceptionCommandExecution>(requestId: request.Id,
|
||||||
MessageType.ExceptionCommandExecution, localTokenSource.Token);
|
MessageType.ExceptionCommandExecution, localTokenSource.Token);
|
||||||
|
|
||||||
|
cancellationToken.Register(async () =>
|
||||||
|
{
|
||||||
|
Console.WriteLine("Cancelling task");
|
||||||
|
await _representationModule.PostCallMessageAsync(request.Id, MessageType.CancelRequest,
|
||||||
|
new CancelRequest
|
||||||
|
{
|
||||||
|
Id = request.Id
|
||||||
|
});
|
||||||
|
localTokenSource.Cancel();
|
||||||
|
});
|
||||||
|
|
||||||
Task.WaitAny(new Task[]
|
Task.WaitAny(new Task[]
|
||||||
{
|
{
|
||||||
successResponse, errorResponse
|
errorResponse, successResponse
|
||||||
}, cancellationToken);
|
}, cancellationToken);
|
||||||
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
Console.WriteLine($"Handling message");
|
||||||
{
|
|
||||||
await _representationModule.PostCallMessageAsync(request.Id, MessageType.CancelRequest, request.Id);
|
// if (cancellationToken.IsCancellationRequested)
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
// {
|
||||||
}
|
// localTokenSource.Cancel();
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
if (successResponse.IsCompletedSuccessfully)
|
if (successResponse.IsCompletedSuccessfully)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (errorResponse.IsCompletedSuccessfully)
|
||||||
throw errorResponse.Result.GetException();
|
throw errorResponse.Result.GetException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (_id == -1)
|
||||||
|
return;
|
||||||
|
CallAsync(-1).Wait();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,8 @@ namespace mROA.Implementation
|
|||||||
{
|
{
|
||||||
var message = await _interaction.GetNextMessageReceiving();
|
var message = await _interaction.GetNextMessageReceiving();
|
||||||
if ((requestId is not null && message.Id != requestId) ||
|
if ((requestId is not null && message.Id != requestId) ||
|
||||||
(messageType is not null && message.SchemaId != messageType)) continue;
|
(messageType is not null && message.SchemaId != messageType))
|
||||||
|
continue;
|
||||||
|
|
||||||
_interaction.HandleMessage(message);
|
_interaction.HandleMessage(message);
|
||||||
return message.Data;
|
return message.Data;
|
||||||
@@ -80,6 +81,8 @@ namespace mROA.Implementation
|
|||||||
if (_serialization == null)
|
if (_serialization == null)
|
||||||
throw new NullReferenceException("Serialization toolkit is not initialized");
|
throw new NullReferenceException("Serialization toolkit is not initialized");
|
||||||
|
|
||||||
|
Console.WriteLine($"Posting message: {id} - {messageType}");
|
||||||
|
|
||||||
await _interaction.PostMessage(new NetworkMessage
|
await _interaction.PostMessage(new NetworkMessage
|
||||||
{ Id = id, SchemaId = messageType, Data = _serialization.Serialize(payload, payloadType) });
|
{ Id = id, SchemaId = messageType, Data = _serialization.Serialize(payload, payloadType) });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user