Автоматический клинап

This commit is contained in:
2025-03-13 20:01:17 +03:00
parent 1ff521c614
commit 40a7f86dcf
30 changed files with 55 additions and 36 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ class Program
builder.Modules.Add(new RemoteContextRepository()); builder.Modules.Add(new RemoteContextRepository());
builder.Modules.Add(new NextGenerationInteractionModule()); builder.Modules.Add(new NextGenerationInteractionModule());
builder.Modules.Add(new RepresentationModule()); builder.Modules.Add(new RepresentationModule());
builder.Modules.Add(new NetworkFrontendBridge(new IPEndPoint(IPAddress.Parse("95.105.78.72"), 4567))); builder.Modules.Add(new NetworkFrontendBridge(new IPEndPoint(IPAddress.Loopback, 4567)));
builder.Modules.Add(new StaticRepresentationModuleProducer()); builder.Modules.Add(new StaticRepresentationModuleProducer());
builder.Modules.Add(new RequestExtractor()); builder.Modules.Add(new RequestExtractor());
builder.Modules.Add(new BasicExecutionModule()); builder.Modules.Add(new BasicExecutionModule());
+1
View File
@@ -1,6 +1,7 @@
namespace mROA.Abstract namespace mROA.Abstract
{ {
public delegate void ConnectionHandler(IRepresentationModule representationModule); public delegate void ConnectionHandler(IRepresentationModule representationModule);
public delegate void DisconnectionHandler(IRepresentationModule representationModule); public delegate void DisconnectionHandler(IRepresentationModule representationModule);
public interface IConnectionHub : IInjectableModule public interface IConnectionHub : IInjectableModule
+2 -1
View File
@@ -4,6 +4,7 @@ namespace mROA.Abstract
{ {
public interface IExecuteModule : IInjectableModule public interface IExecuteModule : IInjectableModule
{ {
ICommandExecution Execute(ICallRequest command, IContextRepository contextRepository, IRepresentationModule representationModule); ICommandExecution Execute(ICallRequest command, IContextRepository contextRepository,
IRepresentationModule representationModule);
} }
} }
-1
View File
@@ -2,6 +2,5 @@ namespace mROA.Abstract
{ {
public interface IFrontendBridge : IInjectableModule public interface IFrontendBridge : IInjectableModule
{ {
} }
} }
-1
View File
@@ -12,6 +12,5 @@ namespace mROA.Abstract
object? Deserialize(Span<byte> rawData, Type type); object? Deserialize(Span<byte> rawData, Type type);
T? Cast<T>(object? nonCasted); T? Cast<T>(object? nonCasted);
object? Cast(object? nonCasted, Type type); object? Cast(object? nonCasted, Type type);
} }
} }
@@ -4,6 +4,5 @@ namespace mROA.Implementation.Attributes
{ {
public class SerializationIgnoreAttribute : Attribute public class SerializationIgnoreAttribute : Attribute
{ {
} }
} }
@@ -2,5 +2,7 @@
namespace mROA.Implementation.Attributes namespace mROA.Implementation.Attributes
{ {
public class SharedObjectInterfaceAttribute : Attribute { } public class SharedObjectInterfaceAttribute : Attribute
{
}
} }
@@ -2,5 +2,7 @@
namespace mROA.Implementation.Attributes namespace mROA.Implementation.Attributes
{ {
public class SharedObjectSingletonAttribute : Attribute { } public class SharedObjectSingletonAttribute : Attribute
{
}
} }
@@ -8,7 +8,8 @@ namespace mROA.Implementation.Backend
{ {
public static class BasicConfigurationExtensions public static class BasicConfigurationExtensions
{ {
public static void UseNetworkGateway(this FullMixBuilder builder, IPEndPoint endPoint, Type interactionModuleType, params IInjectableModule[] injectableModules) public static void UseNetworkGateway(this FullMixBuilder builder, IPEndPoint endPoint,
Type interactionModuleType, params IInjectableModule[] injectableModules)
{ {
builder.Modules.Add(new NetworkGatewayModule(endPoint, interactionModuleType, injectableModules)); builder.Modules.Add(new NetworkGatewayModule(endPoint, interactionModuleType, injectableModules));
} }
+1 -1
View File
@@ -28,11 +28,11 @@ namespace mROA.Implementation.Backend
public event ConnectionHandler? OnConnected; public event ConnectionHandler? OnConnected;
public event DisconnectionHandler? OnDisconnected; public event DisconnectionHandler? OnDisconnected;
public void Inject<T>(T dependency) public void Inject<T>(T dependency)
{ {
if (dependency is ISerializationToolkit serializationToolkit) if (dependency is ISerializationToolkit serializationToolkit)
_serializationToolkit = serializationToolkit; _serializationToolkit = serializationToolkit;
} }
} }
} }
@@ -8,6 +8,7 @@ namespace mROA.Implementation
public class CancellationRepository : ICancellationRepository public class CancellationRepository : ICancellationRepository
{ {
private Dictionary<Guid, CancellationTokenSource> _cancellations = new(); private Dictionary<Guid, CancellationTokenSource> _cancellations = new();
public void RegisterCancellation(Guid id, CancellationTokenSource cts) public void RegisterCancellation(Guid id, CancellationTokenSource cts)
{ {
_cancellations.TryAdd(id, cts); _cancellations.TryAdd(id, cts);
@@ -25,7 +26,6 @@ namespace mROA.Implementation
public void Inject<T>(T dependency) public void Inject<T>(T dependency)
{ {
} }
} }
} }
@@ -7,11 +7,13 @@ namespace mROA.Implementation
{ {
public int ContextId; public int ContextId;
public int OwnerId; public int OwnerId;
public ComplexObjectIdentifier(int contextId, int ownerId) public ComplexObjectIdentifier(int contextId, int ownerId)
{ {
ContextId = contextId; ContextId = contextId;
OwnerId = ownerId; OwnerId = ownerId;
} }
public static ComplexObjectIdentifier Singleton(int ownerId) => new() { ContextId = -1, OwnerId = ownerId }; public static ComplexObjectIdentifier Singleton(int ownerId) => new() { ContextId = -1, OwnerId = ownerId };
public static ComplexObjectIdentifier Null = new ComplexObjectIdentifier { ContextId = -2, OwnerId = 0 }; public static ComplexObjectIdentifier Null = new ComplexObjectIdentifier { ContextId = -2, OwnerId = 0 };
@@ -20,6 +22,7 @@ namespace mROA.Implementation
public int ClientId => Math.Abs(OwnerId); public int ClientId => Math.Abs(OwnerId);
public bool IsSererStored => OwnerId > 0; public bool IsSererStored => OwnerId > 0;
public bool IsClientStored => OwnerId < 0; public bool IsClientStored => OwnerId < 0;
public override string ToString() public override string ToString()
{ {
return $"{{ {nameof(ContextId)}: {ContextId}, {nameof(OwnerId)}: {OwnerId} }}"; return $"{{ {nameof(ContextId)}: {ContextId}, {nameof(OwnerId)}: {OwnerId} }}";
+1
View File
@@ -18,6 +18,7 @@ namespace mROA.Implementation
{ {
return null; return null;
} }
return _array[index]; return _array[index];
} }
@@ -42,7 +42,8 @@ namespace mROA.Implementation.Frontend
var welcomeMessage = _interactionModule.GetNextMessageReceiving().GetAwaiter().GetResult(); var welcomeMessage = _interactionModule.GetNextMessageReceiving().GetAwaiter().GetResult();
if (welcomeMessage.SchemaId != MessageType.IdAssigning) if (welcomeMessage.SchemaId != MessageType.IdAssigning)
{ {
throw new Exception($"Incorrect message type. Must be IdAssigning, current : {welcomeMessage.SchemaId.ToString()}"); throw new Exception(
$"Incorrect message type. Must be IdAssigning, current : {welcomeMessage.SchemaId.ToString()}");
} }
+10 -1
View File
@@ -1,5 +1,6 @@
using System; using System;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
// ReSharper disable UnusedMember.Global // ReSharper disable UnusedMember.Global
namespace mROA.Implementation namespace mROA.Implementation
@@ -7,6 +8,7 @@ namespace mROA.Implementation
public class NetworkMessage public class NetworkMessage
{ {
public Guid Id { get; set; } public Guid Id { get; set; }
[JsonConverter(typeof(JsonStringEnumConverter))] [JsonConverter(typeof(JsonStringEnumConverter))]
public MessageType SchemaId { get; set; } public MessageType SchemaId { get; set; }
@@ -15,6 +17,13 @@ namespace mROA.Implementation
public enum MessageType public enum MessageType
{ {
Unknown, FinishedCommandExecution, ExceptionCommandExecution, AsyncCommandExecution, CallRequest, IdAssigning, CancelRequest, EventRequest Unknown,
FinishedCommandExecution,
ExceptionCommandExecution,
AsyncCommandExecution,
CallRequest,
IdAssigning,
CancelRequest,
EventRequest
} }
} }
+1
View File
@@ -36,6 +36,7 @@ namespace mROA
return totalRead; return totalRead;
} }
} }
return totalRead; return totalRead;
} }
} }
+2 -2
View File
@@ -17,7 +17,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants /> <DefineConstants/>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
@@ -25,7 +25,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="System.Text.Json" Version="9.0.2" /> <PackageReference Include="System.Text.Json" Version="9.0.2"/>
</ItemGroup> </ItemGroup>
</Project> </Project>