FSO.Files.Tuning.DecodeString C# (CSharp) Method

DecodeString() private method

Reads a variable-length pascal string offset by 13 characters.
private DecodeString ( BinaryReader reader ) : string
reader System.IO.BinaryReader
return string
        private string DecodeString(BinaryReader reader)
        {
            int length = 0;
            byte last = reader.ReadByte();
            byte j = 0;
            while ((last & 0x80) > 0)
            {
                length |= (last&0x7F) << ((j++) * 7);
                last = reader.ReadByte();
            }
            length |= last << ((j++) * 7);

            byte[] Chars = reader.ReadBytes(length);

            for(int i = 0; i < Chars.Length; i++)
                Chars[i] = (byte)(Chars[i] - 13);

            return Encoding.ASCII.GetString(Chars);
        }