CommConfigurable::CommConfigurable(ConfigFile & configFile, Log & log)
  : comm() {
  // Should we use CommPlayer?
  if (configFile.getBool("configurable/comm/useCommPlayer", true)) {
    comm.push_back(new CommPlayer(configFile, log));
  }
  // Should we use CommRemote?
  if (configFile.getBool("configurable/comm/useCommRemote", true)) {
    comm.push_back(new CommRemote(configFile, log));
  }
}
LogConfigurable::LogConfigurable(ConfigFile & configFile)
  : Log(configFile),
    log() {
  // Should we use LogToRemote?
  if (configFile.getBool("configurable/log/useLogToRemote", true)) {
    log.push_back(new LogToRemote(configFile));
  }
  // Should we use LogToText?
  if (configFile.getBool("configurable/log/useLogToText", true)) {
    log.push_back(new LogToText(configFile));
  }
  // Should we use LogToFile?
  if (configFile.getBool("configurable/log/useLogToFile", true)) {
    log.push_back(new LogToFile(configFile));
  }
}
示例#3
0
void SubMainFrame::OpenLastFiles()
{
    ConfigFile *clientConfig = Globals::Instance()->GetConfig();

    //Open the last file in the history
    if(clientConfig->getBool("AutoOpenLastSession", true))
    {
        std::vector<std::string> listFileSession =  clientConfig->getArray("RecentFileSession");
        for(std::vector<std::string>::iterator iter = listFileSession.begin(); iter != listFileSession.end(); iter++)
        {
            OpenFile(wxString((*iter).c_str(), wxConvLocal));
            wxLogDebug(wxT("Auto Opened: %s"), wxString(*iter));
        }
    }
}
示例#4
0
bool Annotation::initSection(const std::string &entry, const std::string &cfgname)
{
    AnnotationCfgEntry e, *ne;

    ConfigFile *cfg = s2e()->getConfig();
    llvm::raw_ostream &os  = s2e()->getWarningsStream();
    std::vector<std::string> cfgkeys = s2e()->getConfig()->getListKeys(entry);

    e.cfgname = cfgname;

    bool ok;


    e.isActive = cfg->getBool(entry + ".active", false, &ok);
    if (!ok) {
        os << "You must specify whether the entry is active in " << entry << ".active!" << '\n';
        return false;
    }

    e.module = cfg->getString(entry + ".module", "", &ok);
    if (!ok) {
        os << "You must specify a valid module for " << entry << ".module!" << '\n';
        return false;
    }else {
        if (!m_moduleExecutionDetector->isModuleConfigured(e.module)) {
            os << "The module " << e.module << " is not configured in ModuleExecutionDetector!" << '\n';
            return false;
        }
    }


    e.address = cfg->getInt(entry + ".address", 0, &ok);
    if (!ok) {
        os << "You must specify a valid address for " << entry << ".address!" << '\n';
        return false;
    }

    if (!m_functionMonitor || !m_moduleExecutionDetector || !m_osMonitor) {
        os << "You must enable FunctionMonitor, ModuleExecutionDetector, and an OS monitor plugin\n";
        return false;
    }

    // Check if this is a call or an instruction annotation
    e.annotation = "";
    if (std::find(cfgkeys.begin(), cfgkeys.end(), "callAnnotation") != cfgkeys.end())	{
        e.annotation = cfg->getString(entry + ".callAnnotation", e.annotation, &ok);
        e.isCallAnnotation = true;
    } else if (std::find(cfgkeys.begin(), cfgkeys.end(), "instructionAnnotation") != cfgkeys.end())	{
        e.annotation = cfg->getString(entry + ".instructionAnnotation", e.annotation, &ok);
        e.isCallAnnotation = false;
    }

    // Assert that this is a properly attached annotation
    if (!ok || e.annotation=="") {
        os << "You must specify either " << entry << ".callAnnotation or .instructionAnnotation!" << '\n';
        return false;
    }

    // Get additional annotation-specific options
    e.paramCount = 0;
    e.beforeInstruction = false;
    e.switchInstructionToSymbolic = false;
    if (e.isCallAnnotation) {
        // Get the number of arguments of the annotated subroutine
        e.paramCount = cfg->getInt(entry + ".paramcount", e.paramCount, &ok);
        if (!ok) {
            os << "You must specify a valid number of function parameters for " << entry << ".paramcount!" << '\n';
            return false;
        }
    } else {
        // Whether to call the annotation before or after the instruction
        e.beforeInstruction = cfg->getBool(entry + ".beforeInstruction", e.beforeInstruction, &ok);
        e.switchInstructionToSymbolic = cfg->getBool(entry + ".switchInstructionToSymbolic", e.switchInstructionToSymbolic, &ok);
    }

    ne = new AnnotationCfgEntry(e);
    m_entries.insert(ne);

    return true;
}
GameControllerAlwaysPlaying::GameControllerAlwaysPlaying(ConfigFile & configFile, Log & _log)
 : isBlueTeam(configFile.getBool("gameController/isBlueTeam", 1)),
   log(_log)
{
}