Beispiel #1
0
int XmlCndInterface::readFile(std::vector<FEMCondition*> &conditions, const QString &fileName)
{
	QFile* file = new QFile(fileName);
	if (!file->open(QIODevice::ReadOnly | QIODevice::Text))
	{
		std::cout << "XMLInterface::readFEMCondFile() - Can't open xml-file." << std::endl;
		delete file;
		return 0;
	}
	if (!checkHash(fileName))
	{
		delete file;
		return 0;
	}

	QDomDocument doc("OGS-Cond-DOM");
	doc.setContent(file);
	QDomElement docElement = doc.documentElement(); //root element, used for identifying file-type
	if (docElement.nodeName().compare("OpenGeoSysCond"))
	{
		std::cout << "XMLInterface::readFEMCondFile() - Unexpected XML root." << std::endl;
		delete file;
		return 0;
	}

	//std::vector<FEMCondition*> conditions;
	QDomNodeList lists = docElement.childNodes();
	for (int i = 0; i < lists.count(); i++)
	{
		const QDomNode list_node (lists.at(i));
		if (list_node.nodeName().compare("BoundaryConditions") == 0)
			readConditions(list_node, conditions, FEMCondition::BOUNDARY_CONDITION);
		else if (list_node.nodeName().compare("InitialConditions") == 0)
			readConditions(list_node, conditions, FEMCondition::INITIAL_CONDITION);
		else if (list_node.nodeName().compare("SourceTerms") == 0)
			readConditions(list_node, conditions, FEMCondition::SOURCE_TERM);
	}
	if (!conditions.empty())
		return 1;             //do something like _geoObjects->addStationVec(stations, stnName, color);
	else
	{
		std::cout << "XMLInterface::readFEMCondFile() - No FEM Conditions found..." <<
		std::endl;
		return 0;
	}

	delete file;

	return 1;
}
Beispiel #2
0
void GameModule::loadActions(Common::SeekableReadStream &s) {
	debug(0, "GameModule::loadActions()");

	s.seek(0x180);
	_actionsCount = s.readUint32LE();
	uint32 offs = s.readUint32LE();
	_actions = new Action[_actionsCount];
	for (int i = 0; i < _actionsCount; ++i) {
		s.seek(offs + i * 72);
		debug(0, "Action(%d) offs: %08X", i, offs + i * 72);
		_actions[i].conditions = readConditions(s);
		for (int j = 0; j < 8; ++j) {
			_actions[i].results.actionResults[j].kind = s.readByte();
			_actions[i].results.actionResults[j].value1 = s.readByte();
			_actions[i].results.actionResults[j].value2 = s.readUint16LE();
		}
		const int actionListCount = s.readUint32LE();
		const uint32 actionListOffs = s.readUint32LE();
		s.seek(actionListOffs);
		for (int j = 0; j < actionListCount; ++j) {
			ActionCommand actionCommand;
			actionCommand.cmd = s.readUint16LE();
			actionCommand.sceneObjectIndex = s.readUint16LE();
			actionCommand.timeStamp = s.readUint32LE();
			actionCommand.walkDest = readPoint(s);
			actionCommand.param = s.readUint32LE();
			_actions[i].actionCommands.push_back(actionCommand);
		}
	}
}
Beispiel #3
0
void UTask::read(const QJsonObject &jsonObj)
{
    this->id(jsonObj["id"].toString());
    this->value(jsonObj["value"].toString());
    this->lastUpdated(jsonObj["lastUpdated"].toDouble());

    readConditions(jsonObj);
}
void AntistringConfiguration::configurationUpdated()
{
    readConditions();

    Enabled = config_file.readBoolEntry("PowerKadu", "enable_antistring");
    MessageStop = config_file.readBoolEntry("PowerKadu", "message stop");
    LogMessage = config_file.readBoolEntry("PowerKadu", "log message");
    ReturnMessage = config_file.readEntry("PowerKadu", "admonish_tresc_config");
    LogFile = config_file.readEntry("PowerKadu", "log file", profilePath("antistring.log"));
}
Beispiel #5
0
void Resource::readView(Common::File *file, ViewDataList &list) {
	list.clear();
	while (file->readByte() == 1) {
		list.push_back(ViewData());
		ViewData &view = list.back();

		view._condition = readConditions(file);
		view._graphicName = readString(file);
		readCloseUps(0, file, view._closeUps);
	}
}
Beispiel #6
0
void GameModule::loadSceneSounds(Common::SeekableReadStream &s) {
	debug(0, "GameModule::loadSceneSounds()");

	s.seek(0x1A0);
	_sceneSoundsCount = s.readUint32LE();
	uint32 offs = s.readUint32LE();
	_sceneSounds = new SceneSound[_sceneSoundsCount];
	s.seek(offs);
	for (int i = 0; i < _sceneSoundsCount; ++i) {
		_sceneSounds[i].conditions = readConditions(s);
		_sceneSounds[i].soundNum = s.readUint32LE();
	}
}
Beispiel #7
0
void Resource::readRule(Common::File *file, RuleList &rules) {
	rules.clear();
	while (file->readByte() == 1) {
		rules.push_back(Rule());
		Rule &rule = rules.back();

		rule._ruleType = (RuleType)file->readSint16LE();
		rule._param1 = file->readSint16LE();
		rule._param2 = file->readSint16LE();
		rule._condition = readConditions(file);
		readAction(file, rule._actionList);
	}
}
Beispiel #8
0
int XmlCndInterface::readFile(const QString &fileName)
{
	if(XMLQtInterface::readFile(fileName) == 0)
		return 0;

	QDomDocument doc("OGS-Cond-DOM");
	doc.setContent(_fileData);
	QDomElement docElement = doc.documentElement(); //root element, used for identifying file-type
	if (docElement.nodeName().compare("OpenGeoSysCond"))
	{
		ERR("XMLInterface::readFEMCondFile(): Unexpected XML root.");
		return 0;
	}

	std::size_t const n_cond_before(this->_project->getConditions().size());
	QDomNodeList lists = docElement.childNodes();
	for (int i = 0; i < lists.count(); i++)
	{
		const QDomNode list_node (lists.at(i));
		if (list_node.nodeName().compare("BoundaryConditions") == 0)
			readConditions(list_node, FEMCondition::BOUNDARY_CONDITION);
		else if (list_node.nodeName().compare("InitialConditions") == 0)
			readConditions(list_node, FEMCondition::INITIAL_CONDITION);
		else if (list_node.nodeName().compare("SourceTerms") == 0)
			readConditions(list_node, FEMCondition::SOURCE_TERM);
	}
	std::size_t const n_cond_after(this->_project->getConditions().size());
	if (n_cond_after-n_cond_before > 0)
		return 1;     //do something like _geoObjects->addStationVec(stations, stnName, color);
	else
	{
		WARN("XMLInterface::readFEMCondFile(): No FEM Conditions found.");
		return 0;
	}

	return 1;
}
Beispiel #9
0
void GameModule::loadSceneObjectInits(Common::SeekableReadStream &s) {
	debug(0, "GameModule::loadSceneObjectInits()");

	s.seek(0x178);
	_sceneObjectInitsCount = s.readUint32LE();
	uint32 offs = s.readUint32LE();
	_sceneObjectInits = new SceneObjectInit[_sceneObjectInitsCount];
	s.seek(offs);
	for (int i = 0; i < _sceneObjectInitsCount; ++i) {
		_sceneObjectInits[i].conditions = readConditions(s);
		_sceneObjectInits[i].sceneObjectIndex = s.readUint32LE();
		_sceneObjectInits[i].animIndex = s.readUint32LE();
		_sceneObjectInits[i].x = s.readUint16LE();
		_sceneObjectInits[i].y = s.readUint16LE();
	}
}