diff options
author | Petr Mrázek <peterix@gmail.com> | 2014-05-08 21:20:10 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2014-06-09 01:38:30 +0200 |
commit | 8a3a0f5a529a95c7511436051b63887dff158c50 (patch) | |
tree | 0162e0d6a37cd5a5b3aa5facf6ba6561e33f60bf /logic/VersionFile.h | |
parent | 69a9ca39ad0685663092a4455de3865715f0122e (diff) | |
download | MultiMC-8a3a0f5a529a95c7511436051b63887dff158c50.tar MultiMC-8a3a0f5a529a95c7511436051b63887dff158c50.tar.gz MultiMC-8a3a0f5a529a95c7511436051b63887dff158c50.tar.lz MultiMC-8a3a0f5a529a95c7511436051b63887dff158c50.tar.xz MultiMC-8a3a0f5a529a95c7511436051b63887dff158c50.zip |
Reorganize logic code.
Diffstat (limited to 'logic/VersionFile.h')
-rw-r--r-- | logic/VersionFile.h | 145 |
1 files changed, 0 insertions, 145 deletions
diff --git a/logic/VersionFile.h b/logic/VersionFile.h deleted file mode 100644 index ae0c58a0..00000000 --- a/logic/VersionFile.h +++ /dev/null @@ -1,145 +0,0 @@ -#pragma once - -#include <QString> -#include <QStringList> -#include <memory> -#include "logic/OpSys.h" -#include "logic/OneSixRule.h" -#include "MMCError.h" - -class VersionFinal; - -class VersionBuildError : public MMCError -{ -public: - VersionBuildError(QString cause) : MMCError(cause) {}; - virtual ~VersionBuildError() noexcept {} -}; - -/** - * the base version file was meant for a newer version of the vanilla launcher than we support - */ -class LauncherVersionError : public VersionBuildError -{ -public: - LauncherVersionError(int actual, int supported) - : VersionBuildError(QObject::tr( - "The base version file of this instance was meant for a newer (%1) " - "version of the vanilla launcher than this version of MultiMC supports (%2).") - .arg(actual) - .arg(supported)) {}; - virtual ~LauncherVersionError() noexcept {} -}; - -/** - * some patch was intended for a different version of minecraft - */ -class MinecraftVersionMismatch : public VersionBuildError -{ -public: - MinecraftVersionMismatch(QString fileId, QString mcVersion, QString parentMcVersion) - : VersionBuildError(QObject::tr("The patch %1 is for a different version of Minecraft " - "(%2) than that of the instance (%3).") - .arg(fileId) - .arg(mcVersion) - .arg(parentMcVersion)) {}; - virtual ~MinecraftVersionMismatch() noexcept {} -}; - -struct RawLibrary; -typedef std::shared_ptr<RawLibrary> RawLibraryPtr; -struct RawLibrary -{ - QString name; - QString url; - QString hint; - QString absoluteUrl; - bool applyExcludes = false; - QStringList excludes; - bool applyNatives = false; - QList<QPair<OpSys, QString>> natives; - bool applyRules = false; - QList<std::shared_ptr<Rule>> rules; - - // user for '+' libraries - enum InsertType - { - Apply, - Append, - Prepend, - Replace - }; - InsertType insertType = Append; - QString insertData; - enum DependType - { - Soft, - Hard - }; - DependType dependType = Soft; - - static RawLibraryPtr fromJson(const QJsonObject &libObj, const QString &filename); -}; - -struct Jarmod; -typedef std::shared_ptr<Jarmod> JarmodPtr; -struct Jarmod -{ - QString name; - QString baseurl; - QString hint; - QString absoluteUrl; - - static JarmodPtr fromJson(const QJsonObject &libObj, const QString &filename); -}; - -struct VersionFile; -typedef std::shared_ptr<VersionFile> VersionFilePtr; -struct VersionFile -{ -public: /* methods */ - static VersionFilePtr fromJson(const QJsonDocument &doc, const QString &filename, - const bool requireOrder, const bool isFTB = false); - - static OneSixLibraryPtr createLibrary(RawLibraryPtr lib); - int findLibrary(QList<OneSixLibraryPtr> haystack, const QString &needle); - void applyTo(VersionFinal *version); - bool isVanilla(); - bool hasJarMods(); -public: /* data */ - int order = 0; - 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<QString, QString> requirements; - QString id; - QString mainClass; - QString appletClass; - QString overwriteMinecraftArguments; - QString addMinecraftArguments; - QString removeMinecraftArguments; - QString processArguments; - QString type; - QString versionReleaseTime; - QString versionFileUpdateTime; - QString assets; - int minimumLauncherVersion = -1; - - bool shouldOverwriteTweakers = false; - QStringList overwriteTweakers; - QStringList addTweakers; - QStringList removeTweakers; - - bool shouldOverwriteLibs = false; - QList<RawLibraryPtr> overwriteLibs; - QList<RawLibraryPtr> addLibs; - QList<QString> removeLibs; - - QSet<QString> traits; - - QList<JarmodPtr> jarMods; -}; |