本文整理汇总了C#中Mono.Cecil.ModuleDefinition.GetTypeReferences方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleDefinition.GetTypeReferences方法的具体用法?C# ModuleDefinition.GetTypeReferences怎么用?C# ModuleDefinition.GetTypeReferences使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Cecil.ModuleDefinition
的用法示例。
在下文中一共展示了ModuleDefinition.GetTypeReferences方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetExpandedTypeDependanceList
private ICollection<TypeReference> GetExpandedTypeDependanceList(ModuleDefinition module)
{
Mono.Collections.Generic.Collection<TypeDefinition> moduleTypes;
if (!UserDefinedTypes.TryGetValue(module, out moduleTypes))
{
throw new Exception("Module types not found.");
}
HashSet<TypeReference> firstLevelDependanceTypes = new HashSet<TypeReference>();
foreach (TypeReference type in moduleTypes)
{
if (!firstLevelDependanceTypes.Contains(type))
{
firstLevelDependanceTypes.Add(type);
}
}
foreach (TypeReference type in module.GetTypeReferences())
{
if (!firstLevelDependanceTypes.Contains(type))
{
firstLevelDependanceTypes.Add(type);
}
}
return Telerik.JustDecompiler.Decompiler.Utilities.GetExpandedTypeDependanceList(firstLevelDependanceTypes);
}
示例2: findTypeReference
public static TypeReference findTypeReference(ModuleDefinition module, string asmSimpleName, string fullName)
{
foreach (var type in module.GetTypeReferences()) {
if (type.FullName != fullName)
continue;
var asmRef = type.Scope as AssemblyNameReference;
if (asmRef == null || asmRef.Name != asmSimpleName)
continue;
return type;
}
return null;
}
示例3: GetModuleDependsOnAnalysis
private ICollection<AssemblyNameReference> GetModuleDependsOnAnalysis(ModuleDefinition module)
{
Mono.Collections.Generic.Collection<TypeDefinition> assemblyModuleTypes = module.Types;
HashSet<TypeReference> firstLevelDependanceTypes = new HashSet<TypeReference>();
foreach (TypeReference type in assemblyModuleTypes)
{
if (!firstLevelDependanceTypes.Contains(type))
{
firstLevelDependanceTypes.Add(type);
}
}
foreach (TypeReference type in module.GetTypeReferences())
{
if (!firstLevelDependanceTypes.Contains(type))
{
firstLevelDependanceTypes.Add(type);
}
}
ICollection<TypeReference> expadendTypeDependanceList = Utilities.GetExpandedTypeDependanceList(firstLevelDependanceTypes);
ICollection<AssemblyNameReference> dependingOnAssemblies = Utilities.GetAssembliesDependingOn(module, expadendTypeDependanceList);
foreach (AssemblyNameReference assemblyReference in module.AssemblyReferences)
{
if (!dependingOnAssemblies.Contains(assemblyReference))
{
dependingOnAssemblies.Add(assemblyReference);
}
}
return dependingOnAssemblies;
}