From 7c24bcc83476dcbdd7f7acbe14ecef4398962689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 1 Mar 2014 23:06:47 +0100 Subject: Reorganize the version-related code. --- logic/VersionFile.h | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 logic/VersionFile.h (limited to 'logic/VersionFile.h') diff --git a/logic/VersionFile.h b/logic/VersionFile.h new file mode 100644 index 00000000..04694999 --- /dev/null +++ b/logic/VersionFile.h @@ -0,0 +1,90 @@ +#pragma once + +#include +#include +#include +#include "logic/OpSys.h" +#include "logic/OneSixRule.h" +class VersionFinal; + +struct VersionFile +{ + int order; + QString name; + QString fileId; + QString version; + // TODO use the mcVersion to determine if a version file should be removed on update + QString mcVersion; + QString filename; + // TODO requirements + // QMap requirements; + QString id; + QString mainClass; + QString overwriteMinecraftArguments; + QString addMinecraftArguments; + QString removeMinecraftArguments; + QString processArguments; + QString type; + QString releaseTime; + QString time; + QString assets; + int minimumLauncherVersion = -1; + + bool shouldOverwriteTweakers = false; + QStringList overwriteTweakers; + QStringList addTweakers; + QStringList removeTweakers; + + struct Library + { + QString name; + QString url; + QString hint; + QString absoluteUrl; + bool applyExcludes = false; + QStringList excludes; + bool applyNatives = false; + QList> natives; + bool applyRules = false; + QList> rules; + + // user for '+' libraries + enum InsertType + { + Apply, + Append, + Prepend, + Replace + }; + InsertType insertType = Append; + QString insertData; + enum DependType + { + Soft, + Hard + }; + DependType dependType = Soft; + + static Library fromJson(const QJsonObject &libObj, const QString &filename, + bool &isError); + }; + bool shouldOverwriteLibs = false; + QList overwriteLibs; + QList addLibs; + QList removeLibs; + + enum ApplyError + { + LauncherVersionError, + OtherError, + NoApplyError + }; + + static VersionFile fromJson(const QJsonDocument &doc, const QString &filename, + const bool requireOrder, bool &isError, + const bool isFTB = false); + + static std::shared_ptr createLibrary(const Library &lib); + int findLibrary(QList> haystack, const QString &needle); + ApplyError applyTo(VersionFinal *version); +}; \ No newline at end of file -- cgit v1.2.3