DMOperatorField.cs 691 B

12345678910111213141516171819202122232425262728293031
  1. namespace InABox.DigitalMatter
  2. {
  3. public class DMOperatorField : DMField
  4. {
  5. public DMOperatorField()
  6. {
  7. Data = new byte[] { };
  8. }
  9. public override byte Type => 0x03;
  10. public byte[] Data { get; set; }
  11. protected override void DoDecode(IDMReadBuffer buffer)
  12. {
  13. int type = buffer.TakeByte();
  14. Data = buffer.TakeBytes(buffer.BufferSize - 1);
  15. }
  16. protected override void DoEncode(IDMWriteBuffer buffer)
  17. {
  18. buffer.AddByte(Type);
  19. buffer.AddBytes(Data);
  20. }
  21. public override bool IsValid()
  22. {
  23. return true;
  24. }
  25. }
  26. }