xcom2charpool
Version:
Library for reading, manipulating, and managing XCOM 2 character pool binary files, supporting both browser and Node.js environments.
29 lines (28 loc) • 939 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NameProperty = void 0;
const NamePropertyValue_1 = require("./NamePropertyValue");
const BaseCodec_1 = require("../../BaseCodec");
/**
* Codec for UE NameProperty values, backed by NamePropertyValue.
*/
class NameProperty extends BaseCodec_1.BaseCodec {
constructor() {
super(...arguments);
this.type = 'NameProperty';
}
read(reader, length, ctx) {
return this.readSized(reader, length, ctx, (p) => {
const value = p.string();
const instanceId = p.uint32();
return new NamePropertyValue_1.NamePropertyValue(value, instanceId);
});
}
write(writer, value) {
writer.string(value.value).uint32(value.instanceId);
}
isSupported(value) {
return value instanceof NamePropertyValue_1.NamePropertyValue;
}
}
exports.NameProperty = NameProperty;