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


C# AssemblyResolver类代码示例

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


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

示例1: ShouldOnlyReturnBinariesWhenFlagIsSet

            public void ShouldOnlyReturnBinariesWhenFlagIsSet(
                [Frozen] Mock<IPackageAssemblyResolver> packageAssemblyResolverMock, 
                [Frozen] Mock<IFileSystem> fileSystemMock, 
                [Frozen] Mock<IAssemblyUtility> assemblyUtilityMock,
                AssemblyResolver resolver)
            {
                const string WorkingDirectory = @"C:\";

                var binFolder = Path.Combine(WorkingDirectory, "bin");

                assemblyUtilityMock.Setup(a => a.IsManagedAssembly(It.IsAny<string>())).Returns(true);
                fileSystemMock.Setup(x => x.DirectoryExists(binFolder)).Returns(true);
                fileSystemMock.Setup(x => x.DirectoryExists(@"C:\packages")).Returns(true);
                fileSystemMock.SetupGet(x => x.PackagesFolder).Returns("packages");
                fileSystemMock.SetupGet(x => x.BinFolder).Returns("bin");
                fileSystemMock.Setup(x => x.EnumerateFiles(binFolder, It.IsAny<string>(), SearchOption.AllDirectories))
                    .Returns(Enumerable.Empty<string>());

                packageAssemblyResolverMock.Setup(p=>p.GetAssemblyNames(WorkingDirectory)).Returns(new string[] {"test.dll", "test.exe", "test.foo"});

                var assemblies = resolver.GetAssemblyPaths(WorkingDirectory, true).ToList();
                assemblies.ShouldNotContain("test.foo");
                assemblies.ShouldContain("test.dll");
                assemblies.ShouldContain("test.exe");
            }
开发者ID:nagyistoce,项目名称:scriptcs,代码行数:25,代码来源:AssemblyResolverTests.cs

示例2: ShouldNotReturnNonManagedAssemblies

            public void ShouldNotReturnNonManagedAssemblies(
                [Frozen] Mock<IFileSystem> fileSystemMock,
                [Frozen] Mock<IPackageAssemblyResolver> packageAssemblyResolverMock,
                [Frozen] Mock<IAssemblyUtility> assemblyUtilityMock,
                AssemblyResolver resolver
            )
            {
                const string WorkingDirectory = @"C:\";

                var binFolder = Path.Combine(WorkingDirectory, "bin");
                var managed = Path.Combine(binFolder, "MyAssembly.dll");
                var nonManaged = Path.Combine(binFolder, "MyNonManagedAssembly.dll");

                fileSystemMock.Setup(x => x.DirectoryExists(binFolder)).Returns(true);
                fileSystemMock.SetupGet(x => x.PackagesFolder).Returns("packages");
                fileSystemMock.SetupGet(x => x.BinFolder).Returns("bin");
                fileSystemMock.Setup(x => x.EnumerateFiles(binFolder, It.IsAny<string>(), SearchOption.TopDirectoryOnly
                    ))
                    .Returns(new[] { managed, nonManaged });

                assemblyUtilityMock.Setup(x => x.IsManagedAssembly(managed)).Returns(true);
                assemblyUtilityMock.Setup(x => x.IsManagedAssembly(nonManaged)).Returns(false);

                var assemblies = resolver.GetAssemblyPaths(WorkingDirectory).ToList();

                assemblies.Count.ShouldEqual(1);
                assemblies[0].ShouldEqual(managed);
            }
开发者ID:JamesLinus,项目名称:scriptcs,代码行数:28,代码来源:AssemblyResolverTests.cs

示例3: AssemblyLoaderImporter

 public AssemblyLoaderImporter(ModuleReader moduleReader, AssemblyResolver assemblyResolver, EmbedTask embedTask)
 {
     instructionConstructorInfo = typeof (Instruction).GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, new[] {typeof (OpCode), typeof (object)}, null);
     this.moduleReader = moduleReader;
     this.assemblyResolver = assemblyResolver;
     this.embedTask = embedTask;
 }
开发者ID:sachhi,项目名称:costura,代码行数:7,代码来源:AssemblyLoaderImporter.cs

示例4: Should_exception_if_type_not_found

 public void Should_exception_if_type_not_found()
 {
     var job = new PrivateJob { Type = "someType" };
     assemblyResolver = new AssemblyResolver(this.dir, log);
     //Test
     var ex = Assert.Throws<PluginNotFoundOrLoadedException>(() => assemblyResolver.ResolveType(job));
     //Assert
     Assert.That(ex.Message, Is.EqualTo(string.Format("The plugin someType is not found or loaded")));
 }
开发者ID:perryofpeek,项目名称:SqlToGraphite-core,代码行数:9,代码来源:With_AssemblyResolver.cs

示例5: DefaultResolve

        public void DefaultResolve()
        {

            var resolver = new AssemblyResolver();
            resolver.Should().NotBeNull();

            var assemblies = resolver.Resolve().ToList();
            assemblies.Should().NotBeEmpty();
            assemblies.Should().Contain(a => a.FullName.StartsWith("System"));

        }
开发者ID:modulexcite,项目名称:KickStart,代码行数:11,代码来源:AssemblyResolverTest.cs

示例6: IncludeAssemblyForTestCore

        public void IncludeAssemblyForTestCore()
        {
            var resolver = new AssemblyResolver();
            resolver.Should().NotBeNull();

            resolver.IncludeAssemblyFor<SampleWorker>();

            var assemblies = resolver.Resolve().ToList();
            assemblies.Should().NotBeEmpty();
            assemblies.Count.Should().Be(1);
            assemblies.Should().Contain(a => a == typeof(SampleWorker).Assembly);
        }
开发者ID:modulexcite,项目名称:KickStart,代码行数:12,代码来源:AssemblyResolverTest.cs

示例7: Should_Resolve_type_sucessfuly

 public void Should_Resolve_type_sucessfuly()
 {
     var job = new WmiClient();
     var files = new List<string>() { string.Format(@"{0}\SqlToGraphite.Plugin.Wmi.dll", Directory.GetCurrentDirectory()) };
     dir.Expect(x => x.GetFilesInCurrentDirectory(AssemblyResolver.FilesToScan)).Return(files);
     //Test
     assemblyResolver = new AssemblyResolver(this.dir, log);
     var rtn = assemblyResolver.ResolveType(job);
     //Assert
     Assert.That(rtn.FullName, Is.EqualTo(job.GetType().FullName));
     dir.VerifyAllExpectations();
 }
开发者ID:perryofpeek,项目名称:SqlToGraphite-core,代码行数:12,代码来源:With_AssemblyResolver.cs

示例8: CreateAssemblyResolver

        public void CreateAssemblyResolver(IEnumerable<string> paths)
        {
            string appDataKey = typeof (AssemblyResolver).FullName;
            resolver = (AssemblyResolver)AppDomain.CurrentDomain.GetData(appDataKey)
                       ?? new AssemblyResolver(new ConsoleLog());
            AppDomain.CurrentDomain.SetData(appDataKey, resolver);

            foreach (var path in paths)
            {
                resolver.AddDirectory(path);
            }
        }
开发者ID:ayezutov,项目名称:NDistribUnit,代码行数:12,代码来源:InAnotherDomainResolverCreator.cs

示例9: ExcludeSystem

        public void ExcludeSystem()
        {
            var domainAssemblies = AppDomain.CurrentDomain.GetAssemblies();

            var resolver = new AssemblyResolver();
            resolver.Should().NotBeNull();

            resolver.ExcludeName("System");

            var assemblies = resolver.Resolve().ToList();
            assemblies.Should().NotBeEmpty();
            assemblies.Should().NotContain(a => a.FullName.StartsWith("System"));
        }
开发者ID:modulexcite,项目名称:KickStart,代码行数:13,代码来源:AssemblyResolverTest.cs

示例10: Configuration

        /// <summary>
        /// Initializes a new instance of the <see cref="Configuration"/> class.
        /// </summary>
        public Configuration()
        {
            _assemblies = new AssemblyResolver();

            // exclude system assemblies
            _assemblies.ExcludeName("mscorlib");
            _assemblies.ExcludeName("Microsoft");
            _assemblies.ExcludeName("System");
            
            // exclude self
            _assemblies.ExcludeName("KickStart");

            _starters = new List<IKickStarter>();
        }
开发者ID:modulexcite,项目名称:KickStart,代码行数:17,代码来源:Configuration.cs

示例11: Should_ignore_bad_image_exception_for_not_dot_net_dlls

 public void Should_ignore_bad_image_exception_for_not_dot_net_dlls()
 {
     File.WriteAllText("bad.dll", "abc");
     var job = new WmiClient() { Type = "SqlToGraphite.Plugin.Wmi.WmiClient" };
     var files = new List<string>() { string.Format(@"{0}\bad.dll", Directory.GetCurrentDirectory()), string.Format(@"{0}\SqlToGraphite.Plugin.Wmi.dll", Directory.GetCurrentDirectory()) };
     dir.Expect(x => x.GetFilesInCurrentDirectory(AssemblyResolver.FilesToScan)).Return(files);
     //Test
     assemblyResolver = new AssemblyResolver(this.dir, log);
     //Test
     var type = assemblyResolver.ResolveType(job);
     //Assert
     Assert.That(type.FullName, Is.EqualTo(job.GetType().FullName));
     File.Delete("bad.dll");
 }
开发者ID:perryofpeek,项目名称:SqlToGraphite-core,代码行数:14,代码来源:With_AssemblyResolver.cs

示例12: SqlToGraphiteConfig

        public SqlToGraphiteConfig()
        {
            var job = new JobImpl();
            this.WireUpLog4Net();
            var assemblyResolver = new AssemblyResolver(new DirectoryImpl(), log);
            jobTypes = assemblyResolver.ResolveTypes(job);
            alljobtypes = assemblyResolver.ResolveAllTypes(job);
            //JobTypes = GetJobTypes().ToArray();
            clientTypes = GetClientTypes().ToArray();

            this.Jobs = new List<Job>();
            this.Clients = new ListOfUniqueType<Client>();
            this.Hosts = new List<Host>();
            this.Templates = new List<Template>();
            this.genericSerializer = new GenericSerializer(Global.GetNameSpace());
        }
开发者ID:perryofpeek,项目名称:SqlToGraphite-core,代码行数:16,代码来源:SqlToGraphiteConfig.cs

示例13: CompilerBase

        public CompilerBase(
            IFrontEnd frontEnd, IMiddleEnd middleEnd, IBackEnd backEnd,
            CompilerOptions options
            )
        {
            _options = options;

            _frontEnd = frontEnd;
            _middleEnd = middleEnd;
            _backEnd = backEnd;

            _frontEnd.Compiler = this;
            _middleEnd.Compiler = this;
            _backEnd.Compiler = this;

            _resolver = new AssemblyResolver(this);
        }
开发者ID:sidecut,项目名称:xaeios,代码行数:17,代码来源:CompilerBase.cs

示例14: ConfigRepository

 public ConfigRepository(IConfigReader configReader, ICache cache, ISleep sleep, ILog log,
     int errorReadingConfigSleepTime, IGenericSerializer genericSerializer)
 {
     this.configReader = configReader;
     this.cache = cache;
     this.sleep = sleep;
     ConfigRepository.log = log;
     this.errorReadingConfigSleepTime = errorReadingConfigSleepTime;
     this.genericSerializer = genericSerializer;
     clientList = new GraphiteClients();
     var dir = new DirectoryImpl();
     if (ar == null)
     {
         ar = new AssemblyResolver(dir, log);
     }
     this.masterConfig = new SqlToGraphiteConfig(ar, log);
     this.Hash = "NotSet";
 }
开发者ID:perryofpeek,项目名称:SqlToGraphite-core,代码行数:18,代码来源:ConfigRepository.cs

示例15: Find

		void Find() {
			var cflowDeobfuscator = new CflowDeobfuscator(new MethodCallInliner(true));

			foreach (var type in module.Types) {
				if (DotNetUtils.GetPInvokeMethod(type, "kernel32", "CloseHandle") == null)
					continue;

				var resolver = new AssemblyResolver(type, cflowDeobfuscator);
				if (!resolver.Detected)
					continue;
				var patcher = new MemoryPatcher(type, cflowDeobfuscator);
				if (!patcher.Detected)
					continue;

				assemblyResolver = resolver;
				memoryPatcher = patcher;
				return;
			}
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:19,代码来源:ApplicationModeDecrypter.cs


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