Exemplo n.º 1
0
 private MetadataResolver <TProcess, TModule, TRequest> CreateMetadataResolver(
     TModule module,
     MetadataReader reader,
     OnFunctionResolvedDelegate <TModule, TRequest> onFunctionResolved)
 {
     return(new MetadataResolver <TProcess, TModule, TRequest>(module, reader, IgnoreCase, onFunctionResolved));
 }
Exemplo n.º 2
0
 internal MetadataResolver(
     TProcess process,
     TModule module,
     MetadataReader reader,
     OnFunctionResolvedDelegate <TModule, TRequest> onFunctionResolved)
 {
     _process            = process;
     _module             = module;
     _reader             = reader;
     _onFunctionResolved = onFunctionResolved;
 }
Exemplo n.º 3
0
 internal MetadataResolver(
     TModule module,
     MetadataReader reader,
     bool ignoreCase,
     OnFunctionResolvedDelegate <TModule, TRequest> onFunctionResolved)
 {
     _module             = module;
     _reader             = reader;
     _stringComparer     = ignoreCase ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal;
     _ignoreCase         = ignoreCase;
     _onFunctionResolved = onFunctionResolved;
 }
Exemplo n.º 4
0
        internal void OnModuleLoad(
            TProcess process,
            TModule module,
            OnFunctionResolvedDelegate <TModule, TRequest> onFunctionResolved
            )
        {
            if (!ShouldEnableFunctionResolver(process))
            {
                return;
            }

            MetadataResolver <TProcess, TModule, TRequest> resolver = null;
            var requests = GetRequests(process);

            foreach (var request in requests)
            {
                if (!ShouldHandleRequest(request))
                {
                    continue;
                }

                var moduleName = GetRequestModuleName(request);
                if (!ShouldModuleHandleRequest(module, moduleName))
                {
                    continue;
                }

                var signature = GetParsedSignature(request);
                if (signature == null)
                {
                    continue;
                }

                if (resolver == null)
                {
                    var reader = GetModuleMetadata(module);
                    if (reader == null)
                    {
                        return;
                    }
                    resolver = CreateMetadataResolver(process, module, reader, onFunctionResolved);
                }

                resolver.Resolve(request, signature);
            }
        }
Exemplo n.º 5
0
        internal void EnableResolution(
            TProcess process,
            TRequest request,
            OnFunctionResolvedDelegate <TModule, TRequest> onFunctionResolved
            )
        {
            if (!ShouldHandleRequest(request))
            {
                return;
            }

            var moduleName = GetRequestModuleName(request);
            var signature  = GetParsedSignature(request);

            if (signature == null)
            {
                return;
            }

            bool checkEnabled = true;

            foreach (var module in GetAllModules(process))
            {
                if (checkEnabled)
                {
                    if (!ShouldEnableFunctionResolver(process))
                    {
                        return;
                    }
                    checkEnabled = false;
                }

                if (!ShouldModuleHandleRequest(module, moduleName))
                {
                    continue;
                }
                var reader = GetModuleMetadata(module);
                if (reader == null)
                {
                    continue;
                }
                var resolver = CreateMetadataResolver(process, module, reader, onFunctionResolved);
                resolver.Resolve(request, signature);
            }
        }