Example #1
0
        public static byte[] ComputeChecksumBytes(byte[] bytes, int offset, int length)
        {
            int crc = (int)ComputeChecksum(bytes, offset, length);
            var res = new byte[4];

            NumberSerializer.WriteInt(crc, res, 0);
            return(res);
        }
Example #2
0
 public MemBlock ToMemBlock()
 {
     if (_raw_data != null)
     {
         return(_raw_data);
     }
     //Else make it:
     if (IsValidNumeric(_type_num))
     {
         byte[] buf = new byte[1];
         buf[0]    = (byte)_type_num;
         _raw_data = MemBlock.Reference(buf);
     }
     else
     {
         //It's a string type:
         int    l   = NumberSerializer.GetByteCount(_string_rep);
         byte[] buf = new byte[l];
         NumberSerializer.WriteString(_string_rep, buf, 0);
         _raw_data = MemBlock.Reference(buf);
     }
     return(_raw_data);
 }