cbor works
This commit is contained in:
@@ -14,6 +14,10 @@
|
|||||||
<DefineConstants />
|
<DefineConstants />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
|
<DefineConstants />
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Example.Shared\Example.Shared.csproj" />
|
<ProjectReference Include="..\Example.Shared\Example.Shared.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class Program
|
|||||||
}));
|
}));
|
||||||
builder.SetupMethodsRepository(new CoCodegenMethodRepository());
|
builder.SetupMethodsRepository(new CoCodegenMethodRepository());
|
||||||
builder.Modules.Add(new CreativeRepresentationModuleProducer(
|
builder.Modules.Add(new CreativeRepresentationModuleProducer(
|
||||||
new IInjectableModule[] { builder.GetModule<JsonSerializationToolkit>()! },
|
new IInjectableModule[] { builder.GetModule<CborSerializationToolkit>()! },
|
||||||
typeof(RepresentationModule)));
|
typeof(RepresentationModule)));
|
||||||
builder.Modules.Add(new CancellationRepository());
|
builder.Modules.Add(new CancellationRepository());
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,14 @@
|
|||||||
<LangVersion>9</LangVersion>
|
<LangVersion>9</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
|
<DefineConstants />
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||||
|
<DefineConstants />
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Example.Shared\Example.Shared.csproj" />
|
<ProjectReference Include="..\Example.Shared\Example.Shared.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -5,6 +5,14 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
|
<DefineConstants />
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||||
|
<DefineConstants />
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\mROA\mROA.csproj" />
|
<ProjectReference Include="..\mROA\mROA.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -5,7 +5,5 @@ namespace mROA.Abstract
|
|||||||
public interface ICommandExecution
|
public interface ICommandExecution
|
||||||
{
|
{
|
||||||
Guid Id { get; set; }
|
Guid Id { get; set; }
|
||||||
int ClientId { get; set; }
|
|
||||||
int CommandId { get; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,8 +43,7 @@ namespace mROA.Implementation.Backend
|
|||||||
_cancellationRepo.FreeCancelation(command.Id);
|
_cancellationRepo.FreeCancelation(command.Id);
|
||||||
return new FinalCommandExecution
|
return new FinalCommandExecution
|
||||||
{
|
{
|
||||||
Id = command.Id,
|
Id = command.Id
|
||||||
CommandId = command.CommandId
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +75,7 @@ namespace mROA.Implementation.Backend
|
|||||||
#endif
|
#endif
|
||||||
contextRepository.ClearObject(command.ObjectId);
|
contextRepository.ClearObject(command.ObjectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -84,8 +83,6 @@ namespace mROA.Implementation.Backend
|
|||||||
Console.WriteLine(e);
|
Console.WriteLine(e);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ICommandExecution Execute(MethodInfo currentCommand, object context, object? parameter,
|
private static ICommandExecution Execute(MethodInfo currentCommand, object context, object? parameter,
|
||||||
@@ -98,19 +95,26 @@ namespace mROA.Implementation.Backend
|
|||||||
: new[]
|
: new[]
|
||||||
{ parameter };
|
{ parameter };
|
||||||
var finalResult = currentCommand.Invoke(context, finalParameter);
|
var finalResult = currentCommand.Invoke(context, finalParameter);
|
||||||
|
|
||||||
return new TypedFinalCommandExecution
|
if (currentCommand.ReturnType.Name == "Void")
|
||||||
{
|
{
|
||||||
CommandId = command.CommandId, Result = finalResult,
|
return new FinalCommandExecution
|
||||||
Id = command.Id,
|
{
|
||||||
Type = currentCommand.ReturnType
|
Id = command.Id
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return new FinalCommandExecution<object>
|
||||||
|
{
|
||||||
|
Result = finalResult,
|
||||||
|
Id = command.Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
return new ExceptionCommandExecution
|
return new ExceptionCommandExecution
|
||||||
{
|
{
|
||||||
Id = command.Id, CommandId = command.CommandId,
|
Id = command.Id,
|
||||||
Exception = e.ToString()
|
Exception = e.ToString()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -139,17 +143,16 @@ namespace mROA.Implementation.Backend
|
|||||||
{
|
{
|
||||||
if (token.IsCancellationRequested)
|
if (token.IsCancellationRequested)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var payload = new FinalCommandExecution
|
var payload = new FinalCommandExecution
|
||||||
{
|
{
|
||||||
Id = command.Id,
|
Id = command.Id
|
||||||
CommandId = command.CommandId
|
|
||||||
};
|
};
|
||||||
_cancellationRepo.FreeCancelation(command.Id);
|
_cancellationRepo.FreeCancelation(command.Id);
|
||||||
|
|
||||||
var multiClientOwnershipRepository =
|
var multiClientOwnershipRepository =
|
||||||
TransmissionConfig.OwnershipRepository as MultiClientOwnershipRepository;
|
TransmissionConfig.OwnershipRepository as MultiClientOwnershipRepository;
|
||||||
|
|
||||||
multiClientOwnershipRepository?.RegisterOwnership(representationModule.Id);
|
multiClientOwnershipRepository?.RegisterOwnership(representationModule.Id);
|
||||||
representationModule.PostCallMessage(command.Id, MessageType.FinishedCommandExecution, payload);
|
representationModule.PostCallMessage(command.Id, MessageType.FinishedCommandExecution, payload);
|
||||||
multiClientOwnershipRepository?.FreeOwnership();
|
multiClientOwnershipRepository?.FreeOwnership();
|
||||||
@@ -157,14 +160,14 @@ namespace mROA.Implementation.Backend
|
|||||||
|
|
||||||
return new AsyncCommandExecution
|
return new AsyncCommandExecution
|
||||||
{
|
{
|
||||||
Id = command.Id, CommandId = command.CommandId
|
Id = command.Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
return new ExceptionCommandExecution
|
return new ExceptionCommandExecution
|
||||||
{
|
{
|
||||||
Id = command.Id, CommandId = command.CommandId,
|
Id = command.Id,
|
||||||
Exception = e.ToString()
|
Exception = e.ToString()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -190,12 +193,10 @@ namespace mROA.Implementation.Backend
|
|||||||
result.ContinueWith(t =>
|
result.ContinueWith(t =>
|
||||||
{
|
{
|
||||||
var finalResult = t.GetType().GetProperty("Result")?.GetValue(t);
|
var finalResult = t.GetType().GetProperty("Result")?.GetValue(t);
|
||||||
var payload = new TypedFinalCommandExecution
|
var payload = new FinalCommandExecution<object>
|
||||||
{
|
{
|
||||||
Id = command.Id,
|
Id = command.Id,
|
||||||
Result = finalResult,
|
Result = finalResult
|
||||||
CommandId = command.CommandId,
|
|
||||||
Type = finalResult?.GetType()
|
|
||||||
};
|
};
|
||||||
_cancellationRepo.FreeCancelation(command.Id);
|
_cancellationRepo.FreeCancelation(command.Id);
|
||||||
|
|
||||||
@@ -208,14 +209,14 @@ namespace mROA.Implementation.Backend
|
|||||||
|
|
||||||
return new AsyncCommandExecution
|
return new AsyncCommandExecution
|
||||||
{
|
{
|
||||||
Id = command.Id, CommandId = command.CommandId
|
Id = command.Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
return new ExceptionCommandExecution
|
return new ExceptionCommandExecution
|
||||||
{
|
{
|
||||||
Id = command.Id, CommandId = command.CommandId,
|
Id = command.Id,
|
||||||
Exception = e.ToString()
|
Exception = e.ToString()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,5 @@ namespace mROA.Implementation.CommandExecution
|
|||||||
public class AsyncCommandExecution : ICommandExecution
|
public class AsyncCommandExecution : ICommandExecution
|
||||||
{
|
{
|
||||||
public Guid Id { get; set; }
|
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 class ExceptionCommandExecution : ICommandExecution
|
||||||
{
|
{
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
public int ClientId { get; set; }
|
|
||||||
public int CommandId { get; set; }
|
|
||||||
public string Exception { get; set; }
|
public string Exception { get; set; }
|
||||||
|
|
||||||
public RemoteException GetException()
|
public RemoteException GetException()
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using mROA.Abstract;
|
using mROA.Abstract;
|
||||||
using mROA.Implementation.Attributes;
|
|
||||||
|
|
||||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||||
|
|
||||||
@@ -10,10 +9,6 @@ namespace mROA.Implementation.CommandExecution
|
|||||||
public class FinalCommandExecution : ICommandExecution
|
public class FinalCommandExecution : ICommandExecution
|
||||||
{
|
{
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
[SerializationIgnore]
|
|
||||||
public int ClientId { get; set; }
|
|
||||||
[SerializationIgnore]
|
|
||||||
public int CommandId { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FinalCommandExecution<T> : FinalCommandExecution
|
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