mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-21 00:59:29 +00:00
Throw an error if a skin is classic AND modern
This commit is contained in:
parent
8ae08dce40
commit
69da26fb7c
1 changed files with 7 additions and 2 deletions
|
|
@ -123,10 +123,15 @@ async function addClassicSkinFromBuffer(
|
|||
}
|
||||
|
||||
export async function getSkinType(zip: JSZip): Promise<SkinType> {
|
||||
if (zip.file(/main\.bmp$/i).length > 0) {
|
||||
const classic = (zip.file(/main\.bmp$/i).length > 0)
|
||||
const modern = (zip.file(/skin\.xml$/i).length > 0);
|
||||
if (classic && modern) {
|
||||
throw new Error("Skin is both modern and classic.");
|
||||
}
|
||||
if (classic) {
|
||||
return "CLASSIC";
|
||||
}
|
||||
if (zip.file(/skin\.xml$/i).length > 0) {
|
||||
if (modern) {
|
||||
return "MODERN";
|
||||
}
|
||||
throw new Error("Not a skin");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue