From c83c3045bcbe275266faf46dda7f77506db5fd5a Mon Sep 17 00:00:00 2001 From: C-3PO Date: Fri, 22 Jun 2018 13:34:36 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20support=20for=20patchmanifest?= =?UTF-8?q?=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/installPatch.ts | 16 ++++++++++++---- src/ssn/getPatchmanifest.ts | 12 ++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 src/ssn/getPatchmanifest.ts 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` }); +}