ssn/src/installPatch.ts

29 lines
1.1 KiB
TypeScript

import { TextDecoder } from 'util';
import extractFile from './ssn/extractFile';
import getPatchmanifest from './ssn/getPatchmanifest';
import getSolidpkg from './ssn/getSolidpkg';
import readSsnFile from './ssn/readSsnFile';
const Decoder = new TextDecoder('utf-8');
(async () => {
//----- PATCHMANIFEST -----
//.patchmanifest files contain a single XML file called "manifest.xml"
const patchmanifestBuffer = await getPatchmanifest('assets_swtor_de_de');
console.log(patchmanifestBuffer.byteLength, patchmanifestBuffer);
const patchmanifestFiles = readSsnFile(patchmanifestBuffer);
console.log(patchmanifestFiles);
const patchmanifestFile = extractFile(patchmanifestFiles[0], [new DataView(patchmanifestBuffer)]);
const patchmanifestXml = Decoder.decode(patchmanifestFile);
console.log(patchmanifestXml);
//----- SOLIDPKG -----
//.solidpkg files contain a single Bencode file called "metafile.solid"
const solidpkgBuffer = await getSolidpkg('assets_swtor_de_de', -1, 0);
console.log(solidpkgBuffer.byteLength, solidpkgBuffer);
const solidPkgFiles = readSsnFile(solidpkgBuffer);
console.log(solidPkgFiles);
})();