diff --git a/mROA.Codegen/mROASourceGenerator.cs b/mROA.Codegen/mROASourceGenerator.cs index b0cd06c..28438f3 100644 --- a/mROA.Codegen/mROASourceGenerator.cs +++ b/mROA.Codegen/mROASourceGenerator.cs @@ -180,17 +180,6 @@ namespace mROA.Codegen return _methods[id]; }} - public int RegisterMethod(MethodInfo method) - {{ - _methods.Add(method); - return _methods.Count - 1; - }} - - public IEnumerable GetMethods() - {{ - return _methods; - }} - public void Inject(T dependency) {{ }} diff --git a/mROA/Abstract/IMethodRepository.cs b/mROA/Abstract/IMethodRepository.cs index 9e448f9..a08faf8 100644 --- a/mROA/Abstract/IMethodRepository.cs +++ b/mROA/Abstract/IMethodRepository.cs @@ -1,13 +1,9 @@ -using System.Collections.Generic; -using System.Reflection; +using System.Reflection; namespace mROA.Abstract { public interface IMethodRepository : IInjectableModule { MethodInfo GetMethod(int id); - int RegisterMethod(MethodInfo method); - - IEnumerable GetMethods(); } } \ No newline at end of file diff --git a/mROA/Implementation/Backend/BasicConfigurationExtensions.cs b/mROA/Implementation/Backend/BasicConfigurationExtensions.cs index 16b1851..b7f2460 100644 --- a/mROA/Implementation/Backend/BasicConfigurationExtensions.cs +++ b/mROA/Implementation/Backend/BasicConfigurationExtensions.cs @@ -8,11 +8,6 @@ namespace mROA.Implementation.Backend { public static class BasicConfigurationExtensions { - public static void UseJsonSerialisation(this FullMixBuilder builder) - { - builder.Modules.Add(new JsonSerializationToolkit()); - } - public static void UseNetworkGateway(this FullMixBuilder builder, IPEndPoint endPoint, Type interactionModuleType, params IInjectableModule[] injectableModules) { builder.Modules.Add(new NetworkGatewayModule(endPoint, interactionModuleType, injectableModules)); diff --git a/mROA/Implementation/EndPointContext.cs b/mROA/Implementation/EndPointContext.cs index 7ceb5df..1d80548 100644 --- a/mROA/Implementation/EndPointContext.cs +++ b/mROA/Implementation/EndPointContext.cs @@ -9,12 +9,11 @@ namespace mROA.Implementation public IContextRepository RealRepository { get; set; } public IContextRepository RemoteRepository { get; set; } public int HostId { get; set; } + public int OwnerId { get => OwnerFunc(); - set - { - OwnerFunc = () => value; - } } + set { OwnerFunc = () => value; } + } } } \ No newline at end of file diff --git a/mROA/Implementation/MethodInvoker.cs b/mROA/Implementation/MethodInvoker.cs index b49593f..337ec46 100644 --- a/mROA/Implementation/MethodInvoker.cs +++ b/mROA/Implementation/MethodInvoker.cs @@ -9,11 +9,23 @@ namespace mROA.Implementation public bool IsVoid { get; set; } public Type[] ParameterTypes { get; set; } = Type.EmptyTypes; public Type? ReturnType { get; set; } - public Func Invoking { get; set; } + public Func Invoking { get; set; } public object? Invoke(object instance, object?[] parameters, object[] special) { return Invoking(instance, parameters, special); } + + public static MethodInvoker Dispose = new MethodInvoker + { + IsAsync = false, + IsVoid = true, + ReturnType = null, + Invoking = ((instance, parameters, special) => + { + (instance as IDisposable)?.Dispose(); + return null; + }) + }; } } \ No newline at end of file diff --git a/mROA/Implementation/MethodRepository.cs b/mROA/Implementation/MethodRepository.cs deleted file mode 100644 index 020f7fc..0000000 --- a/mROA/Implementation/MethodRepository.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using mROA.Abstract; -using mROA.Implementation.Attributes; - -namespace mROA.Implementation -{ - public class MethodRepository : IMethodRepository - { - private readonly List _methods = new() { }; - - public MethodInfo GetMethod(int id) - { - if (_methods.Count <= id) - throw new Exception("Method such registered method"); - - return _methods[id]; - } - - public int RegisterMethod(MethodInfo method) - { - _methods.Add(method); - return _methods.Count - 1; - } - - public IEnumerable GetMethods() - { - return _methods; - } - - public void CollectForAssembly(Assembly assembly) - { - var types = assembly.GetTypes().Where(i => i.IsInterface && i.GetCustomAttributes(typeof(SharedObjectInterfaceAttribute), true).Length > 0); - foreach (var type in types) - { - foreach (var method in type.GetMethods()) - RegisterMethod(method); - } - } - public void Inject(T dependency) - { - - } - } -} \ No newline at end of file