// Detect It Easy: detection rule file
// Author: horsicq <horsicq@gmail.com>

// https://www.gnu.org/software/xorriso/
meta("tool", "xorriso");

function detect() {
    var sDataPreparer = ISO9660.getDataPreparerIdentifier();

    if (sDataPreparer.indexOf("XORRISO") !== -1) {
        bDetected = true;

        // Try to extract version if present
        // Format: "XORRISO-1.5.4 2021.01.30.150001, LIBISOBURN-1.5.4, LIBISOFS-1.5.4, LIBBURN-1.5.4"
        var nVerPos = sDataPreparer.indexOf("XORRISO-");
        if (nVerPos !== -1) {
            var sVersionPart = sDataPreparer.substring(nVerPos + 8),
                nSpacePos = sVersionPart.indexOf(" ");

            if (nSpacePos !== -1) {
                sVersion = sVersionPart.substring(0, nSpacePos);
            }
        }
    }

    return result();
}