2015-02-03 03:55:30 +05:30
|
|
|
/* Copyright 2013-2015 MultiMC Contributors
|
2014-01-22 12:03:32 +05:30
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <QList>
|
|
|
|
#include <QJsonObject>
|
|
|
|
#include <QJsonArray>
|
|
|
|
#include <QJsonDocument>
|
|
|
|
#include <QFile>
|
|
|
|
#include <QFileInfo>
|
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QObject>
|
|
|
|
#include <QDir>
|
2014-05-10 05:23:32 +05:30
|
|
|
#include <qresource.h>
|
2014-05-09 00:50:10 +05:30
|
|
|
#include <modutils.h>
|
2015-01-28 03:01:07 +05:30
|
|
|
#include <pathutils.h>
|
2014-05-09 00:50:10 +05:30
|
|
|
|
2014-05-09 20:46:25 +05:30
|
|
|
#include "logic/minecraft/VersionBuilder.h"
|
2015-01-28 03:01:07 +05:30
|
|
|
#include "logic/minecraft/MinecraftProfile.h"
|
2014-05-09 00:50:10 +05:30
|
|
|
#include "logic/minecraft/OneSixRule.h"
|
2015-01-28 03:01:07 +05:30
|
|
|
#include "logic/minecraft/ProfilePatch.h"
|
2014-05-09 00:50:10 +05:30
|
|
|
#include "logic/minecraft/VersionFile.h"
|
2014-05-10 05:23:32 +05:30
|
|
|
#include "VersionBuildError.h"
|
|
|
|
#include "MinecraftVersionList.h"
|
2015-01-28 03:01:07 +05:30
|
|
|
#include "ProfileUtils.h"
|
2014-05-09 00:50:10 +05:30
|
|
|
|
|
|
|
#include "logic/OneSixInstance.h"
|
|
|
|
#include "logic/MMCJson.h"
|
2014-01-22 12:03:32 +05:30
|
|
|
|
2014-01-24 02:01:41 +05:30
|
|
|
#include "logger/QsLog.h"
|
2014-01-22 12:03:32 +05:30
|
|
|
|
2014-05-09 20:46:25 +05:30
|
|
|
VersionBuilder::VersionBuilder()
|
2014-01-27 23:50:07 +05:30
|
|
|
{
|
2014-01-23 02:45:50 +05:30
|
|
|
}
|
|
|
|
|
2015-01-28 03:01:07 +05:30
|
|
|
void VersionBuilder::build(MinecraftProfile *version, OneSixInstance *instance)
|
2014-01-23 02:45:50 +05:30
|
|
|
{
|
2014-05-09 20:46:25 +05:30
|
|
|
VersionBuilder builder;
|
2014-01-27 23:50:07 +05:30
|
|
|
builder.m_version = version;
|
|
|
|
builder.m_instance = instance;
|
2014-05-10 05:23:32 +05:30
|
|
|
builder.buildInternal();
|
2014-01-23 02:45:50 +05:30
|
|
|
}
|
|
|
|
|
2015-01-28 03:01:07 +05:30
|
|
|
void VersionBuilder::readJsonAndApplyToVersion(MinecraftProfile *version, const QJsonObject &obj)
|
2014-01-23 02:45:50 +05:30
|
|
|
{
|
2014-05-09 20:46:25 +05:30
|
|
|
VersionBuilder builder;
|
2014-01-27 23:50:07 +05:30
|
|
|
builder.m_version = version;
|
|
|
|
builder.m_instance = 0;
|
2014-03-03 05:53:10 +05:30
|
|
|
builder.readJsonAndApply(obj);
|
2014-01-27 23:50:07 +05:30
|
|
|
}
|
2014-01-22 12:03:32 +05:30
|
|
|
|
2014-05-09 20:46:25 +05:30
|
|
|
void VersionBuilder::readJsonAndApply(const QJsonObject &obj)
|
2014-01-27 23:50:07 +05:30
|
|
|
{
|
|
|
|
m_version->clear();
|
|
|
|
|
2014-03-05 06:20:05 +05:30
|
|
|
auto file = VersionFile::fromJson(QJsonDocument(obj), QString(), false);
|
2014-01-27 23:50:07 +05:30
|
|
|
|
2014-03-05 06:20:05 +05:30
|
|
|
file->applyTo(m_version);
|
2015-01-28 03:01:07 +05:30
|
|
|
m_version->appendPatch(file);
|
2014-01-22 12:03:32 +05:30
|
|
|
}
|
|
|
|
|
2014-02-08 21:52:26 +05:30
|
|
|
|
2015-01-28 03:01:07 +05:30
|
|
|
void VersionBuilder::readInstancePatches()
|
2014-05-14 03:27:34 +05:30
|
|
|
{
|
|
|
|
|
2015-01-28 03:01:07 +05:30
|
|
|
}
|
2014-03-05 06:20:05 +05:30
|
|
|
|
2015-01-28 03:01:07 +05:30
|
|
|
void VersionBuilder::buildInternal()
|
2014-05-20 04:47:54 +05:30
|
|
|
{
|
2014-03-05 06:20:05 +05:30
|
|
|
|
2014-02-08 21:52:26 +05:30
|
|
|
}
|
2014-03-02 03:36:47 +05:30
|
|
|
|