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]; }
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); }
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); }
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); }
public override void UpdateValueFromBuffer(byte[] buffer) { Value = BufferHelper.GetInt(buffer[Position], buffer[Position + 1], buffer[Position + 2], buffer[Position + 3], ElementDirection); }
public override void UpdateBufferFromValue(byte[] buffer) { buffer[Position] = BufferHelper.GetMSB(Value, ElementDirection); buffer[Position + 1] = BufferHelper.GetLSB(Value, ElementDirection); }