начало реализации модулей фронтенда

This commit is contained in:
2025-01-27 12:56:07 +03:00
parent 66c78b158f
commit fe111af2f3
15 changed files with 36 additions and 174 deletions
-50
View File
@@ -1,50 +0,0 @@
// using System.Diagnostics;
// using System.Reflection;
// using mROA.Implementation;
// using mROA.Test;
//
// namespace mROA.Performance;
//
// class Program
// {
// private static ProgramlyInteractionChanel _interactionModule;
// private static ISerialisationModule _serialisationModule;
// private static IExecuteModule _executeModule;
// private static IMethodRepository _methodRepository;
// private static IContextRepository _contextRepository;
//
// static void Main(string[] args)
// {
// _interactionModule = new ProgramlyInteractionChanel();
// _serialisationModule = new JsonSerialisationModule(_interactionModule);
// var repo = new MethodRepository();
// repo.CollectForAssembly(Assembly.GetAssembly(typeof(ITestController)));
// _methodRepository = repo;
// var repo2 = new ContextRepository();
// repo2.FillSingletons(Assembly.GetAssembly(typeof(ITestController)));
// _contextRepository = repo2;
//
// _executeModule = new PrepairedExecutionModule(_methodRepository, _serialisationModule, _contextRepository);
// var sw = Stopwatch.StartNew();
//
// _interactionModule.PassCommand(132, """
// {
// "RequestTypeId": 0,
// "CommandId": 3
// }
// """);
// while (_interactionModule.OutputBuffer.Count != 2) ;
//
//
// // _interactionModule.PassCommand(132, """
// // {
// // "RequestTypeId": 0,
// // "CommandId": 3
// // }
// // """);
// // while (_interactionModule.OutputBuffer.Count() != 4) ;
//
// var time = sw.Elapsed;
// Console.WriteLine(time.TotalMilliseconds.ToString());
// }
// }
-15
View File
@@ -1,15 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\mROA.Test\mROA.Test.csproj" />
<ProjectReference Include="..\mROA\mROA.csproj" />
</ItemGroup>
</Project>
@@ -1,23 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("mROA.Performance")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9128f3f6ee0d3c89e7e0538ac244a133c746e4df")]
[assembly: System.Reflection.AssemblyProductAttribute("mROA.Performance")]
[assembly: System.Reflection.AssemblyTitleAttribute("mROA.Performance")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Создано классом WriteCodeFragment MSBuild.
@@ -1,15 +0,0 @@
is_global = true
build_property.TargetFramework = net9.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = mROA.Performance
build_property.ProjectDir = C:\Users\Mimm\Projects\VisualStudioProjects\mROA\mROA.Performance\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.EffectiveAnalysisLevelStyle = 9.0
build_property.EnableCodeStyleSeverity =
@@ -1,8 +0,0 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;
@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Mikhail\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\Mikhail\.nuget\packages\" />
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
</ItemGroup>
</Project>
@@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
+4 -4
View File
@@ -5,12 +5,12 @@
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Mikhail\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Mimm\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.0</NuGetToolVersion>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.10.1</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\Mikhail\.nuget\packages\" />
<SourceRoot Include="C:\Users\Mimm\.nuget\packages\" />
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
</ItemGroup>
<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')" />
</ImportGroup>
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<PkgNUnit_Analyzers Condition=" '$(PkgNUnit_Analyzers)' == '' ">C:\Users\Mikhail\.nuget\packages\nunit.analyzers\4.6.0</PkgNUnit_Analyzers>
<PkgNUnit_Analyzers Condition=" '$(PkgNUnit_Analyzers)' == '' ">C:\Users\Mimm\.nuget\packages\nunit.analyzers\4.6.0</PkgNUnit_Analyzers>
</PropertyGroup>
</Project>
-6
View File
@@ -4,8 +4,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mROA", "mROA\mROA.csproj",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mROA.Test", "mROA.Test\mROA.Test.csproj", "{D0E5760B-BB6E-453A-B396-A972CD94F133}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mROA.Performance", "mROA.Performance\mROA.Performance.csproj", "{F17AC915-A299-4D81-BEA0-E540E1918857}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -20,9 +18,5 @@ Global
{D0E5760B-BB6E-453A-B396-A972CD94F133}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D0E5760B-BB6E-453A-B396-A972CD94F133}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D0E5760B-BB6E-453A-B396-A972CD94F133}.Release|Any CPU.Build.0 = Release|Any CPU
{F17AC915-A299-4D81-BEA0-E540E1918857}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F17AC915-A299-4D81-BEA0-E540E1918857}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F17AC915-A299-4D81-BEA0-E540E1918857}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F17AC915-A299-4D81-BEA0-E540E1918857}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
+2 -2
View File
@@ -3,6 +3,6 @@ namespace mROA;
public interface ICommandExecution
{
Guid CallRequestId { get; init; }
int ClientId { get; set; }
int CommandId { get; set; }
int ClientId { get; }
int CommandId { get; }
}
+1 -1
View File
@@ -9,7 +9,7 @@ public interface ISerialisationModule
void SetExecuteModule(IExecuteModule executeModule);
public interface IFrontendSerialisationModule
{
ICommandExecution GetNextCommandExecution(Guid requestId);
ICommandExecution GetNextCommandExecution<T>(Guid requestId) where T : ICommandExecution;
void PostCallRequest(ICallRequest callRequest);
}
}
-25
View File
@@ -17,28 +17,3 @@ public class JsonCallRequest : ICallRequest
public int ObjectId { get; set; } = -1;
public object? Parameter { get; set; }
}
// public struct HardCallRequest : ICallRequest
// {
// public Guid CallRequestId { get; } = Guid.NewGuid();
// public int CommandId => Command;
// public int ClientId => Client;
// public int ObjectId => Object;
//
// public int Command;
// public int Client;
// public int Object;
// public object Parameter { get; set; }
//
// }
// public class CallRequest : SingletonCallRequest
// {
// public override int RequestTypeId => (int)RequestType.NonParametrized;
// public int ObjectId { get; set; }
// }
//
// public class ParametrizedCallRequest : CallRequest
// {
// public override int RequestTypeId => (int)RequestType.Parametrized;
// public object Parameter { get; set; }
// }
@@ -1,16 +1,22 @@
using System.Text;
using System.Text.Json;
using System.Windows.Input;
namespace mROA.Implementation;
public class JsonFrontendSerialisationModule : ISerialisationModule.IFrontendSerialisationModule
public class JsonFrontendSerialisationModule(IInteractionModule.IFrontendInteractionModule interactionModule)
: ISerialisationModule.IFrontendSerialisationModule
{
public ICommandExecution GetNextCommandExecution(Guid requestId)
public ICommandExecution GetNextCommandExecution<T>(Guid requestId) where T : ICommandExecution
{
return null;
var receiveMessage = interactionModule.ReceiveMessage();
var parsed = JsonSerializer.Deserialize<T>(receiveMessage);
return parsed;
}
public void PostCallRequest(ICallRequest callRequest)
{
var post = JsonSerializer.Serialize(callRequest, callRequest.GetType());
interactionModule.PostMessage(Encoding.UTF8.GetBytes(post));
}
}
@@ -0,0 +1,16 @@
using System.Text;
namespace mROA.Implementation;
public class ConsoleFrontendInteractionModule : IInteractionModule.IFrontendInteractionModule
{
public byte[] ReceiveMessage()
{
}
public void PostMessage(byte[] message)
{
Console.WriteLine(Encoding.UTF8.GetString(message));
}
}
+3 -3
View File
@@ -5,12 +5,12 @@
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Mikhail\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Mimm\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.0</NuGetToolVersion>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.10.1</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\Mikhail\.nuget\packages\" />
<SourceRoot Include="C:\Users\Mimm\.nuget\packages\" />
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
</ItemGroup>
</Project>