PrismLauncher/logic/minecraft/VersionBuilder.cpp

84 lines
1.9 KiB
C++
Raw Normal View History

2015-02-02 22:25:30 +00:00
/* Copyright 2013-2015 MultiMC Contributors
*
* 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 00:53:32 +01:00
#include <qresource.h>
2014-05-08 20:20:10 +01:00
#include <modutils.h>
2015-01-27 21:31:07 +00:00
#include <pathutils.h>
2014-05-08 20:20:10 +01:00
2015-02-09 00:51:14 +00:00
#include "minecraft/VersionBuilder.h"
#include "minecraft/MinecraftProfile.h"
#include "minecraft/OneSixRule.h"
#include "minecraft/ProfilePatch.h"
#include "minecraft/VersionFile.h"
2014-05-10 00:53:32 +01:00
#include "VersionBuildError.h"
#include "MinecraftVersionList.h"
2015-01-27 21:31:07 +00:00
#include "ProfileUtils.h"
2014-05-08 20:20:10 +01:00
2015-02-09 00:51:14 +00:00
#include "minecraft/OneSixInstance.h"
#include "MMCJson.h"
#include <QDebug>
VersionBuilder::VersionBuilder()
{
}
2015-01-27 21:31:07 +00:00
void VersionBuilder::build(MinecraftProfile *version, OneSixInstance *instance)
{
VersionBuilder builder;
builder.m_version = version;
builder.m_instance = instance;
2014-05-10 00:53:32 +01:00
builder.buildInternal();
}
2015-01-27 21:31:07 +00:00
void VersionBuilder::readJsonAndApplyToVersion(MinecraftProfile *version, const QJsonObject &obj)
{
VersionBuilder builder;
builder.m_version = version;
builder.m_instance = 0;
builder.readJsonAndApply(obj);
}
void VersionBuilder::readJsonAndApply(const QJsonObject &obj)
{
m_version->clear();
2014-03-05 00:50:05 +00:00
auto file = VersionFile::fromJson(QJsonDocument(obj), QString(), false);
2014-03-05 00:50:05 +00:00
file->applyTo(m_version);
2015-01-27 21:31:07 +00:00
m_version->appendPatch(file);
}
2015-01-27 21:31:07 +00:00
void VersionBuilder::readInstancePatches()
{
2015-01-27 21:31:07 +00:00
}
2014-03-05 00:50:05 +00:00
2015-01-27 21:31:07 +00:00
void VersionBuilder::buildInternal()
{
2014-03-05 00:50:05 +00:00
}
2014-03-01 22:06:47 +00:00