Inheritance: BlobSignature, ITypeDescriptor
コード例 #1
0
        public static CustomAttributeArgument FromReader(MetadataHeader header, TypeSignature typeSignature, IBinaryStreamReader reader)
        {
            var signature = new CustomAttributeArgument()
            {
                StartOffset = reader.Position,
                ArgumentType = typeSignature
            };

            if (typeSignature.ElementType != ElementType.SzArray)
            {
                signature.Elements.Add(ElementSignature.FromReader(header, typeSignature, reader));
            }
            else
            {
                var arrayType = ((SzArrayTypeSignature)typeSignature).BaseType;

                var elementCount = reader.CanRead(sizeof (uint)) ? reader.ReadUInt32() : uint.MaxValue;
                if (elementCount != uint.MaxValue)
                {
                    for (uint i = 0; i < elementCount; i++)
                    {
                        signature.Elements.Add(ElementSignature.FromReader(header, arrayType, reader));
                    }
                }
            }

            return signature;
        }
コード例 #2
0
 public CustomAttributeNamedArgument(CustomAttributeArgumentMemberType argumentMemberType, TypeSignature argumentType, string memberName, CustomAttributeArgument argument)
 {
     ArgumentMemberType = argumentMemberType;
     ArgumentType = argumentType;
     MemberName = memberName;
     Argument = argument;
 }
コード例 #3
0
 public static ElementSignature FromReader(MetadataHeader header, TypeSignature typeSignature, IBinaryStreamReader reader)
 {
     long position = reader.Position;
     return new ElementSignature(ReadValue(header, typeSignature, reader))
     {
         StartOffset = position
     };
 }
コード例 #4
0
 public CustomAttributeArgument(TypeSignature argumentType, params ElementSignature[] values)
     : this()
 {
     if (argumentType == null)
         throw new ArgumentNullException("argumentType");
     if (values == null)
         throw new ArgumentNullException("values");
     ArgumentType = argumentType;
     foreach (var value in values)
         Elements.Add(value);
 }
コード例 #5
0
ファイル: TypeNameBuilder.cs プロジェクト: JerreS/AsmResolver
        private static string GetFullName(TypeSignature signature)
        {
            var specification = signature as TypeSpecificationSignature;
            if (specification != null)
                return GetFullName(specification);

            var typeDefOrRef = signature as TypeDefOrRefSignature;
            if (typeDefOrRef != null)
                return typeDefOrRef.Type.FullName;

            var corlibType = signature as MsCorLibTypeSignature;
            if (corlibType != null)
                return corlibType.FullName;

            throw new NotSupportedException("Invalid or unsupported type signature: " + signature.FullName + ".");
        }
コード例 #6
0
ファイル: PointerTypeSignature.cs プロジェクト: xuhaoa/WinPIT
 public PointerTypeSignature(TypeSignature baseType)
     : base(baseType)
 {
 }
コード例 #7
0
 public new static RequiredModifierSignature FromReader(MetadataHeader header, IBinaryStreamReader reader)
 {
     return(new RequiredModifierSignature(ReadTypeDefOrRef(header, reader),
                                          TypeSignature.FromReader(header, reader)));
 }
コード例 #8
0
 public OptionalModifierSignature(ITypeDefOrRef modifierType, TypeSignature baseType)
     : base(baseType)
 {
     ModifierType = modifierType;
 }
コード例 #9
0
 public ParameterSignature(TypeSignature parameterType)
 {
     ParameterType = parameterType;
 }
コード例 #10
0
 public static ParameterSignature FromReader(MetadataImage image, IBinaryStreamReader reader)
 {
     return(new ParameterSignature(TypeSignature.FromReader(image, reader)));
 }
コード例 #11
0
ファイル: FieldSignature.cs プロジェクト: JerreS/AsmResolver
 public FieldSignature(TypeSignature fieldType)
 {
     Attributes = CallingConventionAttributes.Field;
     FieldType = fieldType;
 }
コード例 #12
0
ファイル: FieldRvaTests.cs プロジェクト: JerreS/AsmResolver
        private static void TestFieldRva(WindowsAssembly assembly, TypeSignature fieldType, byte[] fieldRvaData, bool saveToDisk)
        {
            // set up temp assembly.
            var tableStream = assembly.NetDirectory.MetadataHeader.GetStream<TableStream>();
            var fieldTable = tableStream.GetTable<FieldDefinition>();
            var fieldRvaTable = tableStream.GetTable<FieldRva>();

            // create temp field.
            var field = new FieldDefinition(FieldName,
                FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.HasFieldRva,
                new FieldSignature(fieldType));
            fieldTable.Add(field);

            // create field rva.
            var fieldRva = new FieldRva(field, fieldRvaData);
            field.FieldRva = fieldRva;
            fieldRvaTable.Add(fieldRva);

            assembly = Utilities.RebuildNetAssembly(assembly, saveToDisk);
            tableStream = assembly.NetDirectory.MetadataHeader.GetStream<TableStream>();
            fieldTable = tableStream.GetTable<FieldDefinition>();

            field = fieldTable.FirstOrDefault(x => x.Name == FieldName);
            Assert.IsNotNull(field);
            Assert.IsNotNull(field.FieldRva);
            Utilities.ValidateByteArrays(fieldRvaData, field.FieldRva.Data);
        }
コード例 #13
0
ファイル: MethodSignature.cs プロジェクト: JerreS/AsmResolver
 public MethodSignature(IEnumerable<TypeSignature> parameters, TypeSignature returnType)
     : this(parameters.Select(x => new ParameterSignature(x)), returnType)
 {
 }
コード例 #14
0
 public PropertySignature(TypeSignature propertyType, IEnumerable <ParameterSignature> parameters)
 {
     PropertyType = propertyType;
     Parameters   = new List <ParameterSignature>(parameters);
 }
コード例 #15
0
        /// <summary>
        /// Reads a single array type signature at the current position of the provided stream reader.
        /// </summary>
        /// <param name="image">The image the array was defined in.</param>
        /// <param name="reader">The reader to use.</param>
        /// <param name="protection">The recursion protection that is used to detect malicious loops in the metadata.</param>
        /// <returns>The read array.</returns>
        public static ArrayTypeSignature FromReader(MetadataImage image, IBinaryStreamReader reader, RecursionProtection protection)
        {
            var signature = new ArrayTypeSignature(TypeSignature.FromReader(image, reader, false, protection));

            // Rank
            if (!reader.TryReadCompressedUInt32(out uint rank))
            {
                return(signature);
            }

            // Sizes.
            if (!reader.TryReadCompressedUInt32(out uint numSizes))
            {
                return(signature);
            }

            var sizes = new List <uint>();

            for (int i = 0; i < numSizes; i++)
            {
                if (!reader.TryReadCompressedUInt32(out uint size))
                {
                    return(signature);
                }
                sizes.Add(size);
            }

            // Lower bounds.
            if (!reader.TryReadCompressedUInt32(out uint numLoBounds))
            {
                return(signature);
            }

            var loBounds = new List <uint>();

            for (int i = 0; i < numLoBounds; i++)
            {
                if (!reader.TryReadCompressedUInt32(out uint bound))
                {
                    return(signature);
                }
                loBounds.Add(bound);
            }

            // Create dimensions.
            for (int i = 0; i < rank; i++)
            {
                var dimension = new ArrayDimension();
                if (i < numSizes)
                {
                    dimension.Size = (int)sizes[i];
                }
                if (i < numLoBounds)
                {
                    dimension.LowerBound = (int)loBounds[i];
                }
                signature.Dimensions.Add(dimension);
            }

            return(signature);
        }
コード例 #16
0
 public PropertySignature(TypeSignature propertyType)
     : this(propertyType, Enumerable.Empty <ParameterSignature>())
 {
 }
コード例 #17
0
 public CustomAttributeArgument(TypeSignature argumentType, ElementSignature value)
     : this(argumentType, new[] { value })
 {
 }
コード例 #18
0
 public FieldSignature(TypeSignature fieldType)
 {
     Attributes = CallingConventionAttributes.Field;
     FieldType  = fieldType;
 }
コード例 #19
0
 /// <summary>
 /// Reads a single boxed type signature at the current position of the provided stream reader.
 /// </summary>
 /// <param name="image">The image the signature is defined in.</param>
 /// <param name="reader">The reader to use.</param>
 /// <param name="protection">The recursion protection that is used to detect malicious loops in the metadata.</param>
 /// <returns>The read signature.</returns>
 public static BoxedTypeSignature FromReader(MetadataImage image,
                                             IBinaryStreamReader reader,
                                             RecursionProtection protection)
 {
     return(new BoxedTypeSignature(TypeSignature.FromReader(image, reader, false, protection)));
 }
コード例 #20
0
        private static void VerifyMatching(TypeSignature original, TypeSignature expected, params TypeSignature[] fails)
        {
            Assert.IsTrue(_comparer.MatchTypes(original, expected), "The original signature did not match the expected.");
            Assert.IsTrue(_comparer.MatchTypes(expected, original), "The expected signature did not match the original.");

            foreach (var fail in fails)
            {
                Assert.IsFalse(_comparer.MatchTypes(fail, original), original + " matched " + fail.FullName);
                Assert.IsFalse(_comparer.MatchTypes(original, fail), fail.FullName + " matched " + original);
            }

            var dummyType = CreateTypeRef(original.Namespace, original.Name);
            Assert.IsFalse(_comparer.MatchTypes(original, dummyType), original.FullName + " matched the dummy type.");
            Assert.IsFalse(_comparer.MatchTypes(dummyType, original), "The dummy type for " + original.FullName + " matched the original.");
        }
コード例 #21
0
 public OptionalModifierSignature(ITypeDefOrRef modifierType, TypeSignature baseType)
     : base(baseType)
 {
     ModifierType = modifierType;
 }
コード例 #22
0
 public PinnedTypeSignature(TypeSignature baseType)
     : base(baseType)
 {
 }
コード例 #23
0
 public ByReferenceTypeSignature(TypeSignature baseType)
     : base(baseType)
 {
 }
コード例 #24
0
 public ArrayTypeSignature(TypeSignature baseType)
     : base(baseType)
 {
     Dimensions = new List<ArrayDimension>();
 }
コード例 #25
0
 public VariableSignature(TypeSignature variableType)
 {
     VariableType = variableType;
 }
コード例 #26
0
 public MethodSignature(IEnumerable <TypeSignature> parameters, TypeSignature returnType)
     : this(parameters.Select(x => new ParameterSignature(x)), returnType)
 {
 }
コード例 #27
0
 public PointerTypeSignature(TypeSignature baseType)
     : base(baseType)
 {
 }
コード例 #28
0
 public SzArrayTypeSignature(TypeSignature baseType)
     : base(baseType)
 {
 }
コード例 #29
0
        private static object ReadValue(MetadataImage image, TypeSignature typeSignature, IBinaryStreamReader reader)
        {
            switch (typeSignature.ElementType)
            {
            case ElementType.Boolean:
                return(reader.ReadByte() == 1);

            case ElementType.Char:
                return((char)reader.ReadUInt16());

            case ElementType.R4:
                return(reader.ReadSingle());

            case ElementType.R8:
                return(reader.ReadDouble());

            case ElementType.I1:
                return(reader.ReadSByte());

            case ElementType.I2:
                return(reader.ReadInt16());

            case ElementType.I4:
                return(reader.ReadInt32());

            case ElementType.I8:
                return(reader.ReadInt64());

            case ElementType.U1:
                return(reader.ReadByte());

            case ElementType.U2:
                return(reader.ReadUInt16());

            case ElementType.U4:
                return(reader.ReadUInt32());

            case ElementType.U8:
                return(reader.ReadUInt64());

            case ElementType.String:
                return(reader.ReadSerString());

            case ElementType.Object:
                return(ReadValue(image, TypeSignature.ReadFieldOrPropType(image, reader), reader));

            case ElementType.Class:
            case ElementType.Enum:
            case ElementType.ValueType:
                var enumTypeDef = image.MetadataResolver.ResolveType(typeSignature);
                if (enumTypeDef == null)
                {
                    throw new MemberResolutionException(typeSignature);
                }

                if (enumTypeDef.IsEnum)
                {
                    return(ReadValue(image, enumTypeDef.GetEnumUnderlyingType(), reader));
                }
                break;
            }

            if (typeSignature.IsTypeOf("System", "Type"))
            {
                return(TypeSignature.FromAssemblyQualifiedName(image, reader.ReadSerString()));
            }

            throw new NotSupportedException("Unsupported element type " + typeSignature.ElementType);
        }
コード例 #30
0
 public SentinelTypeSignature(TypeSignature baseType)
     : base(baseType)
 {
 }
コード例 #31
0
 public MethodSignature(TypeSignature returnType)
     : this(Enumerable.Empty <ParameterSignature>(), returnType)
 {
     ReturnType = returnType;
 }
コード例 #32
0
 public static ElementSignature FromReader(MetadataImage image, TypeSignature typeSignature, IBinaryStreamReader reader)
 {
     return(new ElementSignature(ReadValue(image, typeSignature, reader)));
 }
コード例 #33
0
 public MethodSignature(IEnumerable <ParameterSignature> parameters, TypeSignature returnType)
 {
     Parameters = new List <ParameterSignature>(parameters);
     ReturnType = returnType;
 }
コード例 #34
0
 public SzArrayTypeSignature(TypeSignature baseType)
     : base(baseType)
 {
 }
コード例 #35
0
 public new static SzArrayTypeSignature FromReader(MetadataImage image, IBinaryStreamReader reader)
 {
     return(new SzArrayTypeSignature(TypeSignature.FromReader(image, reader)));
 }
コード例 #36
0
 public BoxedTypeSignature(TypeSignature baseType)
     : base(baseType)
 {
 }
コード例 #37
0
ファイル: PointerTypeSignature.cs プロジェクト: xuhaoa/WinPIT
        public new static PointerTypeSignature FromReader(MetadataImage image, IBinaryStreamReader reader)
        {
            long position = reader.Position;

            return(new PointerTypeSignature(TypeSignature.FromReader(image, reader)));
        }
コード例 #38
0
        public new static ArrayTypeSignature FromReader(MetadataHeader header, IBinaryStreamReader reader)
        {
            long position  = reader.Position;
            var  signature = new ArrayTypeSignature(TypeSignature.FromReader(header, reader))
            {
                StartOffset = position
            };

            uint rank;

            if (!reader.TryReadCompressedUInt32(out rank))
            {
                return(signature);
            }

            uint numSizes;

            if (!reader.TryReadCompressedUInt32(out numSizes))
            {
                return(signature);
            }

            var sizes = new uint[numSizes];

            for (int i = 0; i < numSizes; i++)
            {
                if (!reader.TryReadCompressedUInt32(out sizes[i]))
                {
                    return(signature);
                }
            }

            uint numLoBounds;

            if (!reader.TryReadCompressedUInt32(out numLoBounds))
            {
                return(signature);
            }

            var loBounds = new uint[numLoBounds];

            for (int i = 0; i < numLoBounds; i++)
            {
                if (!reader.TryReadCompressedUInt32(out loBounds[i]))
                {
                    return(signature);
                }
            }

            for (int i = 0; i < rank; i++)
            {
                var dimension = new ArrayDimension();
                if (i < numSizes)
                {
                    dimension.Size = (int)sizes[i];
                }
                if (i < numLoBounds)
                {
                    dimension.LowerBound = (int)loBounds[i];
                }
                signature.Dimensions.Add(dimension);
            }

            return(signature);
        }
コード例 #39
0
 public RequiredModifierSignature(ITypeDefOrRef modifierType, TypeSignature baseType)
     : base(baseType)
 {
     ModifierType = modifierType;
 }
コード例 #40
0
 public ArrayTypeSignature(TypeSignature baseType)
     : base(baseType)
 {
     Dimensions = new List <ArrayDimension>();
 }
コード例 #41
0
 public BoxedTypeSignature(TypeSignature baseType)
     : base(baseType)
 {
 }
コード例 #42
0
 public SentinelTypeSignature(TypeSignature baseType)
     : base(baseType)
 {
 }
コード例 #43
0
ファイル: MethodSignature.cs プロジェクト: JerreS/AsmResolver
 public MethodSignature(TypeSignature returnType)
     : this(Enumerable.Empty<ParameterSignature>(), returnType)
 {
     ReturnType = returnType;
 }
コード例 #44
0
 public VariableSignature(TypeSignature variableType)
 {
     VariableType = variableType;
 }
コード例 #45
0
ファイル: MethodSignature.cs プロジェクト: JerreS/AsmResolver
 public MethodSignature(IEnumerable<ParameterSignature> parameters, TypeSignature returnType)
 {
     Parameters = new List<ParameterSignature>(parameters);
     ReturnType = returnType;
 }
コード例 #46
0
 public new static PointerTypeSignature FromReader(MetadataHeader header, IBinaryStreamReader reader)
 {
     return(new PointerTypeSignature(TypeSignature.FromReader(header, reader)));
 }
コード例 #47
0
 public ParameterSignature(TypeSignature parameterType)
 {
     ParameterType = parameterType;
 }
コード例 #48
0
        private static object ReadValue(MetadataHeader header, TypeSignature typeSignature, IBinaryStreamReader reader)
        {
            switch (typeSignature.ElementType)
            {
                case ElementType.Boolean:
                    return reader.ReadByte() == 1;
                case ElementType.Char:
                    return (char)reader.ReadUInt16();
                case ElementType.R4:
                    return reader.ReadSingle();
                case ElementType.R8:
                    return reader.ReadDouble();
                case ElementType.I1:
                    return reader.ReadSByte();
                case ElementType.I2:
                    return reader.ReadInt16();
                case ElementType.I4:
                    return reader.ReadInt32();
                case ElementType.I8:
                    return reader.ReadInt64();
                case ElementType.U1:
                    return reader.ReadByte();
                case ElementType.U2:
                    return reader.ReadUInt16();
                case ElementType.U4:
                    return reader.ReadUInt32();
                case ElementType.U8:
                    return reader.ReadUInt64();
                case ElementType.String:
                    return reader.ReadSerString();
                case ElementType.Object:
                    return ReadValue(header, TypeSignature.ReadFieldOrPropType(header, reader), reader);
                case ElementType.Class:
                case ElementType.Enum:
                case ElementType.ValueType:
                    var enumTypeDef = header.MetadataResolver.ResolveType(typeSignature);
                    if (enumTypeDef == null)
                        throw new MemberResolutionException(typeSignature);

                    if (enumTypeDef.IsEnum)
                        return ReadValue(header, enumTypeDef.GetEnumUnderlyingType(), reader);
                    break;
            }
            if (typeSignature.IsTypeOf("System", "Type"))
                return TypeSignature.FromAssemblyQualifiedName(header, reader.ReadSerString());
            throw new NotSupportedException("Unsupported element type " + typeSignature.ElementType);
        }
コード例 #49
0
 public CustomAttributeNamedArgument(CustomAttributeArgumentMemberType argumentMemberType, TypeSignature argumentType, string memberName, CustomAttributeArgument argument)
 {
     ArgumentMemberType = argumentMemberType;
     ArgumentType       = argumentType;
     MemberName         = memberName;
     Argument           = argument;
 }
コード例 #50
0
 protected TypeSpecificationSignature(TypeSignature baseType)
 {
     BaseType = baseType;
 }
コード例 #51
0
        public TypeSignature ImportTypeSignature(TypeSignature signature)
        {
            if (signature is MsCorLibTypeSignature)
                return signature;

            var typeDefOrRef = signature as TypeDefOrRefSignature;
            if (typeDefOrRef != null)
                return ImportTypeDefOrRefSignature(typeDefOrRef);

            var corlibType = signature as MsCorLibTypeSignature;
            if (corlibType != null)
                return ImportCorlibTypeSignature(corlibType);

            var arrayType = signature as ArrayTypeSignature;
            if (arrayType != null)
                return ImportArrayTypeSignature(arrayType);

            var boxedType = signature as BoxedTypeSignature;
            if (boxedType != null)
                return ImportBoxedTypeSignature(boxedType);

            var byRefType = signature as ByReferenceTypeSignature;
            if (byRefType != null)
                return ImportByRefTypeSignature(byRefType);

            var functionPtrType = signature as FunctionPointerTypeSignature;
            if (functionPtrType != null)
                return ImportFunctionPointerTypeSignature(functionPtrType);

            var genericType = signature as GenericInstanceTypeSignature;
            if (genericType != null)
                return ImportGenericInstanceTypeSignature(genericType);

            var modOptType = signature as OptionalModifierSignature;
            if (modOptType != null)
                return ImportOptionalModifierSignature(modOptType);

            var pinnedType = signature as PinnedTypeSignature;
            if (pinnedType != null)
                return ImportPinnedTypeSignature(pinnedType);

            var pointerType = signature as PointerTypeSignature;
            if (pointerType != null)
                return ImportPointerTypeSignature(pointerType);

            var modReqType = signature as RequiredModifierSignature;
            if (modReqType != null)
                return ImportRequiredModifierSignature(modReqType);

            var sentinelType = signature as SentinelTypeSignature;
            if (sentinelType != null)
                return ImportSentinelTypeSignature(sentinelType);

            var szArrayType = signature as SzArrayTypeSignature;
            if (szArrayType != null)
                return ImportSzArrayTypeSignature(szArrayType);

            throw new NotSupportedException("Invalid or unsupported type signature.");
        }
コード例 #52
0
        /// <summary>
        /// Determines whether two types are considered equal according to their signature.
        /// </summary>
        /// <param name="signature1">The first type to compare.</param>
        /// <param name="descriptor">The second type to compare.</param>
        /// <returns><c>True</c> if the types are considered equal, <c>False</c> otherwise.</returns>
        public bool MatchTypes(TypeSignature signature1, ITypeDescriptor descriptor)
        {
            if (signature1 == null && descriptor == null)
                return true;
            if (signature1 == null || descriptor == null)
                return false;

            var signature2 = descriptor as TypeSignature;
            if (signature2 != null)
                return MatchTypes(signature1, signature2);

            var typeDefOrRefSig = signature1 as TypeDefOrRefSignature;
            if (typeDefOrRefSig != null)
                return MatchTypes(typeDefOrRefSig, descriptor);

            var corlibType = signature1 as MsCorLibTypeSignature;
            if (corlibType != null)
                return MatchTypes(corlibType, descriptor);

            return false;
        }
コード例 #53
0
ファイル: TypeNameParser.cs プロジェクト: JerreS/AsmResolver
        private static TypeSignature ReadTypeSignature(TypeSignature elementType, string name, ref int position)
        {
            if (position < name.Length)
            {
                switch (name[position])
                {
                    case '*':
                        return new PointerTypeSignature(elementType);
                    case '&':
                        return new ByReferenceTypeSignature(elementType);
                    case '[':
                        position++;
                        if (name[position] == ']')
                        {
                            position++;
                            return new SzArrayTypeSignature(elementType);
                        }

                        // TODO: support generic types + generic instances.
                        break;
                }
            }
            return elementType;
        }
コード例 #54
0
        /// <summary>
        /// Determines whether two types are considered equal according to their signature.
        /// </summary>
        /// <param name="signature1">The first type to compare.</param>
        /// <param name="signature2">The second type to compare.</param>
        /// <returns><c>True</c> if the types are considered equal, <c>False</c> otherwise.</returns>
        public bool MatchTypes(TypeSignature signature1, TypeSignature signature2)
        {
            if (signature1 == null && signature2 == null)
                return true;
            if (signature1 == null || signature2 == null)
                return false;

            var typeDefOrRef = signature1 as TypeDefOrRefSignature;
            if (typeDefOrRef != null)
                return MatchTypes(typeDefOrRef, (ITypeDescriptor) signature2);

            var corlibType = signature1 as MsCorLibTypeSignature;
            if (corlibType != null)
                return MatchTypes(corlibType, (ITypeDescriptor) signature2);

            var arrayType = signature1 as ArrayTypeSignature;
            if (arrayType != null)
                return MatchTypes(arrayType, signature2 as ArrayTypeSignature);

            var boxedType = signature1 as BoxedTypeSignature;
            if (boxedType != null)
                return MatchTypes(boxedType, signature2 as BoxedTypeSignature);

            var byRefType = signature1 as ByReferenceTypeSignature;
            if (byRefType != null)
                return MatchTypes(byRefType, signature2 as ByReferenceTypeSignature);

            var functionPtrType = signature1 as FunctionPointerTypeSignature;
            if (functionPtrType != null)
                return MatchTypes(functionPtrType, signature2 as FunctionPointerTypeSignature);

            var genericType = signature1 as GenericInstanceTypeSignature;
            if (genericType != null)
                return MatchTypes(genericType, signature2 as GenericInstanceTypeSignature);

            var genericParam = signature1 as GenericParameterSignature;
            if (genericParam != null)
                return MatchTypes(genericParam, signature2 as GenericParameterSignature);

            var modOptType = signature1 as OptionalModifierSignature;
            if (modOptType != null)
                return MatchTypes(modOptType, signature2 as OptionalModifierSignature);

            var pinnedType = signature1 as PinnedTypeSignature;
            if (pinnedType != null)
                return MatchTypes(pinnedType, signature2 as PinnedTypeSignature);

            var pointerType = signature1 as PointerTypeSignature;
            if (pointerType != null)
                return MatchTypes(pointerType, signature2 as PointerTypeSignature);

            var modReqType = signature1 as RequiredModifierSignature;
            if (modReqType != null)
                return MatchTypes(modReqType, signature2 as RequiredModifierSignature);

            var sentinelType = signature1 as SentinelTypeSignature;
            if (sentinelType != null)
                return MatchTypes(sentinelType, signature2 as SentinelTypeSignature);

            var szArrayType = signature1 as SzArrayTypeSignature;
            if (szArrayType != null)
                return MatchTypes(szArrayType, signature2 as SzArrayTypeSignature);

            return false;
        }
コード例 #55
0
 public RequiredModifierSignature(ITypeDefOrRef modifierType, TypeSignature baseType)
     : base(baseType)
 {
     ModifierType = modifierType;
 }
コード例 #56
0
 public PinnedTypeSignature(TypeSignature baseType)
     : base(baseType)
 {
 }
コード例 #57
0
 protected TypeSpecificationSignature(TypeSignature baseType)
 {
     BaseType = baseType;
 }
コード例 #58
0
 public CustomAttributeArgument(TypeSignature argumentType, ElementSignature value)
     : this(argumentType, new[] { value })
 {
 }
コード例 #59
0
ファイル: TypeNameBuilder.cs プロジェクト: JerreS/AsmResolver
 public static string GetAssemblyQualifiedName(TypeSignature signature)
 {
     string typeName = GetFullName(signature);
     var assembly = signature.ResolutionScope.GetAssembly();
     return typeName + ", " + assembly.FullName;
 }
コード例 #60
0
 public ByReferenceTypeSignature(TypeSignature baseType)
     : base(baseType)
 {
 }