Skip to content
This repository has been archived by the owner on Jun 6, 2022. It is now read-only.

Commit

Permalink
Fix Uplay parser
Browse files Browse the repository at this point in the history
  • Loading branch information
doZennn committed Dec 16, 2019
1 parent 48c0a61 commit b837b3c
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/js/importers/Uplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class Uplay {
const finalOutput = [];
let game = ['root:'];
let launcherId = null;
let end = false;
this._generateHexArr(configFile).forEach((hexStr) => {
const line = Buffer.from(hexStr, 'hex').toString('utf8').replace(/\n/g, '');
const foundId = hexStr.match(/08([0-9a-f]+)10[0-9a-f]+1a/);
Expand Down Expand Up @@ -90,14 +91,22 @@ class Uplay {
}
}

if (line.indexOf('localizations:') === 0) {
end = true;
return;
}

// Already manually saved "root:"
if (line.trim().includes('root:') && !line.trim().includes('_')) {
end = false;
return;
}

// Save lines if starts with spaces
if (line.substr(0, 2) === ' ' && !line.includes('sort_string:')) {
game.push(line);
if (!end) {
// Save lines if starts with spaces
if (line.substr(0, 2) === ' ' && !line.includes('sort_string:')) {
game.push(line);
}
}
});
resolve(finalOutput);
Expand Down Expand Up @@ -289,11 +298,13 @@ class Uplay {
}

// Override installer name if this value
if (typeof game.root.default[game.root.name] !== 'undefined') {
if (typeof game.root.default !== 'undefined' && typeof game.root.default[game.root.name] !== 'undefined') {
gameName = game.root.default[game.root.name];
}
}

console.log(gameName);

if (game.root.space_id) {
gameId = game.root.space_id;
} else {
Expand Down

0 comments on commit b837b3c

Please sign in to comment.