本文整理汇总了C#中Mono.Cecil.ModuleDefinition.FindMatchingType方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleDefinition.FindMatchingType方法的具体用法?C# ModuleDefinition.FindMatchingType怎么用?C# ModuleDefinition.FindMatchingType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Cecil.ModuleDefinition
的用法示例。
在下文中一共展示了ModuleDefinition.FindMatchingType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetInjecteeCecilType
internal virtual TypeDefinition GetInjecteeCecilType(ModuleDefinition module)
{
if (_injecteeCecilDef == null)
_injecteeCecilDef = module.FindMatchingType(InjecteeType, true);
return _injecteeCecilDef;
}
示例2: Import
internal TypeReference Import(ModuleDefinition module, IMetadataScope scope, IInjector injector)
{
var reference = new TypeReference(
ParentType == null ? Attr.Namespace : "",
InjecteeType.Name,
module,
module.ImportScope(injector.MapMetadataScope(scope)),
InjecteeType.IsValueType);
MetadataSystem.TryProcessPrimitiveTypeReference(reference);
if (ParentType != null)
{
var declDef = module.FindMatchingType(ParentType, true);
reference.DeclaringType = CreateDeclRef(declDef, module, injector);
}
if (InjecteeType.ContainsGenericParameters)
CecilHelpers.ImportGenericParameters(reference, InjecteeType);
return reference;
}
示例3: GetTargetCecilType
internal virtual TypeDefinition GetTargetCecilType(ModuleDefinition module)
{
if (_targetCecilDef == null)
_targetCecilDef = module.FindMatchingType(TargetType, true);
return _targetCecilDef;
}
示例4: CloneType
private TypeDefinition CloneType(ModuleDefinition module, string nameSpace, TypeDefinition source, Type parentType)
{
TypeDefinition parentDef = null;
if (parentType != null)
{
nameSpace = "";
parentDef = module.FindMatchingType(parentType, true);
}
var clone = new TypeDefinition(nameSpace, source.Name, source.Attributes);
clone.IsValueType = source.IsValueType;
if (parentDef != null)
parentDef.NestedTypes.Add(clone);
else
module.Types.Add(clone);
foreach (var g in source.GenericParameters)
clone.GenericParameters.Add(CloneGenericParameter(clone, g));
foreach (var i in source.Interfaces)
clone.Interfaces.Add(FixTypeImport(module, i));
foreach (var f in source.Fields)
clone.Fields.Add(CloneField(clone, f));
foreach (var e in source.Events)
clone.Events.Add(CloneEvent(clone, e));
foreach (var p in source.Properties)
clone.Properties.Add(CloneProperty(clone, p));
foreach (var m in source.Methods)
{
var cloneMethod = CloneMethodWithoutBody(clone, m);
CloneMethodBody(m, cloneMethod);
}
clone.BaseType = FixTypeImport(module, source.BaseType);
return clone;
}