Skip to content

Packet Writer and Scanner

Created by: LouYu2015

Summary:

Implemented packet writer and scanner to simplify the process of constructing and parsing packets.


In file .gitignore:

  • Removed a duplicated .vs entry.

Scarlet.Communications in file Communications\Constants.cs:

  • New enum type TypeID.

Scarlet.Communications.Message in file Communications\Message.cs:

  • Behavior change in method AppendData: now it will create payload if payload is null.
  • Implementation change in method AppendData: use System.Buffer.BlockCopy to enhance efficiency.
  • New public method GetDataSlice.

Scarlet.Communications.Packet in file Communications\Packet.cs:

  • New public method GetDataSlice.

New file Communications\PacketScanner.cs:

  • New class Scarlet.Communications.PacketScanner.

New file Communications\PacketWriter.cs:

  • New class Scarlet.Communications.PacketWriter.

New file Communications\SafePacketScanner.cs:

  • New class Scarlet.Communications.SafePacketScanner.

New file Communications\SafePacketWriter.cs:

  • New class Scarlet.Communications.SafePacketWriter.

New unit test cases for new classes.

Merge request reports