Latest packet handling, parsing, enums, generators, etc..

This commit is contained in:
Casper Warden
2017-11-24 17:45:34 +00:00
parent ec300e33ac
commit 261f28698a
496 changed files with 30448 additions and 57 deletions

View File

@@ -20,4 +20,34 @@ export class ConfirmXferPacketPacket implements Packet
return 12;
}
writeToBuffer(buf: Buffer, pos: number): number
{
const startPos = pos;
buf.writeInt32LE(this.XferID['ID'].low, pos);
pos += 4;
buf.writeInt32LE(this.XferID['ID'].high, pos);
pos += 4;
buf.writeUInt32LE(this.XferID['Packet'], pos);
pos += 4;
return pos - startPos;
}
readFromBuffer(buf: Buffer, pos: number): number
{
const startPos = pos;
const newObjXferID: {
ID: Long,
Packet: number
} = {
ID: Long.ZERO,
Packet: 0
};
newObjXferID['ID'] = new Long(buf.readInt32LE(pos), buf.readInt32LE(pos+4));
pos += 8;
newObjXferID['Packet'] = buf.readUInt32LE(pos);
pos += 4;
this.XferID = newObjXferID;
return pos - startPos;
}
}