87 lines
2.7 KiB
TypeScript
87 lines
2.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 EmailMessageReplyPacket implements Packet
|
|
{
|
|
name = 'EmailMessageReply';
|
|
flags = MessageFlags.Trusted | MessageFlags.FrequencyLow;
|
|
id = 4294902096;
|
|
|
|
DataBlock: {
|
|
ObjectID: UUID;
|
|
More: number;
|
|
Time: number;
|
|
FromAddress: string;
|
|
Subject: string;
|
|
Data: string;
|
|
MailFilter: string;
|
|
};
|
|
|
|
getSize(): number
|
|
{
|
|
return (this.DataBlock['FromAddress'].length + 1 + this.DataBlock['Subject'].length + 1 + this.DataBlock['Data'].length + 2 + this.DataBlock['MailFilter'].length + 1) + 24;
|
|
}
|
|
|
|
writeToBuffer(buf: Buffer, pos: number): number
|
|
{
|
|
const startPos = pos;
|
|
this.DataBlock['ObjectID'].writeToBuffer(buf, pos);
|
|
pos += 16;
|
|
buf.writeUInt32LE(this.DataBlock['More'], pos);
|
|
pos += 4;
|
|
buf.writeUInt32LE(this.DataBlock['Time'], pos);
|
|
pos += 4;
|
|
buf.write(this.DataBlock['FromAddress'], pos);
|
|
pos += this.DataBlock['FromAddress'].length;
|
|
buf.write(this.DataBlock['Subject'], pos);
|
|
pos += this.DataBlock['Subject'].length;
|
|
buf.write(this.DataBlock['Data'], pos);
|
|
pos += this.DataBlock['Data'].length;
|
|
buf.write(this.DataBlock['MailFilter'], pos);
|
|
pos += this.DataBlock['MailFilter'].length;
|
|
return pos - startPos;
|
|
}
|
|
|
|
readFromBuffer(buf: Buffer, pos: number): number
|
|
{
|
|
const startPos = pos;
|
|
const newObjDataBlock: {
|
|
ObjectID: UUID,
|
|
More: number,
|
|
Time: number,
|
|
FromAddress: string,
|
|
Subject: string,
|
|
Data: string,
|
|
MailFilter: string
|
|
} = {
|
|
ObjectID: UUID.zero(),
|
|
More: 0,
|
|
Time: 0,
|
|
FromAddress: '',
|
|
Subject: '',
|
|
Data: '',
|
|
MailFilter: ''
|
|
};
|
|
newObjDataBlock['ObjectID'] = new UUID(buf, pos);
|
|
pos += 16;
|
|
newObjDataBlock['More'] = buf.readUInt32LE(pos);
|
|
pos += 4;
|
|
newObjDataBlock['Time'] = buf.readUInt32LE(pos);
|
|
pos += 4;
|
|
newObjDataBlock['FromAddress'] = buf.toString('utf8', pos, length);
|
|
pos += length;
|
|
newObjDataBlock['Subject'] = buf.toString('utf8', pos, length);
|
|
pos += length;
|
|
newObjDataBlock['Data'] = buf.toString('utf8', pos, length);
|
|
pos += length;
|
|
newObjDataBlock['MailFilter'] = buf.toString('utf8', pos, length);
|
|
pos += length;
|
|
this.DataBlock = newObjDataBlock;
|
|
return pos - startPos;
|
|
}
|
|
}
|
|
|