#include "pch.h"
#include "settings.h"
#include "app.h"

Settings Settings::I;

bool Settings::load()
{
    auto path = App::I->data_path + "/settings/pref.bin";
    BinaryStreamReader sr;
    if (sr.load(path))
    {
        I.props.clear();
        return I.read(sr);
    }
    return false;
}

bool Settings::save()
{
    auto path = App::I->data_path + "/settings/pref.bin";
    BinaryStreamWriter sw;
    sw.init();
    I.write(sw);
    return sw.save(path);
}
