Just events not works

This commit is contained in:
2025-07-03 17:37:25 +03:00
parent aa3606401b
commit 9ec62536fe
22 changed files with 206 additions and 118 deletions
+13 -12
View File
@@ -4,13 +4,15 @@ using System.Reflection;
using mROA.Abstract;
using mROA.Implementation;
using System;
using System.Collections;
using System.Threading;
namespace mROA.Codegen
{
public class CoCodegenMethodRepository : IMethodRepository
public class GeneratedInvokersCollection : IReadOnlyList<IMethodInvoker>
{
private readonly List<IMethodInvoker> _methods = new () {
private readonly List<IMethodInvoker> _invokers = new()
{
<!I invoker r sep invokerSep><!D invokerSep>,
<!D>
<!T asyncInvoker>
@@ -32,22 +34,21 @@ namespace mROA.Codegen
ParameterTypes = new Type[] { <!L parametersType> },
SuitableType = typeof(<!L suitableType>),
Invoking = (i, parameters, special) => <!L funcInvoking>,
}<!T>
}<!T>
};
public IMethodInvoker GetMethod(int id)
public IEnumerator<IMethodInvoker> GetEnumerator()
{
if (id == -1)
return mROA.Implementation.MethodInvoker.Dispose;
if (_methods.Count <= id)
return null;
return _methods[id];
return _invokers.GetEnumerator();
}
public void Inject<T>(T dependency)
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public int Count => _invokers.Count;
public IMethodInvoker this[int index] => _invokers[index];
}
}