Inheritance: IDisposable
示例#1
0
        public Type ParseFieldSignature(uint offset, TypeDefinition declaringType)
        {
            CheckDisposed();
            var blob = ReadBlob(offset);

            return(SignatureParser.ParseFieldSignature(blob, declaringType));
        }
示例#2
0
 public static uint ParseLength(IReadOnlyList<byte> blob, out int bytesRead)
 {
     using (var parser = new SignatureParser(blob)) {
         var ret = parser.ReadUInt();
         bytesRead = parser.m_readCount;
         return ret;
     }
 }
示例#3
0
 public static uint ParseLength(IReadOnlyList <byte> blob, out int bytesRead)
 {
     using (var parser = new SignatureParser(blob)) {
         var ret = parser.ReadUInt();
         bytesRead = parser.m_readCount;
         return(ret);
     }
 }
示例#4
0
        public IReadOnlyList <byte> ReadBlob(uint offset)
        {
            CheckDisposed();
            if (BlobStream == null || offset > BlobStream->Size)
            {
                throw new ArgumentOutOfRangeException("offset", "Invalid blog offset.");
            }
            var pBlob         = ((byte *)m_metadataRoot + BlobStream->Offset) + offset;
            var bufferWrapper = new BufferWrapper(pBlob, (int)(BlobStream->Size - offset));
            int bytesRead;
            var length = SignatureParser.ParseLength(bufferWrapper, out bytesRead);

            if (length > checked (BlobStream->Size - offset - bytesRead.AssumeGTE(0)))
            {
                throw new InvalidOperationException("Blob has invalid size");
            }
            return(new BufferWrapper(pBlob + bytesRead, (int)length));
        }
示例#5
0
        public String ReadUserString(uint offset)
        {
            if (UserStringsStream == null || offset > UserStringsStream->Size)
            {
                throw new ArgumentOutOfRangeException("offset", "Invalid blog offset.");
            }
            var pBlob         = ((byte *)m_metadataRoot + UserStringsStream->Offset) + offset;
            var bufferWrapper = new BufferWrapper(pBlob, (int)(BlobStream->Size - offset));
            int bytesRead;
            var length = SignatureParser.ParseLength(bufferWrapper, out bytesRead);

            if (length > checked (UserStringsStream->Size - offset - bytesRead.AssumeGTE(0)))
            {
                throw new InvalidOperationException("String has invalid size");
            }
            if (length == 0)
            {
                return("");
            }
            var pStr = (char *)(pBlob + bytesRead);

            return(new string(pStr, 0, NativePlatform.Default.WcsLen(pStr, (int)length / 2)));
        }
示例#6
0
 public static Method ParseMethodSignature(IReadOnlyList<byte> signature, MethodDefinition targetMethod)
 {
     using (var parser = new SignatureParser(signature, targetMethod)) {
         return parser.ParseMethodSignature();
     }
 }
示例#7
0
 public static MarshalInfo ParseMarshalDescriptor(IReadOnlyList<byte> signature)
 {
     using (var parser = new SignatureParser(signature)) {
         return parser.ParseMashalDescriptor();
     }
 }
示例#8
0
 public static Type ParseFieldSignature(IReadOnlyList<byte> signature, TypeDefinition declaringType)
 {
     using (var parser = new SignatureParser(signature, declaringType)) {
         return parser.ParseFieldSignature();
     }
 }
示例#9
0
 public static MarshalInfo ParseMarshalDescriptor(IReadOnlyList <byte> signature)
 {
     using (var parser = new SignatureParser(signature)) {
         return(parser.ParseMashalDescriptor());
     }
 }
示例#10
0
 public static Method ParseMethodSignature(IReadOnlyList <byte> signature, MethodDefinition targetMethod)
 {
     using (var parser = new SignatureParser(signature, targetMethod)) {
         return(parser.ParseMethodSignature());
     }
 }
示例#11
0
 public static Type ParseFieldSignature(IReadOnlyList <byte> signature, TypeDefinition declaringType)
 {
     using (var parser = new SignatureParser(signature, declaringType)) {
         return(parser.ParseFieldSignature());
     }
 }