Практически доделанный кодген, но не работает демка
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using mROA.Abstract;
|
||||
using mROA.Implementation.CommandExecution;
|
||||
|
||||
@@ -10,8 +7,8 @@ namespace mROA.Implementation.Backend
|
||||
{
|
||||
public class BasicExecutionModule : IExecuteModule
|
||||
{
|
||||
private IMethodRepository? _methodRepo;
|
||||
private ICancellationRepository? _cancellationRepo;
|
||||
private IMethodRepository? _methodRepo;
|
||||
private ISerializationToolkit? _serialization;
|
||||
|
||||
public void Inject<T>(T dependency)
|
||||
@@ -244,8 +241,7 @@ namespace mROA.Implementation.Backend
|
||||
multiClientOwnershipRepository?.FreeOwnership();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
// result.ContinueWith(t =>
|
||||
// {
|
||||
// var finalResult = t.GetType().GetProperty("Result")?.GetValue(t);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using mROA.Implementation.Attributes;
|
||||
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||
@@ -21,6 +20,7 @@ namespace mROA.Implementation
|
||||
public int ObjectId { get; set; } = -1;
|
||||
|
||||
public object?[]? Parameters { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Call request {{ Id : {Id}, CommandId : {CommandId}, ObjectId : {ObjectId} }}";
|
||||
@@ -33,6 +33,7 @@ namespace mROA.Implementation
|
||||
public int CommandId { get; set; } = -2;
|
||||
public int ObjectId { get; set; } = -2;
|
||||
public object?[]? Parameters { get; set; } = null;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Cancel request {{ Id : {Id}, CommandId : {CommandId}, ObjectId : {ObjectId} }}";
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
using mROA.Abstract;
|
||||
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using mROA.Abstract;
|
||||
@@ -12,10 +11,10 @@ namespace mROA.Implementation.Frontend
|
||||
{
|
||||
public class RequestExtractor : IRequestExtractor
|
||||
{
|
||||
private IRepresentationModule? _representationModule;
|
||||
private IContextRepository? _contextRepository;
|
||||
private IMethodRepository? _methodRepository;
|
||||
private IExecuteModule? _executeModule;
|
||||
private IMethodRepository? _methodRepository;
|
||||
private IRepresentationModule? _representationModule;
|
||||
private ISerializationToolkit? _serializationToolkit;
|
||||
|
||||
public void Inject<T>(T dependency)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
using mROA.Abstract;
|
||||
using mROA.Implementation.Attributes;
|
||||
|
||||
@@ -18,47 +17,22 @@ namespace mROA.Implementation
|
||||
|
||||
public class SharedObjectShellShell<T> : ISharedObjectShell where T : notnull
|
||||
{
|
||||
[SerializationIgnore]
|
||||
[JsonIgnore]
|
||||
public IEndPointContext EndPointContext { get; set; } = new EndPointContext
|
||||
{
|
||||
RealRepository = TransmissionConfig.RealContextRepository,
|
||||
RemoteRepository = TransmissionConfig.RemoteEndpointContextRepository,
|
||||
HostId = TransmissionConfig.OwnershipRepository.GetHostOwnershipId(),
|
||||
OwnerFunc = TransmissionConfig.OwnershipRepository.GetOwnershipId
|
||||
};
|
||||
|
||||
private IContextRepository GetDefaultContextRepository() =>
|
||||
(_identifier.OwnerId == EndPointContext.HostId
|
||||
? EndPointContext.RealRepository
|
||||
: EndPointContext.RemoteRepository) ??
|
||||
throw new NullReferenceException(
|
||||
"DefaultContextRepository was not defined");
|
||||
|
||||
private UniversalObjectIdentifier _identifier = UniversalObjectIdentifier.Null;
|
||||
|
||||
public UniversalObjectIdentifier Identifier
|
||||
{
|
||||
get
|
||||
{
|
||||
_identifier.OwnerId = _identifier.OwnerId == -1 ? EndPointContext.OwnerId : _identifier.OwnerId;
|
||||
return _identifier;
|
||||
}
|
||||
set
|
||||
{
|
||||
_identifier = value;
|
||||
Value = GetDefaultContextRepository().GetObjectBySharedObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
public object UniversalValue
|
||||
{
|
||||
get => _value;
|
||||
set => _value = (T)value;
|
||||
}
|
||||
|
||||
private T _value;
|
||||
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
// ReSharper disable once UnusedMember.Global
|
||||
public SharedObjectShellShell()
|
||||
{
|
||||
}
|
||||
|
||||
// ReSharper disable once UnusedMember.Global
|
||||
public SharedObjectShellShell(T value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
[SerializationIgnore]
|
||||
public T Value
|
||||
@@ -80,18 +54,43 @@ namespace mROA.Implementation
|
||||
}
|
||||
}
|
||||
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
// ReSharper disable once UnusedMember.Global
|
||||
public SharedObjectShellShell()
|
||||
[SerializationIgnore]
|
||||
[JsonIgnore]
|
||||
public IEndPointContext EndPointContext { get; set; } = new EndPointContext
|
||||
{
|
||||
RealRepository = TransmissionConfig.RealContextRepository,
|
||||
RemoteRepository = TransmissionConfig.RemoteEndpointContextRepository,
|
||||
HostId = TransmissionConfig.OwnershipRepository.GetHostOwnershipId(),
|
||||
OwnerFunc = TransmissionConfig.OwnershipRepository.GetOwnershipId
|
||||
};
|
||||
|
||||
public UniversalObjectIdentifier Identifier
|
||||
{
|
||||
get
|
||||
{
|
||||
_identifier.OwnerId = _identifier.OwnerId == -1 ? EndPointContext.OwnerId : _identifier.OwnerId;
|
||||
return _identifier;
|
||||
}
|
||||
set
|
||||
{
|
||||
_identifier = value;
|
||||
Value = GetDefaultContextRepository().GetObjectBySharedObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
// ReSharper disable once UnusedMember.Global
|
||||
public SharedObjectShellShell(T value)
|
||||
public object UniversalValue
|
||||
{
|
||||
Value = value;
|
||||
get => _value;
|
||||
set => _value = (T)value;
|
||||
}
|
||||
|
||||
private IContextRepository GetDefaultContextRepository() =>
|
||||
(_identifier.OwnerId == EndPointContext.HostId
|
||||
? EndPointContext.RealRepository
|
||||
: EndPointContext.RemoteRepository) ??
|
||||
throw new NullReferenceException(
|
||||
"DefaultContextRepository was not defined");
|
||||
|
||||
public static implicit operator T(SharedObjectShellShell<T> value) => value.Value;
|
||||
|
||||
public static implicit operator SharedObjectShellShell<T>(T value) =>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using mROA.Abstract;
|
||||
|
||||
namespace mROA.Implementation
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user