WriteInt() публичный Метод

public WriteInt ( int i, int bitLength ) : void
i int
bitLength int
Результат void
Пример #1
0
        public byte[] Encode(string text)
        {
            text = text.ToUpper();
            var len = text.Length * 6 + 24;

            var writer = new BitWriter(len);
            writer.WriteByte(2);
            writer.WriteInt(text.Length, 16);

            for (int i = 0; i < text.Length; i++)
            {
                var index = GetChar6Index(text[i]);
                writer.WriteInt(index, 6);
            }

            return writer.GetBytes();
        }
Пример #2
0
        public byte[] Encode(string text)
        {
            var len = text.Length * 7 + 24;

            var writer = new BitWriter(len);
            writer.WriteByte(2);
            writer.WriteInt(text.Length, 16);

            for (int i = 0; i < text.Length; i++)
            {
                var b = Convert.ToByte(text[i]);
                writer.WriteByte(b, 7);
            }

            return writer.GetBytes();
        }