🐛 Fix patcher to ignore unchanged & deleted files
This commit is contained in:
parent
6e292106e3
commit
a416d86dbe
2 changed files with 21 additions and 4 deletions
|
@ -34,4 +34,4 @@ interface ISsnFileEntry {
|
|||
offset: number;
|
||||
}
|
||||
|
||||
export default ISsnFileEntry;
|
||||
export { ISsnFileEntry, SsnDiffType };
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import getUrlContents from '../cdn/getUrlContents';
|
||||
import { Product } from '../interfaces/ISettings';
|
||||
import { SsnDiffType } from '../interfaces/ISsnFileEntry';
|
||||
import extractFile from './extractFile';
|
||||
import getSolidpkg from './getSolidpkg';
|
||||
import readSsnFile from './readSsnFile';
|
||||
|
@ -9,13 +10,29 @@ export default async function getPatch(product: Product, from: number, to: numbe
|
|||
|
||||
const bufferArray = await Promise.all(solidPkg.files.map((file) => getUrlContents({ host: 'cdn-patch.swtor.com', path: `/patch/${product}/${product}_${from}to${to}/${file.name}` })));
|
||||
const zipFile = bufferArray[bufferArray.length - 1];
|
||||
const dvArray = bufferArray.map((buffer) => new DataView(buffer));
|
||||
|
||||
const fileEntries = readSsnFile(zipFile);
|
||||
|
||||
//TODO: verify file entries
|
||||
console.log(fileEntries);
|
||||
|
||||
const dvArray = bufferArray.map((buffer) => new DataView(buffer));
|
||||
fileEntries.map((entry) => extractFile(entry, dvArray) );
|
||||
//Extract newly added files
|
||||
fileEntries.filter((file) => file.diffType === SsnDiffType.NewFile).forEach(async (file) => {
|
||||
const fileContents = await extractFile(file, dvArray);
|
||||
console.log(fileContents);
|
||||
//TODO
|
||||
});
|
||||
|
||||
return fileEntries;
|
||||
//Extract changed files
|
||||
fileEntries.filter((file) => file.diffType === SsnDiffType.Changed).forEach((file) => {
|
||||
const fileContents = await extractFile(file, dvArray);
|
||||
console.log(fileContents);
|
||||
//TODO
|
||||
});
|
||||
|
||||
//Need to delete deleted files
|
||||
fileEntries.filter((file) => file.diffType === SsnDiffType.Deleted).forEach((file) => {
|
||||
//TODO
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue