feat: add a ModUtils::validate

moves the reading of mod files into `ModUtils` namespace

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers
2022-12-10 00:52:50 -07:00
parent 25e23e50ca
commit 878614ff68
9 changed files with 136 additions and 62 deletions

View File

@ -43,6 +43,7 @@
#include "MetadataHandler.h"
#include "Version.h"
#include "minecraft/mod/ModDetails.h"
Mod::Mod(const QFileInfo& file) : Resource(file), m_local_details()
{
@ -68,6 +69,10 @@ void Mod::setMetadata(std::shared_ptr<Metadata::ModStruct>&& metadata)
m_local_details.metadata = metadata;
}
void Mod::setDetails(const ModDetails& details) {
m_local_details = details;
}
std::pair<int, bool> Mod::compare(const Resource& other, SortType type) const
{
auto cast_other = dynamic_cast<Mod const*>(&other);
@ -190,3 +195,8 @@ void Mod::finishResolvingWithDetails(ModDetails&& details)
if (metadata)
setMetadata(std::move(metadata));
}
bool Mod::valid() const
{
return !m_local_details.mod_id.isEmpty();
}