forked from TanninOne/modorganizer-lootcli
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathlootthread.h
More file actions
105 lines (85 loc) · 3.79 KB
/
lootthread.h
File metadata and controls
105 lines (85 loc) · 3.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#ifndef LOOTTHREAD_H
#define LOOTTHREAD_H
#include "game_settings.h"
#include "loot/database_interface.h"
#include <lootcli/lootcli.h>
namespace loot
{
class Game;
}
namespace lootcli
{
loot::LogLevel toLootLogLevel(lootcli::LogLevels level);
lootcli::LogLevels fromLootLogLevel(loot::LogLevel level);
class LOOTWorker
{
public:
explicit LOOTWorker();
void setGame(const std::string& gameName);
void setGamePath(const std::string& gamePath);
void setReportOutputPath(const std::string& reportOutputPath);
void setPluginListPath(const std::string& pluginListPath);
void setSortedPluginListOutputPath(const std::string& sortedPluginListOutputPath);
void
setLanguageCode(const std::string& language_code); // Will add this when I figure out
// how languages work on MO
void setLogLevel(loot::LogLevel level);
void setUpdateMasterlist(bool update);
int run();
private:
void progress(Progress p);
void log(loot::LogLevel level, const std::string_view message) const;
DWORD GetFile(const WCHAR* szUrl, const CHAR* szFileName);
void getSettings(const std::filesystem::path& file);
std::string getOldDefaultRepoUrl(loot::GameId gameType);
std::optional<std::string> GetLocalFolder(const toml::table& table);
bool IsNehrim(const toml::table& table);
bool IsEnderal(const toml::table& table, const std::string& expectedLocalFolder);
bool IsEnderal(const toml::table& table);
bool IsEnderalSE(const toml::table& table);
bool isLocalPath(const std::string& location, const std::string& filename);
bool isBranchCheckedOut(const std::filesystem::path& localGitRepo,
const std::string& branch);
std::optional<std::string> migrateMasterlistRepoSettings(loot::GameId gameType,
std::string url,
std::string branch);
std::string migrateMasterlistSource(const std::string& source);
std::filesystem::path gamePath() const;
std::filesystem::path masterlistPath() const;
std::filesystem::path settingsPath() const;
std::filesystem::path userlistPath() const;
std::filesystem::path l10nPath() const;
std::filesystem::path dataPath() const;
private:
// void handleErr(unsigned int resultCode, const char *description);
bool sort(loot::Game& game);
// const char *lootErrorString(unsigned int errorCode);
// template <typename T> T resolveVariable(HMODULE lib, const char *name);
// template <typename T> T resolveFunction(HMODULE lib, const char *name);
private:
loot::GameId m_GameId;
std::string m_Language;
std::string m_GameName;
std::string m_GamePath;
std::string m_ReportOutputPath;
std::string m_PluginListPath;
std::string m_SortedPluginListOutputPath;
loot::LogLevel m_LogLevel;
bool m_UpdateMasterlist;
mutable std::recursive_mutex mutex_;
loot::GameSettings m_GameSettings;
std::chrono::high_resolution_clock::time_point m_startTime;
std::string createJsonReport(loot::GameInterface& game,
const std::vector<std::string>& sortedPlugins) const;
QJsonArray createPlugins(loot::GameInterface& game,
const std::vector<std::string>& sortedPlugins) const;
QJsonValue createMessages(const std::vector<loot::Message>& list) const;
QJsonValue createDirty(const std::vector<loot::PluginCleaningData>& data) const;
QJsonValue createClean(const std::vector<loot::PluginCleaningData>& data) const;
QJsonValue createIncompatibilities(loot::GameInterface& game,
const std::vector<loot::File>& data) const;
QJsonValue createMissingMasters(loot::GameInterface& game,
const std::string& pluginName) const;
};
} // namespace lootcli
#endif // LOOTTHREAD_H