当前位置: 首页>>代码示例>>C#>>正文


C# IAssemblyResolver类代码示例

本文整理汇总了C#中IAssemblyResolver的典型用法代码示例。如果您正苦于以下问题:C# IAssemblyResolver类的具体用法?C# IAssemblyResolver怎么用?C# IAssemblyResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IAssemblyResolver类属于命名空间,在下文中一共展示了IAssemblyResolver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExecuteReplCommand

        public ExecuteReplCommand(
            string scriptName,
            string[] scriptArgs,
            IFileSystem fileSystem,
            IScriptPackResolver scriptPackResolver,
            IRepl repl,
            ILogProvider logProvider,
            IConsole console,
            IAssemblyResolver assemblyResolver,
            IFileSystemMigrator fileSystemMigrator,
            IScriptLibraryComposer composer)
        {
            Guard.AgainstNullArgument("fileSystem", fileSystem);
            Guard.AgainstNullArgument("scriptPackResolver", scriptPackResolver);
            Guard.AgainstNullArgument("repl", repl);
            Guard.AgainstNullArgument("logProvider", logProvider);
            Guard.AgainstNullArgument("console", console);
            Guard.AgainstNullArgument("assemblyResolver", assemblyResolver);
            Guard.AgainstNullArgument("fileSystemMigrator", fileSystemMigrator);
            Guard.AgainstNullArgument("composer", composer);

            _scriptName = scriptName;
            _scriptArgs = scriptArgs;
            _fileSystem = fileSystem;
            _scriptPackResolver = scriptPackResolver;
            _repl = repl;
            _logger = logProvider.ForCurrentType();
            _console = console;
            _assemblyResolver = assemblyResolver;
            _fileSystemMigrator = fileSystemMigrator;
            _composer = composer;
        }
开发者ID:JamesLinus,项目名称:scriptcs,代码行数:32,代码来源:ExecuteReplCommand.cs

示例2: ExecuteReplCommand

 public ExecuteReplCommand(
     string scriptName,
     string[] scriptArgs,
     IFileSystem fileSystem,
     IScriptPackResolver scriptPackResolver,
     IScriptEngine scriptEngine,
     IFilePreProcessor filePreProcessor,
     IObjectSerializer serializer,
     ILog logger,
     IConsole console,
     IAssemblyResolver assemblyResolver,
     IEnumerable<IReplCommand> replCommands)
 {
     _scriptName = scriptName;
     _scriptArgs = scriptArgs;
     _fileSystem = fileSystem;
     _scriptPackResolver = scriptPackResolver;
     _scriptEngine = scriptEngine;
     _filePreProcessor = filePreProcessor;
     _serializer = serializer;
     _logger = logger;
     _console = console;
     _assemblyResolver = assemblyResolver;
     _replCommands = replCommands;
 }
开发者ID:selony,项目名称:scriptcs,代码行数:25,代码来源:ExecuteReplCommand.cs

示例3: Resolve

        public static TypeDefinition Resolve(IAssemblyResolver resolver, TypeReference type)
        {
            type = type.GetElementType ();

            var scope = type.Scope;
            switch (scope.MetadataScopeType) {
            case MetadataScopeType.AssemblyNameReference:
                var assembly = resolver.Resolve ((AssemblyNameReference) scope);
                if (assembly == null)
                    return null;

                return GetType (assembly.MainModule, type);
            case MetadataScopeType.ModuleDefinition:
                return GetType ((ModuleDefinition) scope, type);
            case MetadataScopeType.ModuleReference:
                var modules = type.Module.Assembly.Modules;
                var module_ref = (ModuleReference) scope;
                for (int i = 0; i < modules.Count; i++) {
                    var netmodule = modules [i];
                    if (netmodule.Name == module_ref.Name)
                        return GetType (netmodule, type);
                }
                break;
            }

            throw new NotSupportedException ();
        }
开发者ID:peterwald,项目名称:cecil,代码行数:27,代码来源:MetadataResolver.cs

示例4: SetUp

 public void SetUp()
 {
     encryption = new Encryption();
     log = MockRepository.GenerateMock<ILog>();
     assemblyResolver = MockRepository.GenerateMock<IAssemblyResolver>();
     this.dataClientFactory = new DataClientFactory(log, assemblyResolver, encryption);
 }
开发者ID:perryofpeek,项目名称:SqlToGraphite-core,代码行数:7,代码来源:With_DataClientFactory.cs

示例5: AppDomainAssemblyResolver

        public AppDomainAssemblyResolver(
            ILogProvider logProvider,
            IFileSystem fileSystem,
            IAssemblyResolver resolver,
            IAssemblyUtility assemblyUtility,
            IDictionary<string, AssemblyInfo> assemblyInfoMap = null,
            Func<object, ResolveEventArgs, Assembly> resolveHandler = null)
        {
            Guard.AgainstNullArgument("logProvider", logProvider);
            Guard.AgainstNullArgument("fileSystem", fileSystem);
            Guard.AgainstNullArgument("resolver", resolver);
            Guard.AgainstNullArgument("assemblyUtility", assemblyUtility);

            _assemblyInfoMap = assemblyInfoMap ?? new Dictionary<string, AssemblyInfo>();
            _assemblyUtility = assemblyUtility;
            _logger = logProvider.ForCurrentType();
            _fileSystem = fileSystem;
            _resolver = resolver;

            if (resolveHandler == null)
            {
                resolveHandler = AssemblyResolve;
            }

            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(resolveHandler);
        }
开发者ID:AsCloud,项目名称:scriptcs,代码行数:26,代码来源:AppDomainAssemblyResolver.cs

示例6: ModuleLoader

        public ModuleLoader(IAssemblyResolver resolver, ILog logger, Action<Assembly, AggregateCatalog> addToCatalog, Func<CompositionContainer, IEnumerable<Lazy<IModule, IModuleMetadata>>> getLazyModules, IFileSystem fileSystem, IAssemblyUtility assemblyUtility)
        {
            _resolver = resolver;
            _logger = logger;

            if (addToCatalog == null)
            {
                addToCatalog = (assembly, catalog) =>
                {
                    try
                    {
                        var assemblyCatalog = new AssemblyCatalog(assembly);
                        catalog.Catalogs.Add(assemblyCatalog);
                    }
                    catch (Exception exception)
                    {
                        logger.DebugFormat("Module Loader exception: {0}", exception.Message);
                    }
                };
            }

            _addToCatalog = addToCatalog;

            if (getLazyModules == null)
            {
                getLazyModules = container => container.GetExports<IModule, IModuleMetadata>();
            }

            _getLazyModules = getLazyModules;
            _fileSystem = fileSystem;
            _assemblyUtility = assemblyUtility;
        }
开发者ID:nagyistoce,项目名称:scriptcs,代码行数:32,代码来源:ModuleLoader.cs

示例7: ReferenceContainer

        public ReferenceContainer(ModuleDefinition moduleDefinition, IAssemblyResolver assemblyResolver)
        {
            var systemDefinition = assemblyResolver.Resolve("mscorlib");
            var yalfDefinition = assemblyResolver.Resolve("Yalf");
            var yalfTypes = yalfDefinition.MainModule.Types;

            var logType = yalfTypes.Single(x => x.Name == "Log");
            var iContextType = yalfTypes.Single(x => x.Name == "IContext");

            var iDisposableType = systemDefinition.MainModule.Types.Single(x => x.Name == "IDisposable");
            var exceptionType = systemDefinition.MainModule.Types.Single(x => x.Name == "Exception");

            MethodContextMethod = moduleDefinition.Import(logType.Methods.Single(m => m.Name == "MethodContext"));
            TraceExceptionMethod = moduleDefinition.Import(logType.Methods.Single(m => m.Name == "TraceException"));
            CreateRecordReturnMethod = retType => {

                var recordReturn = moduleDefinition.Import(iContextType.Methods.Single(m => m.Name == "RecordReturn"));
                if (retType.IsGenericInstance)
                {
                    return recordReturn.MakeGeneric(retType);
                }
                else
                {
                    return recordReturn.MakeGeneric(retType);
                }
            };
            DisposeMethod = moduleDefinition.Import(iDisposableType.Methods.Single(m => m.Name == "Dispose"));
            LogType = moduleDefinition.Import(logType);
            IContextType = moduleDefinition.Import(iContextType);
            ExceptionType = moduleDefinition.Import(exceptionType);
            PreserveStackTraceMethod = moduleDefinition.Import(iContextType.Methods.Single(m => m.Name == "PreserveStackTrace"));
        }
开发者ID:mdabbagh88,项目名称:YALF,代码行数:32,代码来源:ReferenceContainer.cs

示例8: MetadataResolver

		public MetadataResolver (IAssemblyResolver assemblyResolver)
		{
			if (assemblyResolver == null)
				throw new ArgumentNullException ("assemblyResolver");

			assembly_resolver = assemblyResolver;
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:7,代码来源:MetadataResolver.cs

示例9: ScriptServices

 public ScriptServices(
     IFileSystem fileSystem,
     IPackageAssemblyResolver packageAssemblyResolver, 
     IScriptExecutor executor,
     IScriptEngine engine,
     IFilePreProcessor filePreProcessor,
     IReplCommandService replCommandService,
     IScriptPackResolver scriptPackResolver, 
     IPackageInstaller packageInstaller,
     ILog logger,
     IAssemblyResolver assemblyResolver,
     IConsole console = null,
     IInstallationProvider installationProvider = null 
     )
 {
     FileSystem = fileSystem;
     PackageAssemblyResolver = packageAssemblyResolver;
     Executor = executor;
     Engine = engine;
     FilePreProcessor = filePreProcessor;
     ReplCommandService = replCommandService;
     ScriptPackResolver = scriptPackResolver;
     PackageInstaller = packageInstaller;
     Logger = logger;
     Console = console;
     AssemblyResolver = assemblyResolver;
     InstallationProvider = installationProvider;
 }
开发者ID:ktroach,项目名称:scriptcs-replcommand-infra,代码行数:28,代码来源:ScriptServices.cs

示例10: GetMemberReference

		public MemberReference GetMemberReference(IAssemblyResolver resolver)
		{
			if (resolver == null)
				throw new ArgumentNullException("resolver");
			
			if (memberReference != null)
				return memberReference;
			
			// reload from filename
			ReaderParameters readerParameters = new ReaderParameters();
			// Use new assembly resolver instance so that the AssemblyDefinitions can be garbage-collected
			// once the code is decompiled.
			readerParameters.AssemblyResolver = resolver;
			
			string typeName;
			if (GetAssemblyAndType(FileName.ToString(), out assemblyFile, out typeName)) {
				ModuleDefinition module = ModuleDefinition.ReadModule(assemblyFile, readerParameters);
				TypeDefinition typeDefinition = module.GetType(typeName);
				if (typeDefinition == null)
					throw new InvalidOperationException("Could not find type");
				memberReference = typeDefinition;
			}
			
			return memberReference;
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:25,代码来源:DecompiledBreakpointBookmark.cs

示例11: ResolveType

        public static TypeDefinition ResolveType(string type, ICustomAttributeProvider provider, IAssemblyResolver resolver)
        {
            if (provider == null)
                throw new ArgumentException ("Type resolution support requires an AssemblyDefinition or TypeDefinition.", "provider");
            if (resolver == null)
                throw new ArgumentException ("Type resolution support requires a IAssemblyResolver.", "resolver");

            // `type` is either a "bare" type "Foo.Bar", or an
            // assembly-qualified type "Foo.Bar, AssemblyName [Version=...]?".
            //
            // Bare types are looked up via `provider`; assembly-qualified types are
            // looked up via `resolver`

            int c = type.IndexOf (',');
            string typeName = c < 0 ? type  : type.Substring (0, c);
            string assmName = c < 0 ? null  : type.Substring (c+1);

            AssemblyDefinition assembly = assmName == null ? null : resolver.Resolve (assmName);
            if (assembly == null) {
                assembly = provider as AssemblyDefinition;
                if (assembly == null) {
                    TypeDefinition decl = (TypeDefinition) provider;
                    assembly = decl.Module.Assembly;
                }
            }
            var ret = assembly.Modules.Cast<ModuleDefinition> ()
                .Select (md => md.Types.FirstOrDefault (t => t.FullName == typeName))
                .FirstOrDefault (td => td != null);
            if (ret == null)
                throw new ArgumentException ("Type not found: " + type, "type");

            return ret;
        }
开发者ID:yudhitech,项目名称:xamarin-android,代码行数:33,代码来源:ManifestDocumentElement.cs

示例12: ExecuteScriptCommand

        public ExecuteScriptCommand(
            string script,
            string[] scriptArgs,
            IFileSystem fileSystem,
            IScriptExecutor scriptExecutor,
            IScriptPackResolver scriptPackResolver,
            ILog logger,
            IAssemblyResolver assemblyResolver,
            IFileSystemMigrator fileSystemMigrator,
            IScriptLibraryComposer composer
            )
        {
            Guard.AgainstNullArgument("fileSystem", fileSystem);
            Guard.AgainstNullArgument("scriptExecutor", scriptExecutor);
            Guard.AgainstNullArgument("scriptPackResolver", scriptPackResolver);
            Guard.AgainstNullArgument("logger", logger);
            Guard.AgainstNullArgument("assemblyResolver", assemblyResolver);
            Guard.AgainstNullArgument("fileSystemMigrator", fileSystemMigrator);
            Guard.AgainstNullArgument("composer", composer);

            _script = script;
            ScriptArgs = scriptArgs;
            _fileSystem = fileSystem;
            _scriptExecutor = scriptExecutor;
            _scriptPackResolver = scriptPackResolver;
            _logger = logger;
            _assemblyResolver = assemblyResolver;
            _fileSystemMigrator = fileSystemMigrator;
            _composer = composer;
        }
开发者ID:nagyistoce,项目名称:scriptcs,代码行数:30,代码来源:ExecuteScriptCommand.cs

示例13: AddAssemblyResolver

        /// <inheritdoc />
        public void AddAssemblyResolver(IAssemblyResolver assemblyResolver)
        {
            if (assemblyResolver == null)
                throw new ArgumentNullException(@"assemblyResolver");

            assemblyResolvers.Add(assemblyResolver);
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:8,代码来源:DefaultAssemblyLoader.cs

示例14: ScriptServices

 public ScriptServices(
     IFileSystem fileSystem,
     IPackageAssemblyResolver packageAssemblyResolver,
     IScriptExecutor executor,
     IRepl repl,
     IScriptEngine engine,
     IFilePreProcessor filePreProcessor,
     IScriptPackResolver scriptPackResolver,
     IPackageInstaller packageInstaller,
     IObjectSerializer objectSerializer,
     ILog logger,
     IAssemblyResolver assemblyResolver,
     IEnumerable<IReplCommand> replCommands,
     IConsole console = null,
     IInstallationProvider installationProvider = null)
 {
     FileSystem = fileSystem;
     PackageAssemblyResolver = packageAssemblyResolver;
     Executor = executor;
     Repl = repl;
     Engine = engine;
     FilePreProcessor = filePreProcessor;
     ScriptPackResolver = scriptPackResolver;
     PackageInstaller = packageInstaller;
     ObjectSerializer = objectSerializer;
     Logger = logger;
     Console = console;
     AssemblyResolver = assemblyResolver;
     InstallationProvider = installationProvider;
     ReplCommands = replCommands;
 }
开发者ID:jrusbatch,项目名称:scriptcs,代码行数:31,代码来源:ScriptServices.cs

示例15: AssemblyTypeInfoGenerator

 public AssemblyTypeInfoGenerator(string assembly, IAssemblyResolver resolver)
 {
   string str = assembly;
   ReaderParameters readerParameters1 = new ReaderParameters();
   readerParameters1.set_AssemblyResolver(resolver);
   ReaderParameters readerParameters2 = readerParameters1;
   this.assembly_ = AssemblyDefinition.ReadAssembly(str, readerParameters2);
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:8,代码来源:AssemblyTypeInfoGenerator.cs


注:本文中的IAssemblyResolver类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。