Skip to content

Commit

Permalink
feat(clientdb): add support for reading non-localized strings in db r…
Browse files Browse the repository at this point in the history
…ecords
  • Loading branch information
fallenoak committed Jan 15, 2024
1 parent a59c6ae commit b73759c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/lib/clientdb/ClientDbRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ class ClientDbRecord {
const string = this.#readLocString(value as number[], stringBlock, locale);
const normalizedKey = key.replace('.locstring', '');

this[normalizedKey] = string;
} else if (key.endsWith('.string')) {
const string = this.#readString(value as number, stringBlock);
const normalizedKey = key.replace('.string', '');

this[normalizedKey] = string;
} else {
this[key] = value;
Expand All @@ -41,6 +46,13 @@ class ClientDbRecord {

return localeString;
}

#readString(offset: number, stringBlock: IoStream) {
stringBlock.offset = offset;
const string = dbIo.string.read(stringBlock);

return string;
}
}

export default ClientDbRecord;
Expand Down

0 comments on commit b73759c

Please sign in to comment.