satisfactory-json
Advanced tools
Comparing version 0.0.28 to 0.0.29
@@ -37,3 +37,2 @@ "use strict"; | ||
exports.readBigInt64LE = readBigInt64LE; | ||
; | ||
function wrtBigUInt64LE(buf, value, offset, min, max) { | ||
@@ -412,2 +411,5 @@ var lo = Number(jsbi_1.default.bitwiseAnd(value, jsbi_1.default.BigInt("0xffffffff"))); | ||
} | ||
if (value === undefined) { | ||
throw new Error("Undefined integer " + ref.name); | ||
} | ||
return this.writeInt(value, shouldCount); | ||
@@ -434,2 +436,5 @@ }; | ||
var value = getVar(ctx, ref); | ||
if (value === undefined) { | ||
throw new Error("Undefined string " + ref.name); | ||
} | ||
if (value.length === 0) { | ||
@@ -455,2 +460,5 @@ return this.writeInt(0, shouldCount); | ||
var value = getVar(ctx, ref); | ||
if (value === undefined) { | ||
throw new Error("Undefined byte " + ref.name); | ||
} | ||
return this.writeByte(value, shouldCount); | ||
@@ -478,2 +486,5 @@ }; | ||
var value = getVar(ctx, ref); | ||
if (value === undefined) { | ||
throw new Error("Undefined long " + ref.name); | ||
} | ||
// TODO remove when this is no longer stored as a string in json | ||
@@ -499,2 +510,5 @@ value = jsbi_1.default.BigInt(value); | ||
var value = getVar(ctx, ref); | ||
if (value === undefined) { | ||
throw new Error("Undefined float " + ref.name); | ||
} | ||
var bytes = 4; | ||
@@ -553,2 +567,5 @@ if (shouldCount) { | ||
var value = getVar(ctx, ref); | ||
if (value === undefined) { | ||
throw new Error("Undefined hex " + ref.name); | ||
} | ||
return this.writeBuffer(Buffer.from(value, 'hex'), shouldCount); // TODO somehow directly write the buffer? | ||
@@ -555,0 +572,0 @@ }; |
@@ -45,2 +45,3 @@ /// <reference types="node" /> | ||
private startCompressionCallback; | ||
private saveGame; | ||
constructor(rulesFunction: (builder: Builder) => void, startCompressionCallback: (buffer: Buffer) => void); | ||
@@ -52,3 +53,4 @@ prepare(isLoading: boolean): void; | ||
transformWrite(saveGame: SaveGame): boolean; | ||
end(callback: (error?: Error | null | undefined) => void): void; | ||
getSaveGame(): any; | ||
end(callback: (error?: Error | undefined) => void): void; | ||
} |
@@ -64,3 +64,2 @@ "use strict"; | ||
var TransformationEngine = /** @class */ (function () { | ||
// TODO collects Buffers and then concat them all at once | ||
function TransformationEngine(rulesFunction, startCompressionCallback) { | ||
@@ -133,7 +132,4 @@ this.isLoading = false; | ||
// Stack empty: Begin of program or something went wrong | ||
var saveGame = {}; // TODO put save game here when saving | ||
// make this global for debugging purposes | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
global.saveGame = saveGame; | ||
var saveGame = {}; | ||
this.saveGame = saveGame; | ||
var frame = { | ||
@@ -257,6 +253,3 @@ commands: this.commands, | ||
// Stack empty: Begin of program or something went wrong | ||
// make this global for debugging purposes | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
global.saveGame = saveGame; | ||
this.saveGame = saveGame; | ||
var frame = { | ||
@@ -365,2 +358,5 @@ commands: this.commands, | ||
}; | ||
TransformationEngine.prototype.getSaveGame = function () { | ||
return this.saveGame; | ||
}; | ||
TransformationEngine.prototype.end = function (callback) { | ||
@@ -367,0 +363,0 @@ if (this.needBytes !== 0) { |
@@ -53,8 +53,11 @@ "use strict"; | ||
Sav2JsonTransform.prototype._final = function (callback) { | ||
var _this = this; | ||
try { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
// TODO get saveGame from transformation engine | ||
this.push(global.saveGame); | ||
this.transformationEngine.end(callback); | ||
this.transformationEngine.end(function (error) { | ||
if (error === undefined) { | ||
console.log('push data', error); | ||
_this.push(_this.transformationEngine.getSaveGame()); | ||
} | ||
callback(error); | ||
}); | ||
} | ||
@@ -61,0 +64,0 @@ catch (error) { |
@@ -43,3 +43,3 @@ { | ||
"types": "lib/index.d.ts", | ||
"version": "0.0.28" | ||
} | ||
"version": "0.0.29" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
262074
4193