2017-02-04 12:42:12 -05:00
|
|
|
#include "STDInclude.hpp"
|
|
|
|
|
|
|
|
namespace Components
|
|
|
|
{
|
2017-02-04 15:52:49 -05:00
|
|
|
std::mutex Changelog::Mutex;
|
|
|
|
std::vector<std::string> Changelog::Lines;
|
2017-02-04 12:42:12 -05:00
|
|
|
|
2017-02-04 15:52:49 -05:00
|
|
|
void Changelog::LoadChangelog()
|
2017-02-04 12:42:12 -05:00
|
|
|
{
|
2017-02-04 15:52:49 -05:00
|
|
|
//if (!Changelog::Lines.empty())
|
|
|
|
// return;
|
2017-02-04 13:07:02 -05:00
|
|
|
|
2017-02-04 15:52:49 -05:00
|
|
|
std::lock_guard<std::mutex> _(Changelog::Mutex);
|
|
|
|
Changelog::Lines.clear();
|
2020-12-09 15:56:19 -05:00
|
|
|
std::string data = Utils::Cache::GetFile("/develop/CHANGELOG.md");
|
2017-02-04 12:42:12 -05:00
|
|
|
|
2017-02-04 15:52:49 -05:00
|
|
|
if (data.empty())
|
2017-02-04 12:42:12 -05:00
|
|
|
{
|
2017-02-04 15:52:49 -05:00
|
|
|
data = "^1Unable to get changelog.";
|
2017-02-04 12:42:12 -05:00
|
|
|
}
|
|
|
|
|
2017-02-04 15:52:49 -05:00
|
|
|
Changelog::Lines = Utils::String::Explode(data, '\n');
|
2017-02-04 12:42:12 -05:00
|
|
|
|
2017-02-04 15:52:49 -05:00
|
|
|
for (auto& line : Changelog::Lines)
|
|
|
|
{
|
2017-02-04 12:42:12 -05:00
|
|
|
Utils::String::Replace(line, "\r", "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int Changelog::GetChangelogCount()
|
|
|
|
{
|
2017-02-04 15:52:49 -05:00
|
|
|
return Changelog::Lines.size();
|
2017-02-04 12:42:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// Omit column here
|
|
|
|
const char* Changelog::GetChangelogText(unsigned int item, int /*column*/)
|
|
|
|
{
|
2017-02-04 15:52:49 -05:00
|
|
|
std::lock_guard<std::mutex> _(Changelog::Mutex);
|
|
|
|
if (item < Changelog::Lines.size())
|
2017-02-04 12:42:12 -05:00
|
|
|
{
|
2017-02-04 15:52:49 -05:00
|
|
|
return Utils::String::VA("%s", Changelog::Lines[item].data());
|
2017-02-04 12:42:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2017-02-04 15:52:49 -05:00
|
|
|
void Changelog::SelectChangelog(unsigned int /*index*/)
|
|
|
|
{
|
|
|
|
// Don't do anything in here
|
|
|
|
}
|
2017-02-04 12:42:12 -05:00
|
|
|
|
|
|
|
Changelog::Changelog()
|
|
|
|
{
|
2017-02-25 06:54:26 -05:00
|
|
|
if (Dedicated::IsEnabled()) return;
|
|
|
|
|
2017-02-04 12:42:12 -05:00
|
|
|
// Changelog
|
2017-02-06 15:23:15 -05:00
|
|
|
UIFeeder::Add(62.0f, Changelog::GetChangelogCount, Changelog::GetChangelogText, Changelog::SelectChangelog);
|
2017-06-11 15:24:32 -04:00
|
|
|
|
2017-06-23 04:04:43 -04:00
|
|
|
#ifndef DISABLE_ANTICHEAT
|
2017-07-03 09:07:47 -04:00
|
|
|
Scheduler::OnFrameAsync(AntiCheat::QuickCodeScanner1);
|
2017-06-11 15:24:32 -04:00
|
|
|
#endif
|
2017-02-04 12:42:12 -05:00
|
|
|
}
|
2017-02-04 15:52:49 -05:00
|
|
|
|
|
|
|
Changelog::~Changelog()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::lock_guard<std::mutex> _(Changelog::Mutex);
|
|
|
|
Changelog::Lines.clear();
|
|
|
|
}
|
|
|
|
}
|
2017-02-04 12:42:12 -05:00
|
|
|
}
|