Socket
Socket
Sign inDemoInstall

satisfactory-json

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

satisfactory-json - npm Package Compare versions

Comparing version 0.0.22 to 0.0.23

lib/transforms/properties/structs/Guuid.d.ts

11

lib/Archive.js

@@ -161,4 +161,11 @@ "use strict";

if (zero !== 0) {
throw new Error('string (length: ' + length +
') does not end with zero, but with ' + zero + ': ' + result);
if (length < 100) {
throw new Error(`string (length: ${length}) does not` +
` end with zero, but with ${zero}: ${result}`);
}
else {
throw new Error('string (length: ' + length +
') does not end with zero, but with ' + zero +
': ' + result.substring(0, 100) + ' [...]');
}
}

@@ -165,0 +172,0 @@ this.cursor += 1;

@@ -50,2 +50,5 @@ "use strict";

case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk6/Build_ConveyorLiftMk6.Build_ConveyorLiftMk6_C':
// Mk6_Mod
case '/Game/FactoryGame/Mk6_Mod/Build_ConveyorLiftMk61.Build_ConveyorLiftMk61_C':
case '/Game/FactoryGame/Mk6_Mod/Build_BeltMk61.Build_BeltMk61_C':
// tslint:enable

@@ -52,0 +55,0 @@ ConveyorBelt_1.default(ar, entity, length);

@@ -61,2 +61,7 @@ "use strict";

const obj = prop;
if (property.value.structInnerType === 'Guid') {
// Guids are stored without Tag.Name
ar._Hex(prop, 'guid', 16);
continue;
}
for (const innerProp of obj.properties) {

@@ -72,2 +77,9 @@ ar._String(innerProp, 'name'); // Tag.Name

const props = [];
if (property.value.structInnerType === 'Guid') {
// Guids are stored without Tag.Name
const guid = { guid: '' };
ar._Hex(guid, 'guid', 16);
property.value.values.push(guid);
continue;
}
while (true) {

@@ -74,0 +86,0 @@ const innerProperty = {

72

lib/transforms/properties/MapProperty.js

@@ -64,37 +64,45 @@ "use strict";

else {
// Currently the enum version is only used by LightItUp mod
// this is the only one that also uses a StrProperty as the key (yet)
isEnum = property.value.keyType === 'StrProperty';
// we need to determine whether the value is a string or just a byte
if (count.count > 0) { // with 0 elements it does not matter
isEnum = true;
const lar = ar;
const bytesRead = lar.bytesRead;
const cursor = lar.cursor;
try {
// peek key
const tmp = { key: '' };
keyTransformFunc(ar, tmp);
// peek value (try string)
const str = lar.readLengthPrefixedString();
if (str.length > 512) {
// heuristic in case the next key is magically again at a correct place
throw new Error('enum values should not be that long');
}
// peek next key (if two or more elements)
if (count.count > 1) {
keyTransformFunc(ar, tmp);
}
else {
// or peek string as name of the next property
lar.readLengthPrefixedString();
}
// if we managed to get here, this is probably a enum as we managed to get a string for
// the value correctly
// The following is a heuristic which will always have cases where it fails
/*if (count.count > 0) { // with 0 elements it does not matter
isEnum = true;
const lar = (ar as LoadingArchive);
const bytesRead = lar.bytesRead;
const cursor = lar.cursor;
try {
// peek key
const tmp = { key: '' };
keyTransformFunc(ar, tmp);
// peek value (try string)
const str = lar.readLengthPrefixedString();
if (str.length > 512) {
// heuristic in case the next key is magically again at a correct place
throw new Error('enum values should not be that long');
}
catch (e) {
// it failed, so it's probably a byte
isEnum = false;
// peek next key (if two or more elements)
if (count.count > 1) {
keyTransformFunc(ar, tmp);
} else {
// or peek string as name of the next property
lar.readLengthPrefixedString();
}
// reset cursor
lar.bytesRead = bytesRead;
lar.cursor = cursor;
}
// if we managed to get here, this is probably a enum as we managed to get a string for
// the value correctly
} catch (e) {
// it failed, so it's probably a byte
isEnum = false;
}
// reset cursor
lar.bytesRead = bytesRead;
lar.cursor = cursor;
}*/
}

@@ -101,0 +109,0 @@ if (isEnum) {

@@ -12,2 +12,3 @@ "use strict";

const Box_1 = require("./structs/Box");
const Guuid_1 = require("./structs/Guuid");
function transformStructProperty(ar, property) {

@@ -60,2 +61,5 @@ if (ar.isLoading()) {

break;
case 'Guid':
Guuid_1.transformGuuid(ar, property);
break;
default:

@@ -62,0 +66,0 @@ throw new Error(`Unknown struct type ${property.value.type}`);

{
"name": "satisfactory-json",
"version": "0.0.22",
"version": "0.0.23",
"description": "Convert Satisfactory save files to JSON and back",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc