NOISSUE FTB pack code implementation, cleaned up

This commit is contained in:
Jannis Lübke
2018-08-02 00:52:31 +02:00
committed by Petr Mrázek
parent 6cee50eac6
commit 6aada8adf7
14 changed files with 547 additions and 165 deletions

View File

@ -0,0 +1,36 @@
#include "FtbPrivatePackManager.h"
#include <QDebug>
#include "FileSystem.h"
void FtbPrivatePackManager::load()
{
try
{
currentPacks = QString::fromUtf8(FS::read(m_filename)).split('\n', QString::SkipEmptyParts).toSet();
dirty = false;
}
catch(...)
{
currentPacks = {};
qWarning() << "Failed to read third party FTB pack codes from" << m_filename;
}
}
void FtbPrivatePackManager::save() const
{
if(!dirty)
{
return;
}
try
{
FS::write(m_filename, currentPacks.toList().join('\n').toUtf8());
dirty = false;
}
catch(...)
{
qWarning() << "Failed to write third party FTB pack codes to" << m_filename;
}
}