// Detect It Easy: detection rule file

// Author: DosX
// E-Mail: collab@kay-software.ru
// GitHub: https://github.com/DosX-dev
// Telegram: @DosX_dev

// https://en.wikipedia.org/wiki/Minecraft
init("format", "Minecraft");

function detect() {
    if (ZIP.getFileFormatVersion() === "2.0" && ZIP.getFileFormatOptions() === "Deflate") {
        var fsFileSuffix = Binary.getFileSuffix().toLowerCase(),
            fsFileSuffixMatch = fsFileSuffix.substring(0, 2) === "mc" ?
                fsFileSuffix.match(/^mc(world|pack|addon)$/) : null;

        if (fsFileSuffixMatch) {
            switch (fsFileSuffixMatch[1]) {
                case "world": sOptions = "World"; break;
                case "pack": sOptions = "Resource Pack"; break;
                case "addon": sOptions = "Add-on"; break;
            }

            sVersion = "Bedrock Edition";
            bDetected = true;
        }
    }

    return result();
}