GSX synced loading of fuel

This commit is contained in:
2026-02-13 21:34:56 +01:00
parent 69680ced03
commit 487ed3f589
10 changed files with 78 additions and 52 deletions
+19 -24
View File
@@ -1,45 +1,40 @@
const { applyPatch } = require("diff");
const fs = require("fs");
const util = require("node:util");
const exec = util.promisify(require("node:child_process").exec);
const readline = require("readline");
const { applyPatch } = require('diff');
const fs = require('fs');
const readline = require('readline');
const outPath =
"./PackageSources/html_ui/Pages/VCockpit/Instruments/aircraft_efb/KH_TFDi_MD11_efb";
const outPath = './PackageSources/html_ui/Pages/VCockpit/Instruments/aircraft_efb/KH_TFDi_MD11_efb';
fs.copyFileSync("./EFB/efb.css", `${outPath}/efb.css`);
let file1Contents = fs.readFileSync("./EFB/efb.js").toString();
let patch = fs.readFileSync("./EFB/efb-js.patch").toString();
let file1Contents = fs.readFileSync('./EFB/efb.js').toString();
let patch = fs.readFileSync('./EFB/efb-js.patch').toString();
let patchedFile = applyPatch(file1Contents, patch);
fs.writeFileSync(`${outPath}/efb.js`, patchedFile);
file1Contents = fs.readFileSync("./EFB/efb.index.js").toString();
patch = fs.readFileSync("./EFB/efb-index-js.patch").toString();
file1Contents = fs.readFileSync('./EFB/efb.index.js').toString();
patch = fs.readFileSync('./EFB/efb-index-js.patch').toString();
patchedFile = applyPatch(file1Contents, patch);
fs.writeFileSync(`${outPath}/efb.index.js`, patchedFile);
file1Contents = fs.readFileSync("./EFB/efb.html").toString();
patch = fs.readFileSync("./EFB/efb-html.patch").toString();
file1Contents = fs.readFileSync('./EFB/efb.html').toString();
patch = fs.readFileSync('./EFB/efb-html.patch').toString();
patchedFile = applyPatch(file1Contents, patch);
fs.writeFileSync(`${outPath}/efb.html`, patchedFile);
var output = "";
var output = '';
var lineReader = readline.createInterface({
input: fs.createReadStream(`${outPath}/App.js`),
});
lineReader.on("line", (line) => {
if (line.startsWith("import")) {
output += "// " + line + "\n";
} else if (line.startsWith("export")) {
output += "window.KH_LM = App;\n";
lineReader.on('line', (line) => {
if (line.startsWith('import')) {
output += '// ' + line + '\n';
} else if (line.startsWith('export')) {
output += 'window.KH_LM = App;\n';
} else {
output += line + "\n";
output += line + '\n';
}
});
lineReader.on("close", () => {
lineReader.on('close', () => {
fs.writeFile(`${outPath}/App.js`, output, (err) => {
if (err) console.log(err);
console.log("Import/Export removed.");
console.log('Import/Export removed.');
});
});