From fe111af2f32bdaf7c05c86c1d166c3a85002e343 Mon Sep 17 00:00:00 2001 From: Mikhail Mitrofanov Date: Mon, 27 Jan 2025 12:56:07 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BD=D0=B0=D1=87=D0=B0=D0=BB=D0=BE=20=D1=80?= =?UTF-8?q?=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BC?= =?UTF-8?q?=D0=BE=D0=B4=D1=83=D0=BB=D0=B5=D0=B9=20=D1=84=D1=80=D0=BE=D0=BD?= =?UTF-8?q?=D1=82=D0=B5=D0=BD=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mROA.Performance/Program.cs | 50 ------------------- mROA.Performance/mROA.Performance.csproj | 15 ------ .../net9.0/mROA.Performance.AssemblyInfo.cs | 23 --------- ....GeneratedMSBuildEditorConfig.editorconfig | 15 ------ .../net9.0/mROA.Performance.GlobalUsings.g.cs | 8 --- .../obj/mROA.Performance.csproj.nuget.g.props | 16 ------ .../mROA.Performance.csproj.nuget.g.targets | 2 - mROA.Test/obj/mROA.Test.csproj.nuget.g.props | 8 +-- mROA.sln | 6 --- mROA/Abstract/ICommandExecution.cs | 4 +- mROA/Abstract/ISerialisationModule.cs | 2 +- mROA/Implementation/CallRequest.cs | 25 ---------- .../JsonFrontendSerialisationModule.cs | 14 ++++-- .../Test/ConsoleFrontendInteractionModule.cs | 16 ++++++ mROA/obj/mROA.csproj.nuget.g.props | 6 +-- 15 files changed, 36 insertions(+), 174 deletions(-) delete mode 100644 mROA.Performance/Program.cs delete mode 100644 mROA.Performance/mROA.Performance.csproj delete mode 100644 mROA.Performance/obj/Release/net9.0/mROA.Performance.AssemblyInfo.cs delete mode 100644 mROA.Performance/obj/Release/net9.0/mROA.Performance.GeneratedMSBuildEditorConfig.editorconfig delete mode 100644 mROA.Performance/obj/Release/net9.0/mROA.Performance.GlobalUsings.g.cs delete mode 100644 mROA.Performance/obj/mROA.Performance.csproj.nuget.g.props delete mode 100644 mROA.Performance/obj/mROA.Performance.csproj.nuget.g.targets create mode 100644 mROA/Implementation/Test/ConsoleFrontendInteractionModule.cs diff --git a/mROA.Performance/Program.cs b/mROA.Performance/Program.cs deleted file mode 100644 index 6cbe8ed..0000000 --- a/mROA.Performance/Program.cs +++ /dev/null @@ -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()); -// } -// } \ No newline at end of file diff --git a/mROA.Performance/mROA.Performance.csproj b/mROA.Performance/mROA.Performance.csproj deleted file mode 100644 index ba70544..0000000 --- a/mROA.Performance/mROA.Performance.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - Exe - net9.0 - enable - enable - - - - - - - - diff --git a/mROA.Performance/obj/Release/net9.0/mROA.Performance.AssemblyInfo.cs b/mROA.Performance/obj/Release/net9.0/mROA.Performance.AssemblyInfo.cs deleted file mode 100644 index ae5fb80..0000000 --- a/mROA.Performance/obj/Release/net9.0/mROA.Performance.AssemblyInfo.cs +++ /dev/null @@ -1,23 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Этот код создан программой. -// Исполняемая версия:4.0.30319.42000 -// -// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае -// повторной генерации кода. -// -//------------------------------------------------------------------------------ - -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. - diff --git a/mROA.Performance/obj/Release/net9.0/mROA.Performance.GeneratedMSBuildEditorConfig.editorconfig b/mROA.Performance/obj/Release/net9.0/mROA.Performance.GeneratedMSBuildEditorConfig.editorconfig deleted file mode 100644 index 7493786..0000000 --- a/mROA.Performance/obj/Release/net9.0/mROA.Performance.GeneratedMSBuildEditorConfig.editorconfig +++ /dev/null @@ -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 = diff --git a/mROA.Performance/obj/Release/net9.0/mROA.Performance.GlobalUsings.g.cs b/mROA.Performance/obj/Release/net9.0/mROA.Performance.GlobalUsings.g.cs deleted file mode 100644 index 8578f3d..0000000 --- a/mROA.Performance/obj/Release/net9.0/mROA.Performance.GlobalUsings.g.cs +++ /dev/null @@ -1,8 +0,0 @@ -// -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; diff --git a/mROA.Performance/obj/mROA.Performance.csproj.nuget.g.props b/mROA.Performance/obj/mROA.Performance.csproj.nuget.g.props deleted file mode 100644 index 721d876..0000000 --- a/mROA.Performance/obj/mROA.Performance.csproj.nuget.g.props +++ /dev/null @@ -1,16 +0,0 @@ - - - - True - NuGet - $(MSBuildThisFileDirectory)project.assets.json - $(UserProfile)\.nuget\packages\ - C:\Users\Mikhail\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages - PackageReference - 6.12.0 - - - - - - \ No newline at end of file diff --git a/mROA.Performance/obj/mROA.Performance.csproj.nuget.g.targets b/mROA.Performance/obj/mROA.Performance.csproj.nuget.g.targets deleted file mode 100644 index 3dc06ef..0000000 --- a/mROA.Performance/obj/mROA.Performance.csproj.nuget.g.targets +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/mROA.Test/obj/mROA.Test.csproj.nuget.g.props b/mROA.Test/obj/mROA.Test.csproj.nuget.g.props index 92a05d6..3598713 100644 --- a/mROA.Test/obj/mROA.Test.csproj.nuget.g.props +++ b/mROA.Test/obj/mROA.Test.csproj.nuget.g.props @@ -5,12 +5,12 @@ NuGet $(MSBuildThisFileDirectory)project.assets.json $(UserProfile)\.nuget\packages\ - C:\Users\Mikhail\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages + C:\Users\Mimm\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages PackageReference - 6.12.0 + 6.10.1 - + @@ -21,6 +21,6 @@ - C:\Users\Mikhail\.nuget\packages\nunit.analyzers\4.6.0 + C:\Users\Mimm\.nuget\packages\nunit.analyzers\4.6.0 \ No newline at end of file diff --git a/mROA.sln b/mROA.sln index d7216fd..b65ee37 100644 --- a/mROA.sln +++ b/mROA.sln @@ -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 diff --git a/mROA/Abstract/ICommandExecution.cs b/mROA/Abstract/ICommandExecution.cs index 23262cc..bee8e42 100644 --- a/mROA/Abstract/ICommandExecution.cs +++ b/mROA/Abstract/ICommandExecution.cs @@ -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; } } \ No newline at end of file diff --git a/mROA/Abstract/ISerialisationModule.cs b/mROA/Abstract/ISerialisationModule.cs index b246944..5a050b7 100644 --- a/mROA/Abstract/ISerialisationModule.cs +++ b/mROA/Abstract/ISerialisationModule.cs @@ -9,7 +9,7 @@ public interface ISerialisationModule void SetExecuteModule(IExecuteModule executeModule); public interface IFrontendSerialisationModule { - ICommandExecution GetNextCommandExecution(Guid requestId); + ICommandExecution GetNextCommandExecution(Guid requestId) where T : ICommandExecution; void PostCallRequest(ICallRequest callRequest); } } \ No newline at end of file diff --git a/mROA/Implementation/CallRequest.cs b/mROA/Implementation/CallRequest.cs index 15c3305..c9b6907 100644 --- a/mROA/Implementation/CallRequest.cs +++ b/mROA/Implementation/CallRequest.cs @@ -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; } -// } - diff --git a/mROA/Implementation/JsonFrontendSerialisationModule.cs b/mROA/Implementation/JsonFrontendSerialisationModule.cs index 8e56948..5f63f6f 100644 --- a/mROA/Implementation/JsonFrontendSerialisationModule.cs +++ b/mROA/Implementation/JsonFrontendSerialisationModule.cs @@ -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(Guid requestId) where T : ICommandExecution { - return null; + var receiveMessage = interactionModule.ReceiveMessage(); + var parsed = JsonSerializer.Deserialize(receiveMessage); + return parsed; } public void PostCallRequest(ICallRequest callRequest) { - + var post = JsonSerializer.Serialize(callRequest, callRequest.GetType()); + interactionModule.PostMessage(Encoding.UTF8.GetBytes(post)); } } \ No newline at end of file diff --git a/mROA/Implementation/Test/ConsoleFrontendInteractionModule.cs b/mROA/Implementation/Test/ConsoleFrontendInteractionModule.cs new file mode 100644 index 0000000..b59218b --- /dev/null +++ b/mROA/Implementation/Test/ConsoleFrontendInteractionModule.cs @@ -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)); + } +} \ No newline at end of file diff --git a/mROA/obj/mROA.csproj.nuget.g.props b/mROA/obj/mROA.csproj.nuget.g.props index 721d876..566ee42 100644 --- a/mROA/obj/mROA.csproj.nuget.g.props +++ b/mROA/obj/mROA.csproj.nuget.g.props @@ -5,12 +5,12 @@ NuGet $(MSBuildThisFileDirectory)project.assets.json $(UserProfile)\.nuget\packages\ - C:\Users\Mikhail\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages + C:\Users\Mimm\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages PackageReference - 6.12.0 + 6.10.1 - + \ No newline at end of file