победа

This commit is contained in:
2025-02-05 16:01:02 +03:00
parent ed4e97e40f
commit 47c67a22af
9 changed files with 18 additions and 14 deletions
-6
View File
@@ -7,12 +7,6 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Reference Include="Example.Shared">
<HintPath>..\mROA.Test\bin\Debug\net9.0\Example.Shared.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Example.Shared\Example.Shared.csproj" /> <ProjectReference Include="..\Example.Shared\Example.Shared.csproj" />
</ItemGroup> </ItemGroup>
+3
View File
@@ -11,4 +11,7 @@
<ProjectReference Include="..\Example.Shared\Example.Shared.csproj" /> <ProjectReference Include="..\Example.Shared\Example.Shared.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
</ItemGroup>
</Project> </Project>
+4 -3
View File
@@ -1,8 +1,8 @@
// See https://aka.ms/new-console-template for more information // See https://aka.ms/new-console-template for more information
using System.Net; using System.Net;
using System.Text; using System.Text;
using Example.Shared;
using mROA.Codegen; using mROA.Codegen;
using mROA.Implementation; using mROA.Implementation;
using mROA.Implementation.Bootstrap; using mROA.Implementation.Bootstrap;
@@ -11,13 +11,14 @@ var mixer = new FullMixBuilder();
mixer.Modules.Add(new FrontendContextRepository()); mixer.Modules.Add(new FrontendContextRepository());
mixer.Modules.Add(new JsonFrontendSerialisationModule()); mixer.Modules.Add(new JsonFrontendSerialisationModule());
mixer.Modules.Add(new StreamBasedInteractionModule()); mixer.Modules.Add(new StreamBasedFrontendInteractionModule());
mixer.Modules.Add(new NetworkFrontendBridge(new IPEndPoint(IPAddress.Loopback, 4567))); mixer.Modules.Add(new NetworkFrontendBridge(new IPEndPoint(IPAddress.Loopback, 4567)));
mixer.Build(); mixer.Build();
var context = mixer.GetModule<FrontendContextRepository>(); var context = mixer.GetModule<FrontendContextRepository>();
var factory = context.GetSingleObject(typeof(IPrinterFactory)) as IPrinterFactory; var factory = context.GetSingleObject(typeof(Example.Shared.IPrinterFactory)) as Example.Shared.IPrinterFactory;
var printer = factory.Create("Test"); var printer = factory.Create("Test");
var name = printer.Value.GetName(); var name = printer.Value.GetName();
+3 -1
View File
@@ -7,7 +7,9 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\mROA.Codegen\mROA.Codegen.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/> <ProjectReference Include="..\mROA.Codegen\mROA.Codegen.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false"/>
<ProjectReference Include="..\mROA\mROA.csproj" /> <ProjectReference Include="..\mROA\mROA.csproj" />
</ItemGroup> </ItemGroup>
@@ -298,6 +298,9 @@ public class FrontendContextRepository : IContextRepository
{{ {{
if (dependency is ISerialisationModule.IFrontendSerialisationModule serialisationModule) if (dependency is ISerialisationModule.IFrontendSerialisationModule serialisationModule)
_serialisationModule = serialisationModule; _serialisationModule = serialisationModule;
TransmissionConfig.DefaultContextRepository = this;
Console.WriteLine(""Added"");
}} }}
public void Bake() public void Bake()
@@ -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+cc5c595948305981ceadef95889ffeab017dd2b7")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ed4e97e40f713de9270db709d05167c00f9c565b")]
[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")]
@@ -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+cc5c595948305981ceadef95889ffeab017dd2b7")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ed4e97e40f713de9270db709d05167c00f9c565b")]
[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")]
@@ -9,7 +9,8 @@ public class NetworkFrontendBridge : IFrontendBridge
private TcpClient _tcpClient; private TcpClient _tcpClient;
public NetworkFrontendBridge(IPEndPoint serverEndPoint) public NetworkFrontendBridge(IPEndPoint serverEndPoint)
{ {
_tcpClient = new TcpClient(serverEndPoint); _tcpClient = new TcpClient();
_tcpClient.Connect(serverEndPoint);
} }
public void Inject<T>(T dependency) public void Inject<T>(T dependency)
{ {
+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+5e805a28b0513eecaf35aff9e64a3ec55c2850ed")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ed4e97e40f713de9270db709d05167c00f9c565b")]
[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")]