Esempio n. 1
0
        internal Client(IDatabase db, Assembly assembly, TCursor debugInstance)
        {
            _csharpCompiler = new CSharpCompiler();
            _luaHandler     = new LuaHandler(db);
            _delegateReader = DelegateReader.CreateCachedWithDefaultAssemblyProvider();

            DebugInstance = debugInstance;
            Database      = db;
        }
Esempio n. 2
0
        public static DecompilationResult CreateFromDelegate <TCursor, TRes>(IDelegateReader reader,
                                                                             Function <TCursor, TRes> function)
        {
            var method = reader.Read(function)?.FirstMethodOrDefault();

            if (method is null)
            {
                throw new Exception("Unable to extract method from delegate");
            }

            var parameters = method.Parameters.ToArray();

            if (parameters.Length != 3)
            {
                throw new Exception($"Expected method with 3 arguments, got {parameters.Length}");
            }

            var cursorName = parameters[0].Name;
            var argsName   = parameters[1].Name;
            var keysName   = parameters[2].Name;

            return(new DecompilationResult(method.Body, cursorName, argsName, keysName));
        }
 public static void ClassSetup(TestContext ctx)
 {
     _delegateReader = DelegateReader.CreateWithDefaultAssemblyProvider();
     _csharpCompiler = new CSharpCompiler();
     _csharpCompiler.MainResolver.AddResolver(typeof(Foo <>), typeof(FooProxy <>));
 }
Esempio n. 4
0
 public static void ClassSetup(TestContext ctx)
 {
     _delegateReader = DelegateReader.CreateWithDefaultAssemblyProvider();
     _csharpCompiler = new CSharpCompiler();
 }
Esempio n. 5
0
 public CachedDelegateReader(IDelegateReader actualReader)
 {
     _actualReader = actualReader;
     _cache        = new ConcurrentDictionary <Delegate, Lazy <SyntaxTree> >();
 }