🐛 Fix dependencies check in patchmanifest verification
This commit is contained in:
parent
5574da3189
commit
25d8994593
1 changed files with 17 additions and 9 deletions
|
@ -28,8 +28,20 @@ export default function verifyPatchmanifest(manifestFile: xmlJs.Element, product
|
||||||
|
|
||||||
//<Dependencies />
|
//<Dependencies />
|
||||||
const Dependencies = PatchManifest.elements[0];
|
const Dependencies = PatchManifest.elements[0];
|
||||||
if (Dependencies.type !== 'element' || Dependencies.name !== 'Dependencies' || Dependencies.attributes !== undefined || Dependencies.elements !== undefined) {
|
if (Dependencies.type !== 'element' || Dependencies.name !== 'Dependencies' || Dependencies.attributes !== undefined) {
|
||||||
throw new Error('Expected Dependencies element with no child elements and no attributes.');
|
throw new Error('Expected Dependencies element with no attributes.');
|
||||||
|
}
|
||||||
|
const hasDependencies = product.startsWith('retailclient_');
|
||||||
|
if (Dependencies.elements !== undefined && !hasDependencies) {
|
||||||
|
throw new Error('Expected Dependencies element with no child elements.');
|
||||||
|
}
|
||||||
|
if (hasDependencies) {
|
||||||
|
for (const Dependency of (Dependencies.elements as xmlJs.Element[])) {
|
||||||
|
if (Dependency.type !== 'element' || Dependency.name !== 'Dependency' || Dependency.attributes !== undefined) {
|
||||||
|
throw new Error('Expected Dependency element with no attributes.');
|
||||||
|
}
|
||||||
|
//TODO: check text nodes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//<Name>assets_swtor_de_de</Name>
|
//<Name>assets_swtor_de_de</Name>
|
||||||
|
@ -88,8 +100,7 @@ export default function verifyPatchmanifest(manifestFile: xmlJs.Element, product
|
||||||
if (Releases.type !== 'element' || Releases.name !== 'Releases' || Releases.attributes !== undefined || Releases.elements === undefined) {
|
if (Releases.type !== 'element' || Releases.name !== 'Releases' || Releases.attributes !== undefined || Releases.elements === undefined) {
|
||||||
throw new Error('Expected Releases element.');
|
throw new Error('Expected Releases element.');
|
||||||
}
|
}
|
||||||
for (let i = 0, il = Releases.elements.length; i < il; i += 1) {
|
for (const Release of Releases.elements) {
|
||||||
const Release = Releases.elements[i];
|
|
||||||
//<Release>
|
//<Release>
|
||||||
if (Release.type !== 'element' || Release.name !== 'Release' || Release.attributes !== undefined || Release.elements === undefined || Release.elements.length !== 3) {
|
if (Release.type !== 'element' || Release.name !== 'Release' || Release.attributes !== undefined || Release.elements === undefined || Release.elements.length !== 3) {
|
||||||
throw new Error('Expected Release element.');
|
throw new Error('Expected Release element.');
|
||||||
|
@ -116,8 +127,7 @@ export default function verifyPatchmanifest(manifestFile: xmlJs.Element, product
|
||||||
if (ReleaseUpdatePaths.type !== 'element' || ReleaseUpdatePaths.name !== 'ReleaseUpdatePaths' || ReleaseUpdatePaths.attributes !== undefined || ReleaseUpdatePaths.elements === undefined) {
|
if (ReleaseUpdatePaths.type !== 'element' || ReleaseUpdatePaths.name !== 'ReleaseUpdatePaths' || ReleaseUpdatePaths.attributes !== undefined || ReleaseUpdatePaths.elements === undefined) {
|
||||||
throw new Error('Expected ReleaseUpdatePaths element.');
|
throw new Error('Expected ReleaseUpdatePaths element.');
|
||||||
}
|
}
|
||||||
for (let i = 0, il = ReleaseUpdatePaths.elements.length; i < il; i += 1) {
|
for (const ReleaseUpdatePath of ReleaseUpdatePaths.elements) {
|
||||||
const ReleaseUpdatePath = ReleaseUpdatePaths.elements[i];
|
|
||||||
//<ReleaseUpdatePath>
|
//<ReleaseUpdatePath>
|
||||||
if (ReleaseUpdatePath.type !== 'element' || ReleaseUpdatePath.name !== 'ReleaseUpdatePath' || ReleaseUpdatePath.attributes !== undefined || ReleaseUpdatePath.elements === undefined || ReleaseUpdatePath.elements.length !== 3) {
|
if (ReleaseUpdatePath.type !== 'element' || ReleaseUpdatePath.name !== 'ReleaseUpdatePath' || ReleaseUpdatePath.attributes !== undefined || ReleaseUpdatePath.elements === undefined || ReleaseUpdatePath.elements.length !== 3) {
|
||||||
throw new Error('Expected ReleaseUpdatePath element.');
|
throw new Error('Expected ReleaseUpdatePath element.');
|
||||||
|
@ -151,10 +161,8 @@ export default function verifyPatchmanifest(manifestFile: xmlJs.Element, product
|
||||||
throw new Error(`Expected ExtraData element with children in patch ${fromNum}to${toNum}.`);
|
throw new Error(`Expected ExtraData element with children in patch ${fromNum}to${toNum}.`);
|
||||||
}
|
}
|
||||||
if (!isPatchWithoutExtraData) {
|
if (!isPatchWithoutExtraData) {
|
||||||
const ExtraDataItems = ExtraData.elements as xmlJs.Element[];
|
for (const ExtraDataItem of (ExtraData.elements as xmlJs.Element[])) {
|
||||||
for (let j = 0, jl = ExtraDataItems.length; j < jl; j += 1) {
|
|
||||||
//<ExtraDataItem>
|
//<ExtraDataItem>
|
||||||
const ExtraDataItem = ExtraDataItems[j];
|
|
||||||
if (ExtraDataItem.type !== 'element' || ExtraDataItem.name !== 'ExtraDataItem' || ExtraDataItem.attributes !== undefined || ExtraDataItem.elements === undefined || ExtraDataItem.elements.length !== 2) {
|
if (ExtraDataItem.type !== 'element' || ExtraDataItem.name !== 'ExtraDataItem' || ExtraDataItem.attributes !== undefined || ExtraDataItem.elements === undefined || ExtraDataItem.elements.length !== 2) {
|
||||||
throw new Error('Expected ExtraDataItem element.');
|
throw new Error('Expected ExtraDataItem element.');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue