GetBytes() public method

public GetBytes ( ) : byte[]
return byte[]
Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
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();
        }