65 lines
1.7 KiB
TypeScript
65 lines
1.7 KiB
TypeScript
// This file has been automatically generated by writePacketClasses.js
|
|
|
|
import {UUID} from '../UUID';
|
|
import {MessageFlags} from '../../enums/MessageFlags';
|
|
import {Packet} from '../Packet';
|
|
|
|
export class StateSavePacket implements Packet
|
|
{
|
|
name = 'StateSave';
|
|
flags = MessageFlags.FrequencyLow;
|
|
id = 4294901887;
|
|
|
|
AgentData: {
|
|
AgentID: UUID;
|
|
SessionID: UUID;
|
|
};
|
|
DataBlock: {
|
|
Filename: string;
|
|
};
|
|
|
|
getSize(): number
|
|
{
|
|
return (this.DataBlock['Filename'].length + 1) + 32;
|
|
}
|
|
|
|
writeToBuffer(buf: Buffer, pos: number): number
|
|
{
|
|
const startPos = pos;
|
|
this.AgentData['AgentID'].writeToBuffer(buf, pos);
|
|
pos += 16;
|
|
this.AgentData['SessionID'].writeToBuffer(buf, pos);
|
|
pos += 16;
|
|
buf.write(this.DataBlock['Filename'], pos);
|
|
pos += this.DataBlock['Filename'].length;
|
|
return pos - startPos;
|
|
}
|
|
|
|
readFromBuffer(buf: Buffer, pos: number): number
|
|
{
|
|
const startPos = pos;
|
|
const newObjAgentData: {
|
|
AgentID: UUID,
|
|
SessionID: UUID
|
|
} = {
|
|
AgentID: UUID.zero(),
|
|
SessionID: UUID.zero()
|
|
};
|
|
newObjAgentData['AgentID'] = new UUID(buf, pos);
|
|
pos += 16;
|
|
newObjAgentData['SessionID'] = new UUID(buf, pos);
|
|
pos += 16;
|
|
this.AgentData = newObjAgentData;
|
|
const newObjDataBlock: {
|
|
Filename: string
|
|
} = {
|
|
Filename: ''
|
|
};
|
|
newObjDataBlock['Filename'] = buf.toString('utf8', pos, length);
|
|
pos += length;
|
|
this.DataBlock = newObjDataBlock;
|
|
return pos - startPos;
|
|
}
|
|
}
|
|
|