本文整理汇总了C#中ITypeDefOrRef类的典型用法代码示例。如果您正苦于以下问题:C# ITypeDefOrRef类的具体用法?C# ITypeDefOrRef怎么用?C# ITypeDefOrRef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITypeDefOrRef类属于命名空间,在下文中一共展示了ITypeDefOrRef类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: BaseTypeNodeImpl
public BaseTypeNodeImpl(ITreeNodeGroup treeNodeGroup, ITypeDefOrRef typeDefOrRef, bool isBaseType) {
TreeNodeGroup = treeNodeGroup;
this.isBaseType = isBaseType;
// Keep weak refs to them so we won't prevent removed modules from being GC'd.
weakRefTypeDefOrRef = new WeakReference(typeDefOrRef);
weakRefResolvedTypeDef = new WeakReference(null);
}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:7,代码来源:BaseTypeNodeImpl.cs
示例2: IsGenericParam
bool IsGenericParam(ITypeDefOrRef tdr) {
var ts = tdr as TypeSpec;
if (ts == null)
return false;
var sig = ts.TypeSig.RemovePinnedAndModifiers();
return sig is GenericSig;
}
开发者ID:GreenDamTan,项目名称:de4dot,代码行数:7,代码来源:TypeNames.cs
示例3: TypeDefOrRefSignature
public TypeDefOrRefSignature(ITypeDefOrRef type, bool isValueType)
{
if (type == null)
throw new ArgumentNullException("type");
Type = type;
IsValueType = isValueType;
}
开发者ID:JerreS,项目名称:AsmResolver,代码行数:7,代码来源:TypeDefOrRefSignature.cs
示例4: Create
public static EventDefOptions Create(UTF8String name, ITypeDefOrRef eventType) {
return new EventDefOptions {
Attributes = 0,
Name = name,
EventType = eventType,
};
}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:7,代码来源:EventDefOptions.cs
示例5: getTypeInstance
TypeInstanceResolver getTypeInstance(ITypeDefOrRef typeRef)
{
TypeInstanceResolver instance;
if (!typeRefToInstance.TryGetValue(typeRef, out instance))
typeRefToInstance[typeRef] = instance = new TypeInstanceResolver(type, typeRef);
return instance;
}
开发者ID:GodLesZ,项目名称:ConfuserDeobfuscator,代码行数:7,代码来源:TypeResolver.cs
示例6: IsReferencedBy
static bool IsReferencedBy(TypeDef type, ITypeDefOrRef typeRef, int depth) {
if (depth >= 30)
return false;
// TODO: move it to a better place after adding support for more cases.
if (type == null)
return false;
if (typeRef == null)
return false;
if (type == typeRef)
return true;
if (type.Name != typeRef.Name)
return false;
if (type.Namespace != typeRef.Namespace)
return false;
if (type.DeclaringType != null || typeRef.DeclaringType != null) {
if (type.DeclaringType == null || typeRef.DeclaringType == null)
return false;
if (!IsReferencedBy(type.DeclaringType, typeRef.DeclaringType, depth + 1))
return false;
}
return true;
}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:25,代码来源:Helpers.cs
示例7: GenericInstanceTypeSignature
public GenericInstanceTypeSignature(ITypeDefOrRef genericType)
{
if (genericType == null)
throw new ArgumentNullException("genericType");
GenericType = genericType;
GenericArguments = new List<TypeSignature>();
}
开发者ID:JerreS,项目名称:AsmResolver,代码行数:7,代码来源:GenericInstanceTypeSignature.cs
示例8: AddInitializeArrayCode
public void AddInitializeArrayCode(Block block, int start, int numToRemove, ITypeDefOrRef elementType, byte[] data) {
int index = start;
block.Replace(index++, numToRemove, Instruction.CreateLdcI4(data.Length / elementType.ToTypeSig().ElementType.GetPrimitiveSize()));
block.Insert(index++, OpCodes.Newarr.ToInstruction(elementType));
block.Insert(index++, OpCodes.Dup.ToInstruction());
block.Insert(index++, OpCodes.Ldtoken.ToInstruction((IField)Create(data)));
block.Insert(index++, OpCodes.Call.ToInstruction((IMethod)InitializeArrayMethod));
}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:8,代码来源:InitializedDataCreator.cs
示例9: BaseTypesEntryNode
public BaseTypesEntryNode(ITypeDefOrRef tr, bool isInterface) {
if (tr == null)
throw new ArgumentNullException("tr");
this.tr = tr;
this.def = tr.ResolveTypeDef();
this.isInterface = isInterface;
this.LazyLoading = true;
}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:8,代码来源:BaseTypesEntryNode.cs
示例10: Create
public static ITypeDefOrRef Create(ITypeDefOrRef type, IList<TypeSig> genericArgs) {
if (genericArgs == null || genericArgs.Count == 0)
return type;
var ts = type as TypeSpec;
if (ts == null)
return type;
var newSig = Create(ts.TypeSig, genericArgs);
return newSig == ts.TypeSig ? type : new TypeSpecUser(newSig);
}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:9,代码来源:GenericArgsSubstitutor.cs
示例11: GetNonGenericTypeRef
static ITypeDefOrRef GetNonGenericTypeRef(ITypeDefOrRef typeRef) {
var ts = typeRef as TypeSpec;
if (ts == null)
return typeRef;
var gis = ts.TryGetGenericInstSig();
if (gis == null || gis.GenericType == null)
return typeRef;
return gis.GenericType.TypeDefOrRef;
}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:9,代码来源:DeobfuscatorContext.cs
示例12: Create
public static TypeDefOptions Create(UTF8String ns, UTF8String name, ITypeDefOrRef baseType, bool isNestedType) {
return new TypeDefOptions {
Attributes = (isNestedType ? TypeAttributes.NestedPublic : TypeAttributes.Public) | TypeAttributes.AutoLayout | TypeAttributes.Class | TypeAttributes.AnsiClass,
Namespace = ns ?? UTF8String.Empty,
Name = name ?? UTF8String.Empty,
PackingSize = null,
ClassSize = null,
BaseType = baseType,
};
}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:10,代码来源:TypeDefOptions.cs
示例13: IsMarkupExtensions
static bool IsMarkupExtensions(ITypeDefOrRef def)
{
while (def != null)
{
if (def.Namespace == "OmniXaml" && def.Name.String == "MarkupExtension")
return true;
def = def.GetBaseType();
}
return false;
}
开发者ID:kekekeks,项目名称:PerspexVS,代码行数:10,代码来源:MetadataLoader.cs
示例14: resolve
public Type resolve(ITypeDefOrRef typeRef)
{
var resolver = getTypeResolver(typeRef);
if (resolver != null)
return resolver.type;
var ts = typeRef as TypeSpec;
if (ts != null && ts.TypeSig is GenericSig)
return typeof(MGenericParameter);
return null;
}
开发者ID:n017,项目名称:ConfuserDeobfuscator,代码行数:12,代码来源:AssemblyResolver.cs
示例15: Compare
static bool Compare(ITypeDefOrRef type, UTF8String expNs, UTF8String expName) {
if (type == null)
return false;
var tr = type as TypeRef;
if (tr != null)
return tr.Namespace == expNs && tr.Name == expName;
var td = type as TypeDef;
if (td != null)
return td.Namespace == expNs && td.Name == expName;
return false;
}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:13,代码来源:AssemblyInfoTransform.cs
示例16: RenderType
public static void RenderType(ITypeDefOrRef type, Graphics g, Rectangle bounds) {
var typeDef = type as TypeDef;
if (typeDef == null) {
g.DrawImageUnscaledAndClipped(Resources.GetResource<Image>("Icons.ObjModel.type.png"), bounds);
return;
}
Image icon, visibility;
icon = Resources.GetResource<Image>("Icons.ObjModel.type.png");
if (typeDef.IsInterface) {
icon = Resources.GetResource<Image>("Icons.ObjModel.interface.png");
}
else if (typeDef.BaseType != null) {
if (typeDef.IsEnum) {
icon = Resources.GetResource<Image>("Icons.ObjModel.enum.png");
}
else if (typeDef.IsValueType && !typeDef.IsAbstract) {
icon = Resources.GetResource<Image>("Icons.ObjModel.valuetype.png");
}
else if (typeDef.IsDelegate()) {
icon = Resources.GetResource<Image>("Icons.ObjModel.delegate.png");
}
}
switch (typeDef.Visibility) {
case TypeAttributes.NotPublic:
case TypeAttributes.NestedAssembly:
case TypeAttributes.NestedFamANDAssem:
visibility = Resources.GetResource<Image>("Icons.ObjModel.internal.png");
break;
case TypeAttributes.NestedPrivate:
visibility = Resources.GetResource<Image>("Icons.ObjModel.private.png");
break;
case TypeAttributes.NestedFamily:
visibility = Resources.GetResource<Image>("Icons.ObjModel.protected.png");
break;
case TypeAttributes.NestedFamORAssem:
visibility = Resources.GetResource<Image>("Icons.ObjModel.famasm.png");
break;
case TypeAttributes.Public:
case TypeAttributes.NestedPublic:
default:
visibility = null;
break;
}
g.DrawImageUnscaledAndClipped(icon, bounds);
if (visibility != null)
g.DrawImageUnscaledAndClipped(visibility, bounds);
}
开发者ID:mamingxiu,项目名称:dnExplorer,代码行数:51,代码来源:ObjectIconRenderer.cs
示例17: ExceptionInfo
public ExceptionInfo(int tryStart, int tryEnd, int filterStart,
int handlerStart, int handlerEnd, ITypeDefOrRef catchType,
ExceptionHandlerType handlerType) {
if (tryStart > tryEnd || filterStart > handlerStart ||
tryStart < 0 || tryEnd < 0 || filterStart < 0 || handlerStart < 0 || handlerEnd < 0)
throw new ApplicationException("Invalid start/end/filter/handler indexes");
this.tryStart = tryStart;
this.tryEnd = tryEnd;
this.filterStart = filterStart == handlerStart ? -1 : filterStart;
this.handlerStart = handlerStart;
this.handlerEnd = handlerEnd;
this.catchType = catchType;
this.handlerType = handlerType;
}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:14,代码来源:CodeGenerator.cs
示例18: ResolveType
public TypeDef ResolveType(ITypeDefOrRef type) {
if (type == null)
return null;
type = GetNonGenericTypeRef(type);
var typeDef = type as TypeDef;
if (typeDef != null)
return typeDef;
var tr = type as TypeRef;
if (tr != null)
return tr.Resolve();
return null;
}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:15,代码来源:DeobfuscatorContext.cs
示例19: ResolveField
/// <summary>
/// Resolve an IField from its name and the resolved delcaring type.
/// </summary>
/// <param name="declaringType">Declaring type</param>
/// <param name="fieldName">Field name</param>
/// <returns>IField, or null if none found</returns>
public IField ResolveField(ITypeDefOrRef declaringType, String fieldName)
{
if (declaringType is TypeSpec)
return ResolveField(declaringType as TypeSpec, fieldName);
TypeDef typeDef = null;
if (declaringType is TypeDef)
typeDef = declaringType as TypeDef;
else if (declaringType is TypeRef)
typeDef = (declaringType as TypeRef).ResolveTypeDef();
if (typeDef != null)
return this.Importer.Import(typeDef.FindField(fieldName));
else
return null;
}
开发者ID:misharcrack,项目名称:eazdevirt,代码行数:22,代码来源:NameResolver.cs
示例20: GetTypeResolver
TypeResolver GetTypeResolver(ITypeDefOrRef typeRef) {
if (typeRef == null)
return null;
var scopeType = typeRef.ScopeType;
var key = scopeType.Namespace + "." + scopeType.TypeName;
List<TypeResolver> list;
if (!types.TryGetValue(key, out list))
return null;
if (scopeType is TypeDef) {
foreach (var resolver in list) {
if (resolver.type.MetadataToken == scopeType.MDToken.Raw)
return resolver;
}
}
foreach (var resolver in list) {
if (ResolverUtils.CompareTypes(resolver.type, scopeType))
return resolver;
}
return null;
}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:23,代码来源:AssemblyResolver.cs
注:本文中的ITypeDefOrRef类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论