コード例 #1
0
        public void ReturnEscapedValue(byte input, string expected)
        {
            var encodedInput = ZDLEEncoder.EscapeControlCharacters(new byte[] { input });
            var result       = BitConverter.ToString(encodedInput);

            Assert.Equal(expected, result);
        }
コード例 #2
0
        public static byte[] Compute32BitHeaderAsArray(int type, int p0, int p1, int p2, int p3, CRC32 crcCalculator)
        {
            var b = new byte[5];

            b[0] = Convert.ToByte(type);
            b[1] = Convert.ToByte(p0);
            b[2] = Convert.ToByte(p1);
            b[3] = Convert.ToByte(p2);
            b[4] = Convert.ToByte(p3);

            var crc = crcCalculator.ComputeHash(b);

            var encodedCRC = ZDLEEncoder.EscapeControlCharacters(crc);

            return(encodedCRC);
        }