Update messages

This commit is contained in:
Casper Warden
2023-11-09 18:00:35 +00:00
parent 7569f7272a
commit a0e259b717
21 changed files with 34 additions and 824 deletions

View File

@@ -1,6 +1,5 @@
// This file has been automatically generated by writeMessageClasses.js
import { UUID } from '../UUID';
import { MessageFlags } from '../../enums/MessageFlags';
import { MessageBase } from '../MessageBase';
import { Message } from '../../enums/Message';
@@ -18,13 +17,10 @@ export class AlertMessageMessage implements MessageBase
Message: Buffer;
ExtraParams: Buffer;
}[];
AgentInfo: {
AgentID: UUID;
}[];
getSize(): number
{
return (this.AlertData['Message'].length + 1) + this.calculateVarVarSize(this.AlertInfo, 'Message', 1) + this.calculateVarVarSize(this.AlertInfo, 'ExtraParams', 1) + ((16) * this.AgentInfo.length) + 2;
return (this.AlertData['Message'].length + 1) + this.calculateVarVarSize(this.AlertInfo, 'Message', 1) + this.calculateVarVarSize(this.AlertInfo, 'ExtraParams', 1) + 1;
}
calculateVarVarSize(block: { [key: string]: any }[], paramName: string, extraPerVar: number): number
@@ -44,7 +40,7 @@ export class AlertMessageMessage implements MessageBase
buf.writeUInt8(this.AlertData['Message'].length, pos++);
this.AlertData['Message'].copy(buf, pos);
pos += this.AlertData['Message'].length;
let count = this.AlertInfo.length;
const count = this.AlertInfo.length;
buf.writeUInt8(this.AlertInfo.length, pos++);
for (let i = 0; i < count; i++)
{
@@ -55,13 +51,6 @@ export class AlertMessageMessage implements MessageBase
this.AlertInfo[i]['ExtraParams'].copy(buf, pos);
pos += this.AlertInfo[i]['ExtraParams'].length;
}
count = this.AgentInfo.length;
buf.writeUInt8(this.AgentInfo.length, pos++);
for (let i = 0; i < count; i++)
{
this.AgentInfo[i]['AgentID'].writeToBuffer(buf, pos);
pos += 16;
}
return pos - startPos;
}
@@ -83,7 +72,7 @@ export class AlertMessageMessage implements MessageBase
{
return pos - startPos;
}
let count = buf.readUInt8(pos++);
const count = buf.readUInt8(pos++);
this.AlertInfo = [];
for (let i = 0; i < count; i++)
{
@@ -102,23 +91,6 @@ export class AlertMessageMessage implements MessageBase
pos += varLength;
this.AlertInfo.push(newObjAlertInfo);
}
if (pos >= buf.length)
{
return pos - startPos;
}
count = buf.readUInt8(pos++);
this.AgentInfo = [];
for (let i = 0; i < count; i++)
{
const newObjAgentInfo: {
AgentID: UUID
} = {
AgentID: UUID.zero()
};
newObjAgentInfo['AgentID'] = new UUID(buf, pos);
pos += 16;
this.AgentInfo.push(newObjAgentInfo);
}
return pos - startPos;
}
}