本文整理汇总了C#中AssemblyResolver类的典型用法代码示例。如果您正苦于以下问题:C# AssemblyResolver类的具体用法?C# AssemblyResolver怎么用?C# AssemblyResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AssemblyResolver类属于命名空间,在下文中一共展示了AssemblyResolver类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: ShouldReturnAssembliesFromPackagesFolder
public void ShouldReturnAssembliesFromPackagesFolder()
{
const string WorkingDirectory = @"C:\";
var packagesFolder = Path.Combine(WorkingDirectory, Constants.PackagesFolder);
var assemblyFile = Path.Combine(packagesFolder, "MyAssembly.dll");
var fileSystem = new Mock<IFileSystem>();
fileSystem.Setup(x => x.DirectoryExists(packagesFolder)).Returns(true);
var packageAssemblyResolver = new Mock<IPackageAssemblyResolver>();
packageAssemblyResolver.Setup(x => x.GetAssemblyNames(WorkingDirectory, It.IsAny<Action<string>>())).Returns(new[] { assemblyFile });
var resolver = new AssemblyResolver(fileSystem.Object, packageAssemblyResolver.Object, Mock.Of<IAssemblyUtility>(), Mock.Of<ILog>());
var assemblies = resolver.GetAssemblyPaths(WorkingDirectory).ToList();
assemblies.Count.ShouldEqual(1);
assemblies[0].ShouldEqual(assemblyFile);
}
开发者ID:jonparker,项目名称:scriptcs,代码行数:20,代码来源:AssemblyResolverTests.cs
示例17: ShouldNotReturnScriptDll
public void ShouldNotReturnScriptDll()
{
const string WorkingDirectory = @"C:\";
var binFolder = Path.Combine(WorkingDirectory, "bin");
var scriptDll = Path.Combine(binFolder, "script.dll");
var fileSystem = new Mock<IFileSystem>();
fileSystem.Setup(x => x.DirectoryExists(binFolder)).Returns(true);
fileSystem.Setup(x => x.EnumerateFiles(binFolder, It.IsAny<string>(), SearchOption.AllDirectories))
.Returns(new[] { scriptDll });
var assemblyUtility = new Mock<IAssemblyUtility>();
assemblyUtility.Setup(x => x.IsManagedAssembly(scriptDll)).Returns(true);
var resolver = new AssemblyResolver(fileSystem.Object, Mock.Of<IPackageAssemblyResolver>(), assemblyUtility.Object, Mock.Of<ILog>());
var assemblies = resolver.GetAssemblyPaths(WorkingDirectory, "script.csx").ToList();
assemblies.Count.ShouldEqual(0);
}
开发者ID:kusl,项目名称:scriptcs,代码行数:21,代码来源:AssemblyResolverTests.cs
示例18: ShouldReturnAssembliesFromBinFolder
public void ShouldReturnAssembliesFromBinFolder()
{
const string WorkingDirectory = @"C:\";
var binFolder = Path.Combine(WorkingDirectory, Constants.BinFolder);
var assemblyFile = Path.Combine(binFolder, "MyAssembly.dll");
var fileSystem = new Mock<IFileSystem>();
fileSystem.Setup(x => x.DirectoryExists(binFolder)).Returns(true);
fileSystem.Setup(x => x.EnumerateFiles(binFolder, It.IsAny<string>(), SearchOption.AllDirectories)).Returns(new[] { assemblyFile });
var assemblyUtility = new Mock<IAssemblyUtility>();
assemblyUtility.Setup(x => x.IsManagedAssembly(assemblyFile)).Returns(true);
var resolver = new AssemblyResolver(fileSystem.Object, Mock.Of<IPackageAssemblyResolver>(), assemblyUtility.Object, Mock.Of<ILog>());
var assemblies = resolver.GetAssemblyPaths(WorkingDirectory).ToList();
assemblies.Count.ShouldEqual(1);
assemblies[0].ShouldEqual(assemblyFile);
}
开发者ID:Jaydeep7,项目名称:scriptcs,代码行数:21,代码来源:AssemblyResolverTests.cs
示例19: CreateTaskManager
public static TaskManager CreateTaskManager(SqlToGraphiteSection configuration)
{
var cacheLength = new TimeSpan(0, configuration.ConfigCacheLengthMinutes, 0);
var stop = new Stop();
var directoryImpl = new DirectoryImpl();
var assemblyResolver = new AssemblyResolver(directoryImpl, log);
IEncryption encryption = new Encryption();
IDataClientFactory dataClientFactory = new DataClientFactory(log, assemblyResolver, encryption);
IGraphiteClientFactory graphiteClientFactory = new GraphiteClientFactory(log);
var configReader = new ConfigHttpReader(configuration.ConfigUri, configuration.ConfigUsername, configuration.ConfigPassword);
var cache = new Cache(cacheLength, log);
var sleeper = new Sleeper();
var genericSer = new GenericSerializer(Global.GetNameSpace());
var cr = new ConfigRepository(configReader, cache, sleeper, log, configuration.MinutesBetweenRetryToGetConfigOnError, genericSer);
var configMapper = new ConfigMapper(configuration.Hostname, stop, dataClientFactory, graphiteClientFactory, log, cr);
var roleConfigFactory = new RoleConfigFactory();
var environment = new Environment();
var taskSetBuilder = new TaskSetBuilder();
var configController = new ConfigController(configMapper, log, cr, roleConfigFactory, environment, taskSetBuilder);
return new TaskManager(log, configController, configuration.ConfigUri, stop, sleeper, configuration.CheckConfigUpdatedEveryMinutes);
}
开发者ID:perryofpeek,项目名称:SqlToGraphite-core,代码行数:22,代码来源:Program.cs
示例20: ShouldReturnAssembliesFromPackagesFolder
public void ShouldReturnAssembliesFromPackagesFolder(
[Frozen] Mock<IFileSystem> fileSystemMock,
[Frozen] Mock<IPackageAssemblyResolver> packageAssemblyResolverMock,
AssemblyResolver resolver
)
{
const string WorkingDirectory = @"C:\";
var packagesFolder = Path.Combine(WorkingDirectory, "packages");
var assemblyFile = Path.Combine(packagesFolder, "MyAssembly.dll");
fileSystemMock.Setup(x => x.DirectoryExists(packagesFolder)).Returns(true);
fileSystemMock.SetupGet(x => x.PackagesFolder).Returns("packages");
fileSystemMock.SetupGet(x => x.BinFolder).Returns("bin");
packageAssemblyResolverMock.Setup(x => x.GetAssemblyNames(WorkingDirectory)).Returns(new[] { assemblyFile });
var assemblies = resolver.GetAssemblyPaths(WorkingDirectory).ToList();
assemblies.Count.ShouldEqual(1);
assemblies[0].ShouldEqual(assemblyFile);
}
开发者ID:selony,项目名称:scriptcs,代码行数:22,代码来源:AssemblyResolverTests.cs
注:本文中的AssemblyResolver类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论