cbor works
This commit is contained in:
@@ -43,8 +43,7 @@ namespace mROA.Implementation.Backend
|
||||
_cancellationRepo.FreeCancelation(command.Id);
|
||||
return new FinalCommandExecution
|
||||
{
|
||||
Id = command.Id,
|
||||
CommandId = command.CommandId
|
||||
Id = command.Id
|
||||
};
|
||||
}
|
||||
|
||||
@@ -76,7 +75,7 @@ namespace mROA.Implementation.Backend
|
||||
#endif
|
||||
contextRepository.ClearObject(command.ObjectId);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -84,8 +83,6 @@ namespace mROA.Implementation.Backend
|
||||
Console.WriteLine(e);
|
||||
throw;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static ICommandExecution Execute(MethodInfo currentCommand, object context, object? parameter,
|
||||
@@ -98,19 +95,26 @@ namespace mROA.Implementation.Backend
|
||||
: new[]
|
||||
{ parameter };
|
||||
var finalResult = currentCommand.Invoke(context, finalParameter);
|
||||
|
||||
return new TypedFinalCommandExecution
|
||||
|
||||
if (currentCommand.ReturnType.Name == "Void")
|
||||
{
|
||||
CommandId = command.CommandId, Result = finalResult,
|
||||
Id = command.Id,
|
||||
Type = currentCommand.ReturnType
|
||||
return new FinalCommandExecution
|
||||
{
|
||||
Id = command.Id
|
||||
};
|
||||
}
|
||||
|
||||
return new FinalCommandExecution<object>
|
||||
{
|
||||
Result = finalResult,
|
||||
Id = command.Id
|
||||
};
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new ExceptionCommandExecution
|
||||
{
|
||||
Id = command.Id, CommandId = command.CommandId,
|
||||
Id = command.Id,
|
||||
Exception = e.ToString()
|
||||
};
|
||||
}
|
||||
@@ -139,17 +143,16 @@ namespace mROA.Implementation.Backend
|
||||
{
|
||||
if (token.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
|
||||
var payload = new FinalCommandExecution
|
||||
{
|
||||
Id = command.Id,
|
||||
CommandId = command.CommandId
|
||||
Id = command.Id
|
||||
};
|
||||
_cancellationRepo.FreeCancelation(command.Id);
|
||||
|
||||
var multiClientOwnershipRepository =
|
||||
TransmissionConfig.OwnershipRepository as MultiClientOwnershipRepository;
|
||||
|
||||
|
||||
multiClientOwnershipRepository?.RegisterOwnership(representationModule.Id);
|
||||
representationModule.PostCallMessage(command.Id, MessageType.FinishedCommandExecution, payload);
|
||||
multiClientOwnershipRepository?.FreeOwnership();
|
||||
@@ -157,14 +160,14 @@ namespace mROA.Implementation.Backend
|
||||
|
||||
return new AsyncCommandExecution
|
||||
{
|
||||
Id = command.Id, CommandId = command.CommandId
|
||||
Id = command.Id
|
||||
};
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new ExceptionCommandExecution
|
||||
{
|
||||
Id = command.Id, CommandId = command.CommandId,
|
||||
Id = command.Id,
|
||||
Exception = e.ToString()
|
||||
};
|
||||
}
|
||||
@@ -190,12 +193,10 @@ namespace mROA.Implementation.Backend
|
||||
result.ContinueWith(t =>
|
||||
{
|
||||
var finalResult = t.GetType().GetProperty("Result")?.GetValue(t);
|
||||
var payload = new TypedFinalCommandExecution
|
||||
var payload = new FinalCommandExecution<object>
|
||||
{
|
||||
Id = command.Id,
|
||||
Result = finalResult,
|
||||
CommandId = command.CommandId,
|
||||
Type = finalResult?.GetType()
|
||||
Result = finalResult
|
||||
};
|
||||
_cancellationRepo.FreeCancelation(command.Id);
|
||||
|
||||
@@ -208,14 +209,14 @@ namespace mROA.Implementation.Backend
|
||||
|
||||
return new AsyncCommandExecution
|
||||
{
|
||||
Id = command.Id, CommandId = command.CommandId
|
||||
Id = command.Id
|
||||
};
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new ExceptionCommandExecution
|
||||
{
|
||||
Id = command.Id, CommandId = command.CommandId,
|
||||
Id = command.Id,
|
||||
Exception = e.ToString()
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,7 +6,5 @@ namespace mROA.Implementation.CommandExecution
|
||||
public class AsyncCommandExecution : ICommandExecution
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public int ClientId { get; set; }
|
||||
public int CommandId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,6 @@ namespace mROA.Implementation.CommandExecution
|
||||
public class ExceptionCommandExecution : ICommandExecution
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public int ClientId { get; set; }
|
||||
public int CommandId { get; set; }
|
||||
public string Exception { get; set; }
|
||||
|
||||
public RemoteException GetException()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
using mROA.Abstract;
|
||||
using mROA.Implementation.Attributes;
|
||||
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
|
||||
@@ -10,10 +9,6 @@ namespace mROA.Implementation.CommandExecution
|
||||
public class FinalCommandExecution : ICommandExecution
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
[SerializationIgnore]
|
||||
public int ClientId { get; set; }
|
||||
[SerializationIgnore]
|
||||
public int CommandId { get; set; }
|
||||
}
|
||||
|
||||
public class FinalCommandExecution<T> : FinalCommandExecution
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
using mROA.Implementation.Attributes;
|
||||
|
||||
namespace mROA.Implementation.CommandExecution
|
||||
{
|
||||
public class TypedFinalCommandExecution : FinalCommandExecution<object>
|
||||
{
|
||||
[SerializationIgnore]
|
||||
// ReSharper disable once UnusedAutoPropertyAccessor.Global
|
||||
public Type? Type { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user