public BlobReader Skip()
        {
            var reader = this.reader;

            while (reader.IsCustomModifier())
            {
                reader = new CustomModifierSignature(reader).Skip();
            }

            switch (reader.PeekSignatureTypeCode())
            {
            case SignatureTypeCode.ByReference:
                reader.ReadSignatureTypeCode();
                goto default;

            case SignatureTypeCode.TypedReference:
            case SignatureTypeCode.Void:
                reader.ReadSignatureTypeCode();
                break;

            default:
                reader = new TypeSignature(reader).Skip();
                break;
            }

            return(reader);
        }
Example #2
0
        public BlobReader Skip()
        {
            var reader = this.reader;

            reader.ReadSignatureHeader();

            int parameterCount = reader.ReadCompressedInteger();

            while (reader.IsCustomModifier())
            {
                reader = new CustomModifierSignature(reader).Skip();
            }

            reader = new TypeSignature(reader).Skip();

            for (int i = 0; i < parameterCount; i++)
            {
                reader = new ParameterSignature(reader).Skip();
            }

            return(reader);
        }
        public BlobReader Skip()
        {
            var reader = this.reader;
            SignatureTypeCode typeCode = reader.ReadSignatureTypeCode();

            switch (typeCode)
            {
            case SignatureTypeCode.Boolean:
            case SignatureTypeCode.Char:
            case SignatureTypeCode.SByte:
            case SignatureTypeCode.Byte:
            case SignatureTypeCode.Int16:
            case SignatureTypeCode.UInt16:
            case SignatureTypeCode.Int32:
            case SignatureTypeCode.UInt32:
            case SignatureTypeCode.Int64:
            case SignatureTypeCode.UInt64:
            case SignatureTypeCode.IntPtr:
            case SignatureTypeCode.UIntPtr:
            case SignatureTypeCode.Single:
            case SignatureTypeCode.Double:
                break;

            case SignatureTypeCode.Object:
            case SignatureTypeCode.String:
                break;

            case SignatureTypeCode.Array:
                reader = new TypeSignature(reader).Skip();
                reader = new ArrayShapeSignature(reader).Skip();
                break;

            case SignatureTypeCode.FunctionPointer:
                throw new NotImplementedException(string.Format("{0} is not yet implemented.", typeCode));

            case SignatureTypeCode.GenericTypeInstance:
                reader.ReadSignatureTypeCode();
                reader.ReadTypeHandle();

                int argumentCount = reader.ReadCompressedInteger();
                for (int i = 0; i < argumentCount; i++)
                {
                    reader = new TypeSignature(reader).Skip();
                }

                break;

            case SignatureTypeCode.GenericMethodParameter:
            case SignatureTypeCode.GenericTypeParameter:
                // skip the generic parameter index
                reader.ReadCompressedInteger();
                break;

            case SignatureTypeCode.TypeHandle:
                reader.ReadTypeHandle();
                break;

            case SignatureTypeCode.Pointer:
                while (reader.IsCustomModifier())
                {
                    reader = new CustomModifierSignature(reader).Skip();
                }

                if (reader.PeekSignatureTypeCode() == SignatureTypeCode.Void)
                {
                    reader.ReadSignatureTypeCode();
                }
                else
                {
                    reader = new TypeSignature(reader).Skip();
                }

                break;

            case SignatureTypeCode.SZArray:
                while (reader.IsCustomModifier())
                {
                    reader = new CustomModifierSignature(reader).Skip();
                }

                reader = new TypeSignature(reader).Skip();
                break;

            default:
                throw new InvalidOperationException("Invalid signature type code.");
            }

            return(reader);
        }