// DIE's signature file
// Author: hypn0 <hypn0@mail.ru>, LinXP

init("format", "");
includeScript("zlib");

function detect(bShowType, bShowVersion, bShowOptions) {
    var TrueTypeTags = [];
    TrueTypeTags['BASE'] =
        TrueTypeTags['cmap'] =
        TrueTypeTags['DSIG'] =
        TrueTypeTags['EBDT'] =
        TrueTypeTags['Feat'] =
        TrueTypeTags['FFTM'] =
        TrueTypeTags['GDEF'] =
        TrueTypeTags['GPOS'] =
        TrueTypeTags['GSUB'] =
        TrueTypeTags['LTSH'] =
        TrueTypeTags['OS/2'] = 1;

    if (Binary.compare("950412de00000000") || Binary.compare("de12049500000000")) {
        sName = "GNU Gettext Machine Object (.MO)";
        bDetected = true;
    } else if (TrueTypeTags[Binary.getString(0xC, 4)]) {
        sName = "TrueType font (.TTF)";
        bDetected = true;
    } else if (Binary.compare("f702018392c01c3b")) {
        sName = "Device Independent Document (.DVI)";
        bDetected = true;
    } else if (Binary.compare("31be000000ab0000") || Binary.compare("32be000000ab0000")) {
        sName = "Windows Write document (.WRI)";
        bDetected = true;
    } else if (Binary.compare("'MICROSOFT PIFEX'0087010000", 0x171)) {
        sName = "Microsoft Program Information (.PIF)";
        bDetected = true;
    } else if (Binary.compare("4c0000000114020000000000c000000000000046")) {
        sName = "Windows Shortcut (.LNK)";
        bDetected = true;
    } else if (Binary.compare("'Zinc Data File Version'")) {
        sName = "Zinc Data (.DAT)";
        bDetected = true;
    } else if (Binary.compare("00010000'Jet System DB  '00")) {
        sName = "Microsoft Access Workgroup Information (.MDW)";
        bDetected = true;
    } else if (Binary.compare("dca5..00..................00000000") ||
        Binary.compare("eca5c100..................00000000")) {
        sName = "Microsoft Word 2 document";
        bDetected = true;
    } else if (Binary.compare("'OTTO'................'CFF '")) {
        sName = "OpenType - CFF compact font (.OTF)";
        bDetected = true;
    } else if (Binary.compare("3cb86418caef9c95")) {
        sName = "Qt Message (.QM)";
        bDetected = true;
    } else if (Binary.compare("'SIB file: TsiLang binary translation data'")) {
        sName = "TsiLang binary translation data (.SIB)";
        bDetected = true;
    } else if (Binary.compare("......00..........000200") && Binary.compare("00'LP'", 0x21)) {
        sName = "Embedded OpenType font (.EOT)";
        bDetected = true;
    } else if (Binary.compare("d4c3b2a1020004")) {
        sName = "TCPDUMP's style capture (.ACP/PCAP)";
        bDetected = true;
    } else if (Binary.compare("'HSP'")) {
        sName = "OS/2 help file";
        bDetected = true;
    } else if (Binary.compare("'LN'0200")) {
        sName = "Quick Help";
        bDetected = true;
    } else if (Binary.compare("'MZIP'")) {
        sName = "MZIP archive";
        bDetected = true;
    } else if (Binary.compare("'Kaydara FBX Binary  '00")) {
        sName = "Kaydara FBX Binary (.FBX)";
        sVersion = Binary.read_uint16(0x17);
        bDetected = true;
    } else if (Binary.compare("89'FCP'0D0A1A0A")) {
        sName = "High-Logic FontCreator Project (.FCP)";
        sVersion = Binary.read_uint16(0x08) + "." + Binary.read_uint16(0x0A);
        var nZoffset = 0x14 + Binary.read_uint32(0x10) * 0x11 + 0x0C;
        detect_zlib(Binary, nZoffset);
        bDetected = true;
    } else if (Binary.compare("'XALZ'")) {
        sName = "Xamarin Compressed DLL";
        sOptions = sOptions.append("LZ4 compression", "Index:" + Binary.read_uint32(0x4), "Original size:" + Binary.read_uint32(0x8))
        bDetected = true;
    }

    return result(bShowType, bShowVersion, bShowOptions);
}