Ejemplo n.º 1
0
/** This method should be reimplemeted if this is to be a import filter. It is
  * called to load the map data
  * @param url The url of the file to be loaded
  * @return  0 , The file was loaded without problems
  *         -1 , Could not open the file
  *         -2 , If the file is corrupt
  *         -4 , Wrong version
  */
int CMapFileFilterXML::loadData(QString filename)
{
	KZip zip(filename);
	if ( !zip.open( QIODevice::ReadOnly ) )
	{
		return -1;
	}

	int result = -1;
	const KArchiveDirectory* dir = zip.directory();
	const KArchiveEntry *e = dir->entry("map.xml");
	if (e->isFile())
	{
		const KArchiveFile* mapFile = (KArchiveFile*)e;

		if (mapFile)
		{
			QByteArray arr( mapFile->data() );
			result = loadXMLData(arr);
		}
	}

	zip.close();

	return result;
}
Ejemplo n.º 2
0
//--------------------------------------------------------------
void Device::loadXML(string dir)
{
	OFAPPLOG->begin("Device::loadXML()");

    ofxXmlSettings settings;
    string pathFile = getPathXML(dir);
    if ( settings.loadFile(pathFile) )
    {
		OFAPPLOG->println("Device, loaded "+pathFile);
		loadXMLData(settings);
    }
    else{
        OFAPPLOG->println("Device, error loading "+pathFile);
    }


	OFAPPLOG->end();
}