示例#1
0
        public override void UpdateBufferFromValue(byte[] buffer)
        {
            var bytes = BufferHelper.GetBytes(Value, ElementDirection);

            buffer[Position + 0] = bytes[0];
            buffer[Position + 1] = bytes[1];
            buffer[Position + 2] = bytes[2];
            buffer[Position + 3] = bytes[3];
        }
示例#2
0
        public override void UpdateBufferFromValue(byte[] buffer)
        {
            if (TargetElement == null)
            {
                return;
            }

            //update Value first and leave dirty job to base..
            Value.Hash           = _referenceCRC.Hash = CRC.GetCRC16(buffer, TargetElement.Position, TargetElement.Size).Hash;
            buffer[Position]     = BufferHelper.GetMSB(Value.Hash, ElementDirection);
            buffer[Position + 1] = BufferHelper.GetLSB(Value.Hash, ElementDirection);
        }
示例#3
0
        public override void UpdateValueFromBuffer(byte[] buffer)
        {
            if (TargetElement == null)
            {
                return;
            }
            //targetElement MUST be updated first!..
            _referenceCRC.Hash = CRC.GetCRC16(buffer, TargetElement.Position, TargetElement.Size).Hash;

            //simply read and store existing CRC from buffer..
            Value.Hash = BufferHelper.GetUshort(buffer[Position], buffer[Position + 1], ElementDirection);
        }
示例#4
0
        public override void UpdateValueFromBuffer(byte[] buffer)
        {
            //int size = 0;
            //int ptr = Position;

            //while( (ptr < buffer.Length) && (buffer[ptr] != 0)) ptr++;
            //size = ptr - Position;
            int nullIndex = BufferHelper.RawFind(_null, buffer, Position, buffer.Length - Position, _null.Length);
            int size      = (nullIndex != -1 ? nullIndex : buffer.Length) - Position;

            //TODO: check null termination..
            Value = _encoding.GetString(buffer, Position, size);
        }
示例#5
0
 public override void UpdateValueFromBuffer(byte[] buffer)
 {
     Value = BufferHelper.GetInt(buffer[Position], buffer[Position + 1], buffer[Position + 2], buffer[Position + 3], ElementDirection);
 }
示例#6
0
 public override void UpdateBufferFromValue(byte[] buffer)
 {
     buffer[Position]     = BufferHelper.GetMSB(Value, ElementDirection);
     buffer[Position + 1] = BufferHelper.GetLSB(Value, ElementDirection);
 }