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

// https://dev.lovelyhq.com/libburnia/libisoburn
meta("library", "libisoburn");

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

    if (sDataPreparer.indexOf("LIBISOBURN") !== -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("LIBISOBURN-");
        if (nVerPos !== -1) {
            var sVersionPart = sDataPreparer.substring(nVerPos + 11),
                nCommaPos = sVersionPart.indexOf(",");

            if (nCommaPos !== -1) {
                sVersion = sVersionPart.substring(0, nCommaPos);
            } else {
                var nSpacePos = sVersionPart.indexOf(" ");
                if (nSpacePos !== -1) {
                    sVersion = sVersionPart.substring(0, nSpacePos);
                }
            }
        }
    }

    return result();
}
