Пример #1
0
void CfgPanel::OnApply()
{
    LogManager *m = LogManager::Get();

    for (ConfigManagerContainer::StringToStringMap::iterator i = c2l.begin(); i != c2l.end(); ++i)
    {
        if (!!i->second.IsEmpty())
        {
            int slot = 0;
            while (slot <= LogManager::max_logs && m->Slot(slot).title != i->second)
                ++slot;

            m->SetLog(m->New(i->second), slot);
        }
    }

    // since we use ConfigManagerContainer::StringToStringMap, we could store whatever settings we have like:
    //   ConfigManager::Get()->Write(_T("/loghacker/c2l"), c2l);
    //   ConfigManager::Get()->Write(_T("/loghacker/c2f"), c2f);
}
Пример #2
0
void ScriptingManager::RefreshTrusts()
{
    // reload trusted scripts set
    m_TrustedScripts.clear();
    ConfigManagerContainer::StringToStringMap myMap;
    Manager::Get()->GetConfigManager(_T("security"))->Read(_T("/trusted_scripts"), &myMap);
    ConfigManagerContainer::StringToStringMap::iterator it;
    for (it = myMap.begin(); it != myMap.end(); ++it)
    {
        wxString key = it->second.BeforeFirst(_T('?'));
        wxString value = it->second.AfterFirst(_T('?'));

        TrustedScriptProps props;
        props.permanent = true;
        unsigned long tmp;
        value.ToULong(&tmp, 16);
        props.crc = tmp;
        m_TrustedScripts.insert(m_TrustedScripts.end(), std::make_pair(key, props));
    }
}
Пример #3
0
void ConfigManager::Write(const wxString& name, const ConfigManagerContainer::StringToStringMap& map)
{
    wxString key(name);
    TiXmlElement* e = AssertPath(key);

    TiXmlElement *leaf = GetUniqElement(e, key);

    TiXmlElement *mNode;
    mNode = GetUniqElement(leaf, _T("ssmap"));
    leaf->RemoveChild(mNode);
    mNode = GetUniqElement(leaf, _T("ssmap"));

    for (ConfigManagerContainer::StringToStringMap::const_iterator it = map.begin(); it != map.end(); ++it)
    {
        TiXmlElement s(cbU2C(it->first));

        TiXmlText t(cbU2C(it->second));
        t.SetCDATA(true);

        s.InsertEndChild(t);
        mNode->InsertEndChild(s);
    }
}