Esempio n. 1
0
CString GetOutFileName(CString csSplitFileName)
{
	LPCTSTR szExt = ::PathFindExtension(csSplitFileName);
	CString csFile(csSplitFileName, (int)(szExt - csSplitFileName));
	CString csFilePart;
	csFilePart.Format(_T("%s_filtered%s"), csFile, szExt);
	int cnt = 1;
	while (::PathFileExists(csFilePart))
	{
		csFilePart.Format(_T("%s_filtered(%d)%s"), csFile, cnt, szExt);
		++cnt;
	}
	return csFilePart;
}
Esempio n. 2
0
// This workaround is needed because Rooms engine cannot read
// from Android assets pseudo-folder
void preloadCutscene(const QString &worldContent){
    QXmlStreamReader xml(worldContent);
    QStringList csList;
    while(!xml.atEnd()){
        QXmlStreamReader::TokenType token = xml.readNext();

        if (token == QXmlStreamReader::StartDocument)
            continue;

        if (token == QXmlStreamReader::StartElement &&
                xml.name() == "action" &&
                xml.attributes().value("id") == "CUTSCENE_START"){
            while(!(xml.tokenType() == QXmlStreamReader::EndElement && xml.name() == "action")){
                xml.readNext();
                if (xml.name() != "param")
                    continue;
                QString csPath = xml.attributes().value("value").toString();
                QFile csFile(csPath);
                if (!csFile.exists()){
                    if (QFile::copy(QString("assets:/%1").arg(csPath), csPath))
                        csList.append(csPath);
                }
            }
        }
    }

    QRegExp rx("###[^\"]+\"([^\"]+)\"");
    foreach (const QString &f, csList){
        QFile file(f);
        file.open(QIODevice::ReadOnly | QIODevice::Text);
        QString txt = file.readAll();
        file.close();
        if(rx.indexIn(txt) != -1){
            QFile csdFile(rx.cap(1));
            if (!csdFile.exists()) {
                qDebug() << rx.cap(1);
                QFile::copy(QString("assets:/%1").arg(rx.cap(1)), rx.cap(1));
            }
        }
    }