начало задачи о зависимостях

This commit is contained in:
2025-02-05 09:55:06 +03:00
parent ad2ef8e4b7
commit fd1eda2661
26 changed files with 109 additions and 135 deletions
@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("mROA.Codegen")] [assembly: System.Reflection.AssemblyCompanyAttribute("mROA.Codegen")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f3ece97ebf7746e8d4439601aab0ec75815f30cf")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ad2ef8e4b754b4cb2c5d3dbaa5c24f15201dd0f9")]
[assembly: System.Reflection.AssemblyProductAttribute("mROA.Codegen")] [assembly: System.Reflection.AssemblyProductAttribute("mROA.Codegen")]
[assembly: System.Reflection.AssemblyTitleAttribute("mROA.Codegen")] [assembly: System.Reflection.AssemblyTitleAttribute("mROA.Codegen")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -5,18 +5,18 @@
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool> <RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile> <ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot> <NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Mimm\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders> <NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Mikhail\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle> <NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.0</NuGetToolVersion> <NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.0</NuGetToolVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' "> <ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\Mimm\.nuget\packages\" /> <SourceRoot Include="C:\Users\Mikhail\.nuget\packages\" />
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" /> <SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
</ItemGroup> </ItemGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' "> <ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)microsoft.codeanalysis.analyzers\3.3.4\buildTransitive\Microsoft.CodeAnalysis.Analyzers.props" Condition="Exists('$(NuGetPackageRoot)microsoft.codeanalysis.analyzers\3.3.4\buildTransitive\Microsoft.CodeAnalysis.Analyzers.props')" /> <Import Project="$(NuGetPackageRoot)microsoft.codeanalysis.analyzers\3.3.4\buildTransitive\Microsoft.CodeAnalysis.Analyzers.props" Condition="Exists('$(NuGetPackageRoot)microsoft.codeanalysis.analyzers\3.3.4\buildTransitive\Microsoft.CodeAnalysis.Analyzers.props')" />
</ImportGroup> </ImportGroup>
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' "> <PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<PkgMicrosoft_CodeAnalysis_Analyzers Condition=" '$(PkgMicrosoft_CodeAnalysis_Analyzers)' == '' ">C:\Users\Mimm\.nuget\packages\microsoft.codeanalysis.analyzers\3.3.4</PkgMicrosoft_CodeAnalysis_Analyzers> <PkgMicrosoft_CodeAnalysis_Analyzers Condition=" '$(PkgMicrosoft_CodeAnalysis_Analyzers)' == '' ">C:\Users\Mikhail\.nuget\packages\microsoft.codeanalysis.analyzers\3.3.4</PkgMicrosoft_CodeAnalysis_Analyzers>
</PropertyGroup> </PropertyGroup>
</Project> </Project>
+13 -1
View File
@@ -1,5 +1,7 @@
using System.Runtime.InteropServices;
using mROA.Codegen; using mROA.Codegen;
using mROA.Implementation.Test;
namespace mROA.Example; namespace mROA.Example;
@@ -7,7 +9,17 @@ public class MainX
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
CoCodegenMethodRepository a = new CoCodegenMethodRepository(); // CoCodegenMethodRepository a = new CoCodegenMethodRepository();
unsafe
{
}
}
public unsafe byte[] Convert<T>(T input)
{
var size = Marshal.SizeOf(typeof(T));
var place = Marshal.AllocHGlobal(size);
var pt = (T*)place;
} }
} }
+1
View File
@@ -5,6 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("mROA.Example")] [assembly: System.Reflection.AssemblyCompanyAttribute("mROA.Example")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f3ece97ebf7746e8d4439601aab0ec75815f30cf")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ad2ef8e4b754b4cb2c5d3dbaa5c24f15201dd0f9")]
[assembly: System.Reflection.AssemblyProductAttribute("mROA.Example")] [assembly: System.Reflection.AssemblyProductAttribute("mROA.Example")]
[assembly: System.Reflection.AssemblyTitleAttribute("mROA.Example")] [assembly: System.Reflection.AssemblyTitleAttribute("mROA.Example")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -5,12 +5,12 @@
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool> <RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile> <ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot> <NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Mimm\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders> <NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Mikhail\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle> <NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.0</NuGetToolVersion> <NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.0</NuGetToolVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' "> <ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\Mimm\.nuget\packages\" /> <SourceRoot Include="C:\Users\Mikhail\.nuget\packages\" />
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" /> <SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
</ItemGroup> </ItemGroup>
</Project> </Project>
@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("mROA.Test")] [assembly: System.Reflection.AssemblyCompanyAttribute("mROA.Test")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2fac34a1ceac82d71c748b1421917d8fc2a60fa7")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ad2ef8e4b754b4cb2c5d3dbaa5c24f15201dd0f9")]
[assembly: System.Reflection.AssemblyProductAttribute("mROA.Test")] [assembly: System.Reflection.AssemblyProductAttribute("mROA.Test")]
[assembly: System.Reflection.AssemblyTitleAttribute("mROA.Test")] [assembly: System.Reflection.AssemblyTitleAttribute("mROA.Test")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
+3 -3
View File
@@ -5,12 +5,12 @@
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool> <RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile> <ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot> <NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Mimm\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders> <NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Mikhail\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle> <NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.0</NuGetToolVersion> <NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.0</NuGetToolVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' "> <ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\Mimm\.nuget\packages\" /> <SourceRoot Include="C:\Users\Mikhail\.nuget\packages\" />
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" /> <SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
</ItemGroup> </ItemGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' "> <ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
@@ -21,6 +21,6 @@
<Import Project="$(NuGetPackageRoot)microsoft.net.test.sdk\17.12.0\build\netcoreapp3.1\Microsoft.NET.Test.Sdk.props" Condition="Exists('$(NuGetPackageRoot)microsoft.net.test.sdk\17.12.0\build\netcoreapp3.1\Microsoft.NET.Test.Sdk.props')" /> <Import Project="$(NuGetPackageRoot)microsoft.net.test.sdk\17.12.0\build\netcoreapp3.1\Microsoft.NET.Test.Sdk.props" Condition="Exists('$(NuGetPackageRoot)microsoft.net.test.sdk\17.12.0\build\netcoreapp3.1\Microsoft.NET.Test.Sdk.props')" />
</ImportGroup> </ImportGroup>
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' "> <PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<PkgNUnit_Analyzers Condition=" '$(PkgNUnit_Analyzers)' == '' ">C:\Users\Mimm\.nuget\packages\nunit.analyzers\4.6.0</PkgNUnit_Analyzers> <PkgNUnit_Analyzers Condition=" '$(PkgNUnit_Analyzers)' == '' ">C:\Users\Mikhail\.nuget\packages\nunit.analyzers\4.6.0</PkgNUnit_Analyzers>
</PropertyGroup> </PropertyGroup>
</Project> </Project>
+2 -1
View File
@@ -1,8 +1,9 @@
using mROA.Abstract;
using mROA.Implementation; using mROA.Implementation;
namespace mROA; namespace mROA;
public interface IExecuteModule public interface IExecuteModule : IInjectableModule
{ {
ICommandExecution Execute(ICallRequest command); ICommandExecution Execute(ICallRequest command);
} }
+6
View File
@@ -0,0 +1,6 @@
namespace mROA.Abstract;
public interface IInjectableModule
{
public void Inject<T>(T dependency);
}
+3 -1
View File
@@ -1,6 +1,8 @@
using mROA.Abstract;
namespace mROA; namespace mROA;
public interface IInteractionModule public interface IInteractionModule : IInjectableModule
{ {
void SetMessageHandler(Action<int, byte[]> handler); void SetMessageHandler(Action<int, byte[]> handler);
void SendTo(int clientId, byte[] message); void SendTo(int clientId, byte[] message);
+3 -3
View File
@@ -1,16 +1,16 @@
using mROA.Abstract;
using mROA.Implementation; using mROA.Implementation;
namespace mROA; namespace mROA;
public interface ISerialisationModule public interface ISerialisationModule : IInjectableModule
{ {
void HandleIncomingRequest(int clientId, byte[] command); void HandleIncomingRequest(int clientId, byte[] command);
void PostResponse(ICommandExecution call); void PostResponse(ICommandExecution call);
void SetExecuteModule(IExecuteModule executeModule);
public interface IFrontendSerialisationModule public interface IFrontendSerialisationModule
{ {
Task<T> GetNextCommandExecution<T>(Guid requestId) where T : ICommandExecution; Task<T> GetNextCommandExecution<T>(Guid requestId) where T : ICommandExecution;
Task<FinalCommandExecution> GetFinalCommandExecution<T>(Guid requestId); Task<FinalCommandExecution<T>> GetFinalCommandExecution<T>(Guid requestId);
void PostCallRequest(ICallRequest callRequest); void PostCallRequest(ICallRequest callRequest);
} }
@@ -6,17 +6,16 @@ namespace mROA.Implementation;
public class JsonSerialisationModule : ISerialisationModule public class JsonSerialisationModule : ISerialisationModule
{ {
private readonly IInteractionModule _dataSource; private IInteractionModule _dataSource;
private IExecuteModule _executeModule; private IExecuteModule _executeModule;
private IMethodRepository _methodRepository; private IMethodRepository _methodRepository;
public JsonSerialisationModule(IInteractionModule dataSource, IMethodRepository methodRepository) // public JsonSerialisationModule(IInteractionModule dataSource, IMethodRepository methodRepository)
{ // {
_dataSource = dataSource; // _dataSource = dataSource;
_methodRepository = methodRepository; // _methodRepository = methodRepository;
_dataSource.SetMessageHandler(HandleIncomingRequest); // _dataSource.SetMessageHandler(HandleIncomingRequest);
} // }
public void SetExecuteModule(IExecuteModule executeModule) => _executeModule = executeModule;
public void HandleIncomingRequest(int clientId, byte[] command) public void HandleIncomingRequest(int clientId, byte[] command)
{ {
@@ -46,4 +45,14 @@ public class JsonSerialisationModule : ISerialisationModule
var binary = Encoding.UTF8.GetBytes(texted); var binary = Encoding.UTF8.GetBytes(texted);
_dataSource.SendTo(call.ClientId, binary); _dataSource.SendTo(call.ClientId, binary);
} }
public void Inject<T>(T dependency)
{
if (dependency is IInteractionModule interactionModule)
_dataSource = interactionModule;
if (dependency is IExecuteModule executeModule)
_executeModule = executeModule;
if (dependency is IMethodRepository methodRepository)
_methodRepository = methodRepository;
}
} }
@@ -15,7 +15,7 @@ public class NetworkGatewayModule : IGatewayModule
public void Configure(IInteractionModule interactionModule) public void Configure(IInteractionModule interactionModule)
{ {
interactionModule = interactionModule; _interactionModule = interactionModule;
} }
public void Run() public void Run()
@@ -48,4 +48,9 @@ public class StreamBasedInteractionModule : IInteractionModule
_streams.Remove(client.id); _streams.Remove(client.id);
} }
} }
public void Inject<T>(T dependency)
{
throw new NotImplementedException();
}
} }
+10 -1
View File
@@ -9,7 +9,16 @@ public class FinalCommandExecution : ICommandExecution
public int ClientId { get; set; } public int ClientId { get; set; }
[JsonIgnore] [JsonIgnore]
public int CommandId { get; set; } public int CommandId { get; set; }
public object? Result { get; set; } }
public class FinalCommandExecution<T> : FinalCommandExecution
{
public T? Result { get; set; }
}
public class TypedFinalCommandExecution : FinalCommandExecution<object>
{
public Type Type { get; set; }
} }
public class ExeptionCommandExecution : ICommandExecution public class ExeptionCommandExecution : ICommandExecution
@@ -0,0 +1,12 @@
namespace mROA.Implementation;
public class FrontendServiceBuilder
{
protected IInteractionModule.IFrontendInteractionModule _interactionModule;
protected ISerialisationModule.IFrontendSerialisationModule _serialisationModule;
public ISerialisationModule.IFrontendSerialisationModule Build()
{
return _serialisationModule;
}
}
@@ -18,14 +18,14 @@ public class JsonFrontendSerialisationModule(IInteractionModule.IFrontendInterac
return parsed; return parsed;
} }
public async Task<FinalCommandExecution> GetFinalCommandExecution<T>(Guid requestId) public async Task<FinalCommandExecution<T>> GetFinalCommandExecution<T>(Guid requestId)
{ {
var receiveMessage = await interactionModule.ReceiveMessage(); var receiveMessage = await interactionModule.ReceiveMessage();
var parsed = JsonSerializer.Deserialize<FinalCommandExecution>(receiveMessage); var parsed = JsonSerializer.Deserialize<FinalCommandExecution<T>>(receiveMessage);
while (parsed.CallRequestId != requestId) while (parsed.CallRequestId != requestId)
{ {
receiveMessage = await interactionModule.ReceiveMessage(); receiveMessage = await interactionModule.ReceiveMessage();
parsed = JsonSerializer.Deserialize<FinalCommandExecution>(receiveMessage); parsed = JsonSerializer.Deserialize<FinalCommandExecution<T>>(receiveMessage);
} }
parsed.Result = parsed.Result! is JsonElement e ? e.Deserialize<T>() : (T)parsed.Result!; parsed.Result = parsed.Result! is JsonElement e ? e.Deserialize<T>() : (T)parsed.Result!;
return parsed; return parsed;
@@ -4,18 +4,18 @@ namespace mROA.Implementation;
public class LaunchReadyExecutionModule : IExecuteModule public class LaunchReadyExecutionModule : IExecuteModule
{ {
private readonly IMethodRepository _methodRepo; private IMethodRepository _methodRepo;
private readonly ISerialisationModule _serialisationModule; private ISerialisationModule _serialisationModule;
private readonly IContextRepository _contextRepo; private IContextRepository _contextRepo;
public LaunchReadyExecutionModule(IMethodRepository methodRepo, public void Inject<T>(T dependency)
ISerialisationModule serialisationModule,
IContextRepository contextRepo)
{ {
_methodRepo = methodRepo; if (dependency is IMethodRepository methodRepo)
_serialisationModule = serialisationModule; _methodRepo = methodRepo;
_contextRepo = contextRepo; if (dependency is ISerialisationModule serialisationModule)
_serialisationModule.SetExecuteModule(this); _serialisationModule = serialisationModule;
if (dependency is IContextRepository contextRepo)
_contextRepo = contextRepo;
} }
public ICommandExecution Execute(ICallRequest command) public ICommandExecution Execute(ICallRequest command)
@@ -43,10 +43,11 @@ public class LaunchReadyExecutionModule : IExecuteModule
ICallRequest command) ICallRequest command)
{ {
var finalResult = currentCommand.Invoke(context, parameter is null ? [] : [parameter]); var finalResult = currentCommand.Invoke(context, parameter is null ? [] : [parameter]);
return new FinalCommandExecution return new TypedFinalCommandExecution
{ {
CommandId = command.CommandId, Result = finalResult, CommandId = command.CommandId, Result = finalResult,
CallRequestId = command.CallRequestId CallRequestId = command.CallRequestId,
Type = currentCommand.ReturnType
}; };
} }
@@ -87,12 +88,13 @@ public class LaunchReadyExecutionModule : IExecuteModule
private void PostFinalizedCallback(AsyncCommandExecution request, object? result) private void PostFinalizedCallback(AsyncCommandExecution request, object? result)
{ {
_serialisationModule.PostResponse(new FinalCommandExecution _serialisationModule.PostResponse(new TypedFinalCommandExecution
{ {
CallRequestId = request.CallRequestId, CallRequestId = request.CallRequestId,
Result = result, Result = result,
CommandId = request.CommandId, CommandId = request.CommandId,
ClientId = request.ClientId ClientId = request.ClientId,
Type = typeof(object)
}); });
} }
} }
@@ -1,16 +0,0 @@
namespace mROA.Implementation.Test;
public class MockExecModule : IExecuteModule
{
public ICommandExecution Execute(ICallRequest command)
{
return new FinalCommandExecution
{ CommandId = command.CommandId, Result = new MockResult { A = "wqer", B = 5 }, CallRequestId = command.CallRequestId };
}
}
public class MockResult
{
public string A { get; set; }
public int B { get; set; }
}
@@ -1,25 +0,0 @@
using System.Reflection;
namespace mROA.Implementation.Test;
public class MockMethodRepository : IMethodRepository
{
public MethodInfo GetMethod(int id)
{
return GetType().GetMethod("MockMethod")!;
}
public int RegisterMethod(MethodInfo method)
{
return 0;
}
public IEnumerable<MethodInfo> GetMethods()
{
return [GetType().GetMethod("MockMethod")!];
}
private void MockMethod(object x)
{
}
}
@@ -1,19 +0,0 @@
namespace mROA.Implementation;
public class MockSerializationModule : ISerialisationModule
{
public void HandleIncomingRequest(int clientId, byte[] command)
{
}
public void PostResponse(ICommandExecution call)
{
}
public void SetExecuteModule(IExecuteModule executeModule)
{
}
}
@@ -1,25 +0,0 @@
namespace mROA.Implementation;
public class ProgramlyInteractionChanel : IInteractionModule
{
public void PassCommand(int clientId, byte[] message) => _handler(clientId, message);
private Action<int, byte[]> _handler;
public List<string> OutputBuffer = new List<string>();
public void SetMessageHandler(Action<int, byte[]> handler)
{
_handler = handler;
}
public void SendTo(int clientId, byte[] message)
{
Console.WriteLine("{0}: {1}", clientId, System.Text.Encoding.UTF8.GetString(message));
OutputBuffer.Add(System.Text.Encoding.UTF8.GetString(message));
}
public void RegisterSourse(Stream stream)
{
throw new NotImplementedException();
}
}
+1 -1
View File
@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("mROA")] [assembly: System.Reflection.AssemblyCompanyAttribute("mROA")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f3ece97ebf7746e8d4439601aab0ec75815f30cf")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ad2ef8e4b754b4cb2c5d3dbaa5c24f15201dd0f9")]
[assembly: System.Reflection.AssemblyProductAttribute("mROA")] [assembly: System.Reflection.AssemblyProductAttribute("mROA")]
[assembly: System.Reflection.AssemblyTitleAttribute("mROA")] [assembly: System.Reflection.AssemblyTitleAttribute("mROA")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -8,7 +8,7 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules = build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = mROA build_property.RootNamespace = mROA
build_property.ProjectDir = C:\Users\Mimm\Projects\VisualStudioProjects\mROA\mROA\ build_property.ProjectDir = C:\Users\Mikhail\Projects\VisualStudioProjects\mROA\mROA\
build_property.EnableComHosting = build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop = build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.EffectiveAnalysisLevelStyle = 9.0 build_property.EffectiveAnalysisLevelStyle = 9.0
+2 -2
View File
@@ -5,12 +5,12 @@
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool> <RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile> <ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot> <NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Mimm\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders> <NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Mikhail\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle> <NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.0</NuGetToolVersion> <NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.0</NuGetToolVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' "> <ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\Mimm\.nuget\packages\" /> <SourceRoot Include="C:\Users\Mikhail\.nuget\packages\" />
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" /> <SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
</ItemGroup> </ItemGroup>
</Project> </Project>