Esempio n. 1
0
        public static string GetString(Stream input, int length)
        {
            using (var br = new BinaryReaderX(input, true))
            {
                var encoding = new CustomEncoding();

                return(encoding.GetString(br.ReadBytes(length)));
            }
        }
Esempio n. 2
0
        public static byte[] GetBytes(string text)
        {
            var encoding = new CustomEncoding();

            var byteCount = encoding.GetByteCount(text);
            var bytes     = encoding.GetBytes(text);

            bytes.ToList().RemoveRange(byteCount, bytes.Length - byteCount);

            return(bytes);
        }