примеры клиента и сервера написаны
This commit is contained in:
@@ -12,6 +12,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example.Backend", "Example.
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example.Shared", "Example.Shared\Example.Shared.csproj", "{E7703F5B-F2A6-4A88-AA57-EBB1E38D533E}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example.Shared", "Example.Shared\Example.Shared.csproj", "{E7703F5B-F2A6-4A88-AA57-EBB1E38D533E}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example.Frontend", "Example.Frontend\Example.Frontend.csproj", "{9BD25A13-3165-47C0-9EAA-5C59EC490E32}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
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}.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.ActiveCfg = Release|Any CPU
|
||||||
{E7703F5B-F2A6-4A88-AA57-EBB1E38D533E}.Release|Any CPU.Build.0 = 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
|
EndGlobalSection
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{A9BB364E-0BA6-40B9-A293-757BC48EFC06} = {EAE92F5A-664C-41AB-8811-5885524B5347}
|
{A9BB364E-0BA6-40B9-A293-757BC48EFC06} = {EAE92F5A-664C-41AB-8811-5885524B5347}
|
||||||
{E7703F5B-F2A6-4A88-AA57-EBB1E38D533E} = {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
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
namespace mROA.Abstract;
|
||||||
|
|
||||||
|
public interface IFrontendBridge : IInjectableModule
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -6,35 +6,36 @@ namespace mROA.Implementation;
|
|||||||
|
|
||||||
public static class BasicConfigurationExtensions
|
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();
|
var repo = new ContextRepository();
|
||||||
repo.FillSingletons(assemblies);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -2,12 +2,12 @@ using mROA.Abstract;
|
|||||||
|
|
||||||
namespace mROA.Implementation.Bootstrap;
|
namespace mROA.Implementation.Bootstrap;
|
||||||
|
|
||||||
public interface IBootstrap
|
public interface ImRoaBuilder
|
||||||
{
|
{
|
||||||
void Build();
|
void Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ServerBootstrap : IBootstrap
|
public class FullMixBuilder : ImRoaBuilder
|
||||||
{
|
{
|
||||||
public List<IInjectableModule> Modules { get; private set; } = new();
|
public List<IInjectableModule> Modules { get; private set; } = new();
|
||||||
public void Build()
|
public void Build()
|
||||||
@@ -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>(T dependency)
|
||||||
|
{
|
||||||
|
if (dependency is StreamBasedFrontendInteractionModule interactionModule)
|
||||||
|
{
|
||||||
|
interactionModule.ServerStream = _tcpClient.GetStream();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Bake()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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+cc5c595948305981ceadef95889ffeab017dd2b7")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5e805a28b0513eecaf35aff9e64a3ec55c2850ed")]
|
||||||
[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")]
|
||||||
|
|||||||
Reference in New Issue
Block a user