diff --git a/src/installPatch.ts b/src/installPatch.ts index d16a807..8c543f6 100644 --- a/src/installPatch.ts +++ b/src/installPatch.ts @@ -2,9 +2,17 @@ import getSolidpkg from './ssn/getSolidpkg'; import readSsnFile from './ssn/readSsnFile'; (async () => { - const buffer = await getSolidpkg('assets_swtor_de_de', -1, 0); - console.log(buffer.length, buffer); + //Read patchmanifest + const patchmanifestBuffer = await getPatchmanifest('assets_swtor_de_de'); + console.log(patchmanifestBuffer.length, patchmanifestBuffer); - const fileEntries = readSsnFile(buffer); - console.log(fileEntries); + const patchmanifestFiles = readSsnFile(patchmanifestBuffer); + console.log(patchmanifestFiles); + + //Read solidpkg + const solidpkgBuffer = await getSolidpkg('assets_swtor_de_de', -1, 0); + console.log(solidpkgBuffer.length, solidpkgBuffer); + + const solidPkgFiles = readSsnFile(solidpkgBuffer); + console.log(solidPkgFiles); })(); diff --git a/src/ssn/getPatchmanifest.ts b/src/ssn/getPatchmanifest.ts new file mode 100644 index 0000000..c3276a2 --- /dev/null +++ b/src/ssn/getPatchmanifest.ts @@ -0,0 +1,12 @@ +import getUrlContents from '../getUrlContents'; +import { Product } from '../interfaces/ISettings'; +import verifyProductName from '../verifyProductName'; + +export default function getPatchmanifest(product: Product): Promise { + //Verify function arguments + if (!verifyProductName(product)) { + throw new Error(`"${product}" is not a valid product.`); + } + + return getUrlContents({ host: 'manifest.swtor.com', path: `/patch/${product}.patchmanifest` }); +}