コード例 #1
0
        public byte[] ToBytes(string version)
        {
            var bytes = rawBitStream.ToBytes();

            RawBitStream.Utils.WriteVersion(version, bytes);
            bytes[Crc8ByteIndex] = Crc8.ComputeChecksum(
                bytes, Crc8ByteIndex + 1);
            return(bytes);
        }
コード例 #2
0
        public BitStream(byte[] bytes) : this()
        {
            var crc8 = Crc8.ComputeChecksum(bytes, Crc8ByteIndex + 1);

            if (bytes[Crc8ByteIndex] != crc8)
            {
                throw new ArgumentException(
                          @"Crc8 checksum not match!");
            }

            rawBitStream.FromBytes(bytes);
        }