C# Class Crosschat.Server.Infrastructure.Protocol.CommandParser

It's a protocol like that: +-------+--------+-------------------------------+ |request| | | | name | len(4) | request body | | (4) | | | +-------+--------+-------------------------------+ request name: the name of the request, 4 chars, used for matching the processing command request data: the body of the request TODO: add isEncoded and isZipped flags
Mostrar archivo Open project: EgorBo/CrossChat-Xamarin.Forms Class Usage Examples

Public Methods

Method Description
ParseBodyLength ( byte header, int offset, int length ) : int
ParseCommandName ( byte bytes ) : CommandNames
ToBytes ( Command command ) : byte[]
ToBytes ( CommandNames name, byte data ) : byte[]

Private Methods

Method Description
CommandNameToBytes ( CommandNames name ) : IEnumerable

Method Details

ParseBodyLength() public method

public ParseBodyLength ( byte header, int offset, int length ) : int
header byte
offset int
length int
return int

ParseCommandName() public method

public ParseCommandName ( byte bytes ) : CommandNames
bytes byte
return CommandNames

ToBytes() public method

public ToBytes ( Command command ) : byte[]
command Command
return byte[]

ToBytes() public method

public ToBytes ( CommandNames name, byte data ) : byte[]
name CommandNames
data byte
return byte[]