Parse object as one segment
This commit is contained in:
27
src/frame.ts
27
src/frame.ts
@@ -1465,7 +1465,7 @@ export class Frame implements IFrame {
|
|||||||
const name = rawName.trimEnd();
|
const name = rawName.trimEnd();
|
||||||
if (withStructure) {
|
if (withStructure) {
|
||||||
segment.push({
|
segment.push({
|
||||||
name: "object name",
|
name: "object",
|
||||||
data: new TextEncoder().encode(rawName).buffer,
|
data: new TextEncoder().encode(rawName).buffer,
|
||||||
isString: true,
|
isString: true,
|
||||||
fields: [{ type: FieldType.STRING, name: "name", length: 9 }]
|
fields: [{ type: FieldType.STRING, name: "name", length: 9 }]
|
||||||
@@ -1479,17 +1479,20 @@ export class Frame implements IFrame {
|
|||||||
}
|
}
|
||||||
const alive = stateChar === "*";
|
const alive = stateChar === "*";
|
||||||
if (withStructure) {
|
if (withStructure) {
|
||||||
segment.push({
|
let state: string = "invalid";
|
||||||
name: "object state",
|
if (stateChar === "*") {
|
||||||
data: new TextEncoder().encode(stateChar).buffer,
|
state = "alive";
|
||||||
isString: true,
|
} else if (stateChar === "_") {
|
||||||
fields: [
|
state = "killed";
|
||||||
{
|
}
|
||||||
type: FieldType.CHAR,
|
segment[segment.length - 1].data = new TextEncoder().encode(
|
||||||
name: "State (* alive, _ killed)",
|
this.payload.substring(offset - 9, offset + 1)
|
||||||
length: 1
|
).buffer;
|
||||||
}
|
segment[segment.length - 1].fields.push({
|
||||||
]
|
type: FieldType.CHAR,
|
||||||
|
name: "state",
|
||||||
|
length: 1,
|
||||||
|
value: state
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
offset += 1;
|
offset += 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user