билдится на старом дотнете

This commit is contained in:
2025-02-20 16:10:09 +03:00
parent 5af9408a9a
commit 50fd3e7b73
69 changed files with 1990 additions and 1675 deletions
+4 -2
View File
@@ -2,9 +2,11 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<TargetFramework>netstandard2.1</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>9</LangVersion>
</PropertyGroup>
<ItemGroup>
+21 -19
View File
@@ -1,28 +1,30 @@
using Example.Shared;
using System;
using Example.Shared;
using mROA.Implementation.Attributes;
namespace Example.Backend;
[SharedObjectSingleton]
public class LoadTestImp : ILoadTest
namespace Example.Backend
{
public int Next(int last)
[SharedObjectSingleton]
public class LoadTestImp : ILoadTest
{
return last + 1;
}
public int Next(int last)
{
return last + 1;
}
public int Last(int next)
{
return next - 1;
}
public int Last(int next)
{
return next - 1;
}
public void C()
{
throw new NotImplementedException();
}
public void C()
{
throw new NotImplementedException();
}
public void A()
{
throw new NotImplementedException();
public void A()
{
throw new NotImplementedException();
}
}
}
+7 -6
View File
@@ -1,13 +1,14 @@
using System.Text;
using Example.Shared;
namespace Example.Backend;
public class Page : IPage
namespace Example.Backend
{
public string Text;
public byte[] GetData()
public class Page : IPage
{
return Encoding.UTF8.GetBytes(Text);
public string Text;
public byte[] GetData()
{
return Encoding.UTF8.GetBytes(Text);
}
}
}
+14 -12
View File
@@ -1,20 +1,22 @@
using System.Threading;
using System.Threading.Tasks;
using Example.Shared;
using mROA.Implementation;
namespace Example.Backend;
public class Printer : IPrinter
namespace Example.Backend
{
public string Name;
public string GetName()
public class Printer : IPrinter
{
return Name;
}
public string Name;
public string GetName()
{
return Name;
}
public async Task<SharedObject<IPage>> Print(string text, CancellationToken cancellationToken = default)
{
// throw new Exception("The method or operation is not implemented.");
return new Page {Text = text};
public async Task<SharedObject<IPage>> Print(string text, CancellationToken cancellationToken = default)
{
// throw new Exception("The method or operation is not implemented.");
return new Page {Text = text};
}
}
}
+32 -28
View File
@@ -1,40 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Example.Shared;
using mROA.Implementation;
using mROA.Implementation.Attributes;
namespace Example.Backend;
[SharedObjectSingleton]
public class PrinterFactory : IPrinterFactory
namespace Example.Backend
{
private List<IPrinter> _printers = new();
public SharedObject<IPrinter> Create(string printerName)
[SharedObjectSingleton]
public class PrinterFactory : IPrinterFactory
{
Console.WriteLine("Creating printer");
return new Printer { Name = printerName };
}
private List<IPrinter> _printers = new List<IPrinter>();
public void Register(SharedObject<IPrinter> printer)
{
_printers.Add(printer.Value);
Console.WriteLine("Registered printer");
}
public SharedObject<IPrinter> Create(string printerName)
{
Console.WriteLine("Creating printer");
return new Printer { Name = printerName };
}
public SharedObject<IPrinter> GetPrinterByName(string printerName)
{
Console.WriteLine("Getting printer");
return new SharedObject<IPrinter>(_printers.Find(i => i.GetName() == printerName)!);
}
public void Register(SharedObject<IPrinter> printer)
{
_printers.Add(printer.Value);
Console.WriteLine("Registered printer");
}
public SharedObject<IPrinter> GetFirstPrinter()
{
return new SharedObject<IPrinter>(_printers.First());
}
public SharedObject<IPrinter> GetPrinterByName(string printerName)
{
Console.WriteLine("Getting printer");
return new SharedObject<IPrinter>(_printers.Find(i => i.GetName() == printerName)!);
}
public string[] CollectAllNames()
{
Console.WriteLine("Collecting all printers");
return _printers.Select(i => i.GetName()).ToArray();
public SharedObject<IPrinter> GetFirstPrinter()
{
return new SharedObject<IPrinter>(_printers.First());
}
public string[] CollectAllNames()
{
Console.WriteLine("Collecting all printers");
return _printers.Select(i => i.GetName()).ToArray();
}
}
}
+35 -29
View File
@@ -7,37 +7,43 @@ using mROA.Implementation.Backend;
using mROA.Implementation.Bootstrap;
using mROA.Implementation.Frontend;
var builder = new FullMixBuilder();
builder.UseJsonSerialisation();
builder.Modules.Add(new BackendIdentityGenerator());
builder.UseNetworkGateway(new IPEndPoint(IPAddress.Loopback, 4567), typeof(NextGenerationInteractionModule),
builder.GetModule<IIdentityGenerator>()!);
builder.Modules.Add(new ConnectionHub());
builder.Modules.Add(new HubRequestExtractor(typeof(RequestExtractor)));
builder.UseBasicExecution();
builder.Modules.Add(new RemoteContextRepository());
// builder.UseCollectableContextRepository(typeof(PrinterFactory).Assembly);
builder.Modules.Add(new MultiClientContextRepository(i =>
class Program
{
var repo = new ContextRepository();
repo.FillSingletons(typeof(PrinterFactory).Assembly);
return repo;
}));
builder.SetupMethodsRepository(new CoCodegenMethodRepository());
builder.Modules.Add(new CreativeRepresentationModuleProducer([builder.GetModule<JsonSerializationToolkit>()!],
typeof(RepresentationModule)));
public static void Main(string[] args)
{
var builder = new FullMixBuilder();
builder.UseJsonSerialisation();
builder.Modules.Add(new BackendIdentityGenerator());
builder.UseNetworkGateway(new IPEndPoint(IPAddress.Loopback, 4567), typeof(NextGenerationInteractionModule),
builder.GetModule<IIdentityGenerator>()!);
builder.Build();
new RemoteTypeBinder();
builder.Modules.Add(new ConnectionHub());
builder.Modules.Add(new HubRequestExtractor(typeof(RequestExtractor)));
TransmissionConfig.RealContextRepository = builder.GetModule<MultiClientContextRepository>();
TransmissionConfig.RemoteEndpointContextRepository = builder.GetModule<RemoteContextRepository>();
TransmissionConfig.OwnershipRepository = new MultiClientOwnershipRepository();
builder.UseBasicExecution();
var gateway = builder.GetModule<IGatewayModule>();
builder.Modules.Add(new RemoteContextRepository());
// builder.UseCollectableContextRepository(typeof(PrinterFactory).Assembly);
builder.Modules.Add(new MultiClientContextRepository(i =>
{
var repo = new ContextRepository();
repo.FillSingletons(typeof(PrinterFactory).Assembly);
return repo;
}));
builder.SetupMethodsRepository(new CoCodegenMethodRepository());
builder.Modules.Add(new CreativeRepresentationModuleProducer(
new IInjectableModule[] { builder.GetModule<JsonSerializationToolkit>()! },
typeof(RepresentationModule)));
gateway.Run();
builder.Build();
new RemoteTypeBinder();
TransmissionConfig.RealContextRepository = builder.GetModule<MultiClientContextRepository>();
TransmissionConfig.RemoteEndpointContextRepository = builder.GetModule<RemoteContextRepository>();
TransmissionConfig.OwnershipRepository = new MultiClientOwnershipRepository();
var gateway = builder.GetModule<IGatewayModule>();
gateway.Run();
}
}