ReadBytes() public method

public ReadBytes ( Int32 count ) : byte[]
count System.Int32
return byte[]
        public static string Deserialize(BitReader br)
        {
            var length = br.ReadInt32();
            if (length > 0)
            {
                var bytes = br.ReadBytes(length);
                return Encoding.GetEncoding(1252).GetString(bytes, 0, length - 1);
            }
            else if (length < 0)
            {
                var bytes = br.ReadBytes(length * -2);
                return Encoding.Unicode.GetString(bytes, 0, (length * -2) - 2);
            }

            return "";
        }
Example #2
0
        public static string Deserialize(BitReader br)
        {
            var length = br.ReadInt32();

            if (length > 0)
            {
                var bytes = br.ReadBytes(length);
                return(Encoding.GetEncoding(1252).GetString(bytes, 0, length - 1));
            }
            else if (length < 0)
            {
                var bytes = br.ReadBytes(length * -2);
                return(Encoding.Unicode.GetString(bytes, 0, (length * -2) - 2));
            }

            return("");
        }