本文整理汇总了C#中ModuleDef.GetAssemblyRefs方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleDef.GetAssemblyRefs方法的具体用法?C# ModuleDef.GetAssemblyRefs怎么用?C# ModuleDef.GetAssemblyRefs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModuleDef
的用法示例。
在下文中一共展示了ModuleDef.GetAssemblyRefs方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResXProjectFile
public ResXProjectFile(ModuleDef module, string filename, string typeFullName, EmbeddedResource er) {
this.filename = filename;
TypeFullName = typeFullName;
embeddedResource = er;
newToOldAsm = new Dictionary<IAssembly, IAssembly>(new AssemblyNameComparer(AssemblyNameComparerFlags.All & ~AssemblyNameComparerFlags.Version));
foreach (var asmRef in module.GetAssemblyRefs())
newToOldAsm[asmRef] = asmRef;
}
示例2: GetAssemblyRefs
IEnumerable<IAssembly> GetAssemblyRefs(ModuleDef module, IEnumerable<string> extraAssemblyReferences) {
foreach (var a in module.GetAssemblyRefs())
yield return a;
foreach (var s in extraAssemblyReferences) {
var info = new AssemblyNameInfo(s);
if (info.Version != null)
yield return info;
}
}
示例3: GetDotNetVersion2035Internal
static Dnr2035Version GetDotNetVersion2035Internal(ModuleDef module) {
var ver = Dnr2035Version.V20;
foreach (var r in module.GetAssemblyRefs()) {
if (dotNet35Asms.Contains(r.FullName))
return Dnr2035Version.V35;
if (dotNet30Asms.Contains(r.FullName))
ver = Dnr2035Version.V30;
}
var asm = module.Assembly;
if (asm != null && module.IsManifestModule) {
if (dotNet35Asms.Contains(asm.FullName))
return Dnr2035Version.V35;
if (dotNet30Asms.Contains(asm.FullName))
ver = Dnr2035Version.V30;
}
return ver;
}
示例4: GetModules
static IEnumerable<ModuleDef> GetModules(ModuleDef module) {
yield return module;
foreach (var asmRef in module.GetAssemblyRefs()) {
var asm = module.Context.AssemblyResolver.Resolve(asmRef, module);
if (asm != null)
yield return asm.ManifestModule;
}
}
示例5: GetResolvedContractAssemblies
IEnumerable<AssemblyDef> GetResolvedContractAssemblies(ModuleDef module) {
var nonContractAsms = new HashSet<IAssembly>(AssemblyNameComparer.CompareAll);
var stack = new Stack<AssemblyRef>(module.GetAssemblyRefs());
while (stack.Count > 0) {
cancellationToken.ThrowIfCancellationRequested();
var asmRef = stack.Pop();
if (!contractsPublicKeyToken.Equals(asmRef.PublicKeyOrToken?.Token))
continue;
if (checkedContractsAssemblies.Contains(asmRef))
continue;
checkedContractsAssemblies.Add(asmRef);
var contractsAsm = module.Context.AssemblyResolver.Resolve(asmRef, module);
if (contractsAsm != null) {
yield return contractsAsm;
foreach (var m in contractsAsm.Modules) {
foreach (var ar in m.GetAssemblyRefs()) {
cancellationToken.ThrowIfCancellationRequested();
if (contractsPublicKeyToken.Equals(ar.PublicKeyOrToken))
stack.Push(ar);
else
nonContractAsms.Add(ar);
}
}
}
}
foreach (var asmRef in nonContractAsms) {
cancellationToken.ThrowIfCancellationRequested();
var asm = module.Context.AssemblyResolver.Resolve(asmRef, module);
if (asm != null)
yield return asm;
}
}
示例6: IsNonSupportedAssembly
static bool IsNonSupportedAssembly(ModuleDef module, AssemblyDef asm, IAssembly assembly) {
if (AssemblyNameComparer.NameAndPublicKeyTokenOnly.Equals(asm, assembly))
return true;
foreach (var asmRef in module.GetAssemblyRefs()) {
if (AssemblyNameComparer.NameAndPublicKeyTokenOnly.Equals(asmRef, assembly))
return true;
}
return false;
}