ParseLength() 공개 정적인 메소드

public static ParseLength ( IReadOnlyList blob, int &bytesRead ) : uint
blob IReadOnlyList
bytesRead int
리턴 uint
예제 #1
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));
        }
예제 #2
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)));
        }