Ejemplo n.º 1
0
        protected virtual byte [] ReadBytesFromStream(uint pos)
        {
            int start, length = Utilities.ReadCompressedInteger(m_data, (int)pos, out start);

            byte [] buffer = new byte [length];
            Buffer.BlockCopy(m_data, start, buffer, 0, length);
            return(buffer);
        }
        string ReadStringAt(int offset)
        {
            int length = Utilities.ReadCompressedInteger(this.Data, offset, out offset);

            if (length == 0)
            {
                return(string.Empty);
            }

            return(Encoding.Unicode.GetString(this.Data, offset, length));
        }
        string ReadStringAt(int offset)
        {
            int length = Utilities.ReadCompressedInteger(this.Data, offset, out offset) - 1;

            if (length < 1)
            {
                return(string.Empty);
            }

            char [] chars = new char [length / 2];

            for (int i = offset, j = 0; i < offset + length; i += 2)
            {
                chars [j++] = (char)(Data [i] | (Data [i + 1] << 8));
            }

            return(new string (chars));
        }