C# Class SocketLibrary.Packets.Packet

显示文件 Open project: Wotuu/RTS_XNA_v2 Class Usage Examples

Private Properties

Property Type Description
Packet System

Public Methods

Method Description
AddData ( byte data ) : void

Adds a byte of data to the list.

AddInt ( int value ) : void

Adds an int to this packet.

AddString ( String s ) : void

Adds a string to this packet

GetData ( ) : byte[]

Gets the data in this packet, excluding the header.

GetFullData ( ) : byte[]

Converts the data in this packet to a byte array, this includes the header.

GetHeader ( ) : byte

Gets the header of this packet.

GetPacketID ( ) : int

Gets the packetID of this packet.

Packet ( byte header ) : System
Packet ( byte header, byte data ) : System
SetHeader ( byte header ) : void

Sets the header of this byte. Also see ProtocolHeader.cs

SetPacketID ( byte bytes ) : void

Sets the packet ID. Must be a length of 4!.

SetPacketID ( int packetID ) : void

Sets the packet ID.

Private Methods

Method Description
Packet ( ) : System

Method Details

AddData() public method

Adds a byte of data to the list.
public AddData ( byte data ) : void
data byte The byte to add
return void

AddInt() public method

Adds an int to this packet.
public AddInt ( int value ) : void
value int The int to add
return void

AddString() public method

Adds a string to this packet
public AddString ( String s ) : void
s String The string
return void

GetData() public method

Gets the data in this packet, excluding the header.
public GetData ( ) : byte[]
return byte[]

GetFullData() public method

Converts the data in this packet to a byte array, this includes the header.
public GetFullData ( ) : byte[]
return byte[]

GetHeader() public method

Gets the header of this packet.
public GetHeader ( ) : byte
return byte

GetPacketID() public method

Gets the packetID of this packet.
public GetPacketID ( ) : int
return int

Packet() public method

public Packet ( byte header ) : System
header byte
return System

Packet() public method

public Packet ( byte header, byte data ) : System
header byte
data byte
return System

SetHeader() public method

Sets the header of this byte. Also see ProtocolHeader.cs
public SetHeader ( byte header ) : void
header byte The header to give this packet
return void

SetPacketID() public method

Sets the packet ID. Must be a length of 4!.
public SetPacketID ( byte bytes ) : void
bytes byte The bytes.
return void

SetPacketID() public method

Sets the packet ID.
public SetPacketID ( int packetID ) : void
packetID int The packet id.
return void