Exemple #1
0
        protected void addCRC()
        {
            if (this.packet != null)
            {
                try
                {
                    byte[] temp = new byte[this.packet.Length + CRC_COUNTER];
                    byte[] crc  = PacketUtility.HexStringToByteArray(Crc16.ComputeChecksum(this.packet).ToString("x2"));

                    Array.Copy(this.packet, 0, temp, 0, this.packet.Length);

                    Array.Copy(crc, 0, temp, this.packet.Length, CRC_COUNTER);

                    this.packet = temp;
                }
                catch (Exception e)
                {
                    throw e;
                }
            }

            else
            {
                throw new NullReferenceException();
            }
        }