From 2c2f55430288dd21fa7384243ca1ffb6cad7e60e Mon Sep 17 00:00:00 2001 From: Mikhail Mitrofanov Date: Wed, 5 Feb 2025 15:05:49 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=B8=D0=BC=D0=B5=D1=80=D1=8B=20?= =?UTF-8?q?=D0=BA=D0=BB=D0=B8=D0=B5=D0=BD=D1=82=D0=B0=20=D0=B8=20=D1=81?= =?UTF-8?q?=D0=B5=D1=80=D0=B2=D0=B5=D1=80=D0=B0=20=D0=BD=D0=B0=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=B0=D0=BD=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mROA.sln | 7 +++++ mROA/Abstract/IFrontendBridge.cs | 5 ++++ .../Backend/BasicConfigurationExtensions.cs | 25 +++++++++--------- .../{ServerBootstrap.cs => FullMixBuilder.cs} | 4 +-- .../Frontend/NetworkFrontendBridge.cs | 26 +++++++++++++++++++ mROA/obj/Debug/net9.0/mROA.AssemblyInfo.cs | 2 +- 6 files changed, 54 insertions(+), 15 deletions(-) create mode 100644 mROA/Abstract/IFrontendBridge.cs rename mROA/Implementation/Bootstrap/{ServerBootstrap.cs => FullMixBuilder.cs} (85%) create mode 100644 mROA/Implementation/Frontend/NetworkFrontendBridge.cs diff --git a/mROA.sln b/mROA.sln index f4b0faf..d7400ef 100644 --- a/mROA.sln +++ b/mROA.sln @@ -12,6 +12,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example.Backend", "Example. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example.Shared", "Example.Shared\Example.Shared.csproj", "{E7703F5B-F2A6-4A88-AA57-EBB1E38D533E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example.Frontend", "Example.Frontend\Example.Frontend.csproj", "{9BD25A13-3165-47C0-9EAA-5C59EC490E32}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -38,9 +40,14 @@ Global {E7703F5B-F2A6-4A88-AA57-EBB1E38D533E}.Debug|Any CPU.Build.0 = Debug|Any CPU {E7703F5B-F2A6-4A88-AA57-EBB1E38D533E}.Release|Any CPU.ActiveCfg = Release|Any CPU {E7703F5B-F2A6-4A88-AA57-EBB1E38D533E}.Release|Any CPU.Build.0 = Release|Any CPU + {9BD25A13-3165-47C0-9EAA-5C59EC490E32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9BD25A13-3165-47C0-9EAA-5C59EC490E32}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9BD25A13-3165-47C0-9EAA-5C59EC490E32}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9BD25A13-3165-47C0-9EAA-5C59EC490E32}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {A9BB364E-0BA6-40B9-A293-757BC48EFC06} = {EAE92F5A-664C-41AB-8811-5885524B5347} {E7703F5B-F2A6-4A88-AA57-EBB1E38D533E} = {EAE92F5A-664C-41AB-8811-5885524B5347} + {9BD25A13-3165-47C0-9EAA-5C59EC490E32} = {EAE92F5A-664C-41AB-8811-5885524B5347} EndGlobalSection EndGlobal diff --git a/mROA/Abstract/IFrontendBridge.cs b/mROA/Abstract/IFrontendBridge.cs new file mode 100644 index 0000000..adaa321 --- /dev/null +++ b/mROA/Abstract/IFrontendBridge.cs @@ -0,0 +1,5 @@ +namespace mROA.Abstract; + +public interface IFrontendBridge : IInjectableModule +{ +} \ No newline at end of file diff --git a/mROA/Implementation/Backend/BasicConfigurationExtensions.cs b/mROA/Implementation/Backend/BasicConfigurationExtensions.cs index 53709cd..e1ef4f3 100644 --- a/mROA/Implementation/Backend/BasicConfigurationExtensions.cs +++ b/mROA/Implementation/Backend/BasicConfigurationExtensions.cs @@ -6,35 +6,36 @@ namespace mROA.Implementation; public static class BasicConfigurationExtensions { - public static void UseJsonSerialisation(this ServerBootstrap bootstrap) + public static void UseJsonSerialisation(this FullMixBuilder builder) { - bootstrap.Modules.Add(new JsonSerialisationModule()); + builder.Modules.Add(new JsonSerialisationModule()); } - public static void UseNetworkGateway(this ServerBootstrap bootstrap, IPEndPoint endPoint) + public static void UseNetworkGateway(this FullMixBuilder builder, IPEndPoint endPoint) { - bootstrap.Modules.Add(new NetworkGatewayModule(endPoint)); + builder.Modules.Add(new NetworkGatewayModule(endPoint)); } - public static void UseStreamInteraction(this ServerBootstrap bootstrap) + public static void UseStreamInteraction(this FullMixBuilder builder) { - bootstrap.Modules.Add(new StreamBasedInteractionModule()); + builder.Modules.Add(new StreamBasedInteractionModule()); } - public static void UseBasicExecution(this ServerBootstrap bootstrap) + public static void UseBasicExecution(this FullMixBuilder builder) { - bootstrap.Modules.Add(new BasicExecutionModule()); + builder.Modules.Add(new BasicExecutionModule()); } - public static void UseCollectableContextRepository(this ServerBootstrap bootstrap, params Assembly[] assemblies) + public static void UseCollectableContextRepository(this FullMixBuilder builder, params Assembly[] assemblies) { var repo = new ContextRepository(); repo.FillSingletons(assemblies); - bootstrap.Modules.Add(repo); + TransmissionConfig.DefaultContextRepository = repo; + builder.Modules.Add(repo); } - public static void SetupMethodsRepository(this ServerBootstrap bootstrap, IMethodRepository methodRepository) + public static void SetupMethodsRepository(this FullMixBuilder builder, IMethodRepository methodRepository) { - bootstrap.Modules.Add(methodRepository); + builder.Modules.Add(methodRepository); } } \ No newline at end of file diff --git a/mROA/Implementation/Bootstrap/ServerBootstrap.cs b/mROA/Implementation/Bootstrap/FullMixBuilder.cs similarity index 85% rename from mROA/Implementation/Bootstrap/ServerBootstrap.cs rename to mROA/Implementation/Bootstrap/FullMixBuilder.cs index 4181426..67b8a5f 100644 --- a/mROA/Implementation/Bootstrap/ServerBootstrap.cs +++ b/mROA/Implementation/Bootstrap/FullMixBuilder.cs @@ -2,12 +2,12 @@ using mROA.Abstract; namespace mROA.Implementation.Bootstrap; -public interface IBootstrap +public interface ImRoaBuilder { void Build(); } -public class ServerBootstrap : IBootstrap +public class FullMixBuilder : ImRoaBuilder { public List Modules { get; private set; } = new(); public void Build() diff --git a/mROA/Implementation/Frontend/NetworkFrontendBridge.cs b/mROA/Implementation/Frontend/NetworkFrontendBridge.cs new file mode 100644 index 0000000..8c2b395 --- /dev/null +++ b/mROA/Implementation/Frontend/NetworkFrontendBridge.cs @@ -0,0 +1,26 @@ +using System.Net; +using System.Net.Sockets; +using mROA.Abstract; + +namespace mROA.Implementation; + +public class NetworkFrontendBridge : IFrontendBridge +{ + private TcpClient _tcpClient; + public NetworkFrontendBridge(IPEndPoint serverEndPoint) + { + _tcpClient = new TcpClient(serverEndPoint); + } + public void Inject(T dependency) + { + if (dependency is StreamBasedFrontendInteractionModule interactionModule) + { + interactionModule.ServerStream = _tcpClient.GetStream(); + } + } + + public void Bake() + { + + } +} \ No newline at end of file diff --git a/mROA/obj/Debug/net9.0/mROA.AssemblyInfo.cs b/mROA/obj/Debug/net9.0/mROA.AssemblyInfo.cs index 10b7c2f..7311ff8 100644 --- a/mROA/obj/Debug/net9.0/mROA.AssemblyInfo.cs +++ b/mROA/obj/Debug/net9.0/mROA.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("mROA")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+cc5c595948305981ceadef95889ffeab017dd2b7")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5e805a28b0513eecaf35aff9e64a3ec55c2850ed")] [assembly: System.Reflection.AssemblyProductAttribute("mROA")] [assembly: System.Reflection.AssemblyTitleAttribute("mROA")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]