mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Card Database converter (#3694)
* Database converter * Fix win compilation and NSIS installer * Maybe fix windows again * Re-fix windows
This commit is contained in:
parent
8682367b52
commit
ada13f6578
8 changed files with 301 additions and 1 deletions
67
dbconverter/src/main.cpp
Normal file
67
dbconverter/src/main.cpp
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2019 by Fabio Bas *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <QCommandLineParser>
|
||||
#include <QCoreApplication>
|
||||
#include <QFileInfo>
|
||||
#include <QtGlobal>
|
||||
#include <QDebug>
|
||||
|
||||
#include "version_string.h"
|
||||
#include "mocks.h"
|
||||
#include "main.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
app.setOrganizationName("Cockatrice");
|
||||
app.setApplicationName("Dbconverter");
|
||||
app.setApplicationVersion(VERSION_STRING);
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.addPositionalArgument("olddb", "Read existing card database from <file>");
|
||||
parser.addPositionalArgument("newdb", "Write new card database to <file>");
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
parser.process(app);
|
||||
|
||||
QString oldDbPath;
|
||||
QString newDbPath;
|
||||
QStringList args = parser.positionalArguments();
|
||||
if (args.count() == 2)
|
||||
{
|
||||
oldDbPath = QFileInfo(args.at(0)).absoluteFilePath();
|
||||
newDbPath = QFileInfo(args.at(1)).absoluteFilePath();
|
||||
} else {
|
||||
qCritical() << "Usage: dbconverter <olddb> <newdb>";
|
||||
parser.showHelp(1);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
settingsCache = new SettingsCache;
|
||||
CardDatabaseConverter *db = new CardDatabaseConverter;
|
||||
|
||||
qInfo() << "---------------------------------------------";
|
||||
qInfo() << "Loading cards from" << oldDbPath;
|
||||
db->loadCardDatabase(oldDbPath);
|
||||
qInfo() << "---------------------------------------------";
|
||||
qInfo() << "Saving cards to" << newDbPath;
|
||||
db->saveCardDatabase(newDbPath);
|
||||
qInfo() << "---------------------------------------------";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue