示例#1
0
xpr_bool_t ProgramAss::load(fxfile::base::ConfFileEx &aConfFile)
{
    xpr_size_t         i;
    xpr_tchar_t        sKey[0xff];
    const xpr_tchar_t *sValue;
    ConfFile::Section *sSection;
    ProgramAssItem    *sProgramAssItem;

    sSection = aConfFile.findSection(kProgramAssSection);
    if (XPR_IS_NULL(sSection))
        return XPR_FALSE;

    for (i = 0; i < MAX_PROGRAM_ASS; ++i)
    {
        _stprintf(sKey, kNameKey, i + 1);

        sValue = aConfFile.getValueS(sSection, sKey, XPR_NULL);
        if (XPR_IS_NULL(sValue))
            break;

        sProgramAssItem = new ProgramAssItem;
        XPR_ASSERT(sProgramAssItem != XPR_NULL);

        sProgramAssItem->mName = sValue;

        _stprintf(sKey, kTypeKey, i + 1);
        sProgramAssItem->mType = aConfFile.getValueI(sSection, sKey, ProgramAssTypeNone);

        _stprintf(sKey, kMethodKey, i + 1);
        sProgramAssItem->mMethod = aConfFile.getValueI(sSection, sKey, ProgramAssMethodExt);

        if (sProgramAssItem->mMethod == ProgramAssMethodExt)
        {
            _stprintf(sKey, kExtensionKey, i + 1);
            sProgramAssItem->mExts = aConfFile.getValueS(sSection, sKey, XPR_STRING_LITERAL(""));
        }
        else
        {
            _stprintf(sKey, kFilterKey, i + 1);
            sProgramAssItem->mExts = aConfFile.getValueS(sSection, sKey, XPR_STRING_LITERAL(""));
        }

        _stprintf(sKey, kProgramKey, i + 1);
        sProgramAssItem->mPath = aConfFile.getValueS(sSection, sKey, XPR_STRING_LITERAL(""));

        addItem(sProgramAssItem);
    }

    return XPR_TRUE;
}
示例#2
0
文件: filter.cpp 项目: 3rdexp/fxfile
xpr_bool_t Filter::load(fxfile::base::ConfFileEx &aConfFile)
{
    xpr_size_t         i;
    xpr_tchar_t        sKey[0xff];
    const xpr_tchar_t *sValue;
    FilterItem        *sFilterItem;
    ConfFile::Section *sSection;

    sSection = aConfFile.findSection(kFilterSection);
    if (XPR_IS_NULL(sSection))
        return XPR_FALSE;

    for (i = 0; i < MAX_FILTER; ++i)
    {
        _stprintf(sKey, kNameKey, i + 1);

        sValue = aConfFile.getValueS(sSection, sKey, XPR_NULL);
        if (XPR_IS_NULL(sValue))
            break;

        sFilterItem = new FilterItem;
        XPR_ASSERT(sFilterItem != XPR_NULL);

        sFilterItem->mName = sValue;

        _stprintf(sKey, kExtensionKey, i + 1);
        sFilterItem->mExts = aConfFile.getValueS(sSection, sKey, XPR_STRING_LITERAL(""));

        _stprintf(sKey, kColorKey, i + 1);
        sFilterItem->mColor = aConfFile.getValueC(sSection, sKey, RGB(0,0,0));

        _stprintf(sKey, kIconIndexKey, i + 1);
        sFilterItem->mIconIndex = aConfFile.getValueI(sSection, sKey, -1);

        addFilter(sFilterItem);
    }

    return XPR_TRUE;
}