Skip to content

Commit

Permalink
fix: change read/write buffers to private
Browse files Browse the repository at this point in the history
  • Loading branch information
JadlionHD committed May 29, 2024
1 parent bf97d01 commit 0640ffb
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 35 deletions.
45 changes: 24 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions src/structures/ItemsDat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,69 +244,69 @@ class ItemsDat {
this.mempos = 0;
}

public readU8() {
private readU8() {
const val = this.data.readUInt8(this.mempos);
this.mempos += 1;
return val;
}
public readU16() {
private readU16() {
const val = this.data.readUInt16LE(this.mempos);
this.mempos += 2;
return val;
}
public readU32() {
private readU32() {
const val = this.data.readUInt32LE(this.mempos);
this.mempos += 4;
return val;
}
public writeU8(value: number) {
private writeU8(value: number) {
const val = this.data.writeUInt8(value, this.mempos);
this.mempos += 1;
return val;
}
public writeU16(value: number) {
private writeU16(value: number) {
const val = this.data.writeUInt16LE(value, this.mempos);
this.mempos += 2;
return val;
}
public writeU32(value: number) {
private writeU32(value: number) {
const val = this.data.writeUInt32LE(value, this.mempos);
this.mempos += 4;
return val;
}

public readI8() {
private readI8() {
const val = this.data.readInt8(this.mempos);
this.mempos += 1;
return val;
}
public readI16() {
private readI16() {
const val = this.data.readInt16LE(this.mempos);
this.mempos += 2;
return val;
}
public readI32() {
private readI32() {
const val = this.data.readInt32LE(this.mempos);
this.mempos += 4;
return val;
}
public writeI8(value: number) {
private writeI8(value: number) {
const val = this.data.writeInt8(value, this.mempos);
this.mempos += 1;
return val;
}
public writeI16(value: number) {
private writeI16(value: number) {
const val = this.data.writeInt16LE(value, this.mempos);
this.mempos += 2;
return val;
}
public writeI32(value: number) {
private writeI32(value: number) {
const val = this.data.writeInt32LE(value, this.mempos);
this.mempos += 4;
return val;
}

public async readString(
private async readString(
opts: StringOptions = {
encoded: false
}
Expand Down Expand Up @@ -338,7 +338,7 @@ class ItemsDat {
}
}

public writeString(str: ExtendString, id: number, encoded: boolean = false): Promise<undefined> {
private writeString(str: ExtendString, id: number, encoded: boolean = false): Promise<undefined> {
return new Promise((resolve) => {
// write the str length first

Expand Down

0 comments on commit 0640ffb

Please sign in to comment.