Latest packet handling, parsing, enums, generators, etc..
This commit is contained in:
@@ -22,4 +22,40 @@ export class EnableSimulatorPacket implements Packet
|
||||
return 14;
|
||||
}
|
||||
|
||||
writeToBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
buf.writeInt32LE(this.SimulatorInfo['Handle'].low, pos);
|
||||
pos += 4;
|
||||
buf.writeInt32LE(this.SimulatorInfo['Handle'].high, pos);
|
||||
pos += 4;
|
||||
this.SimulatorInfo['IP'].writeToBuffer(buf, pos);
|
||||
pos += 4;
|
||||
buf.writeUInt16LE(this.SimulatorInfo['Port'], pos);
|
||||
pos += 2;
|
||||
return pos - startPos;
|
||||
}
|
||||
|
||||
readFromBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
const newObjSimulatorInfo: {
|
||||
Handle: Long,
|
||||
IP: IPAddress,
|
||||
Port: number
|
||||
} = {
|
||||
Handle: Long.ZERO,
|
||||
IP: IPAddress.zero(),
|
||||
Port: 0
|
||||
};
|
||||
newObjSimulatorInfo['Handle'] = new Long(buf.readInt32LE(pos), buf.readInt32LE(pos+4));
|
||||
pos += 8;
|
||||
newObjSimulatorInfo['IP'] = new IPAddress(buf, pos);
|
||||
pos += 4;
|
||||
newObjSimulatorInfo['Port'] = buf.readUInt16LE(pos);
|
||||
pos += 2;
|
||||
this.SimulatorInfo = newObjSimulatorInfo;
|
||||
return pos - startPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user