Refactor Config
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#ifndef GERMANAIRLINESVA_GACONNECTOR_XPLUGIN_MAIN_H
|
||||
#define GERMANAIRLINESVA_GACONNECTOR_XPLUGIN_MAIN_H
|
||||
|
||||
#include "config/config.hpp"
|
||||
#include "config/config.h"
|
||||
#include "constants.h"
|
||||
#include "logbook/logbook.h"
|
||||
#include "recording/recording.h"
|
||||
|
||||
+5
-9
@@ -10,7 +10,7 @@ std::thread serverThread;
|
||||
std::thread recordingThread;
|
||||
std::atomic<bool> wantsExit;
|
||||
|
||||
std::map<std::string, std::string> configuration;
|
||||
germanairlinesva::file::config::Config configuration;
|
||||
std::map<std::string,
|
||||
std::pair<std::vector<germanairlinesva::file::simdata::Gate>,
|
||||
std::vector<germanairlinesva::file::simdata::Runway>>>
|
||||
@@ -114,14 +114,13 @@ PLUGIN_API int XPluginStart(char *outName, char *outSig, char *outDesc)
|
||||
roll = XPLMFindDataRef("sim/flightmodel/position/phi"); // FLOAT
|
||||
quaternion = XPLMFindDataRef("sim/flightmodel/position/q"); // FLOAT[4]
|
||||
|
||||
configuration = germanairlinesva::file::config::readConfig(
|
||||
XPLANE_PLUGIN_DIRECTORY CONFIG);
|
||||
configuration = germanairlinesva::file::config::Config();
|
||||
toLog("Config loaded");
|
||||
|
||||
try {
|
||||
connector = new germanairlinesva_websocket::Websocket(
|
||||
"wss://ws.hofmannnet.myhome-server.de:8000",
|
||||
configuration["user"],
|
||||
configuration.getUser(),
|
||||
toLog);
|
||||
} catch (const std::invalid_argument &e) {
|
||||
toLog(e.what());
|
||||
@@ -133,7 +132,7 @@ PLUGIN_API int XPluginStart(char *outName, char *outSig, char *outDesc)
|
||||
if (germanairlinesva::util::generateMD5(XPLANE_CUSTOM_SCENERY, hash, toLog) ==
|
||||
0) {
|
||||
|
||||
if (strcmp(configuration["scenery"].c_str(), hash) != 0 ||
|
||||
if (strcmp(configuration.getScenery().c_str(), hash) != 0 ||
|
||||
!germanairlinesva::util::fileExists(
|
||||
XPLANE_PLUGIN_DIRECTORY SIMDATABASE)) {
|
||||
scan(xplaneVersion < 12000 ? XPLANE11_BASE_SCENERY
|
||||
@@ -145,10 +144,7 @@ PLUGIN_API int XPluginStart(char *outName, char *outSig, char *outDesc)
|
||||
airports,
|
||||
XPLANE_PLUGIN_DIRECTORY SIMDATABASE);
|
||||
|
||||
configuration["scenery"] = hash;
|
||||
germanairlinesva::file::config::writeConfig(
|
||||
configuration,
|
||||
XPLANE_PLUGIN_DIRECTORY CONFIG);
|
||||
configuration.updateScenery(hash);
|
||||
toLog("Sim Database updated");
|
||||
} else {
|
||||
airports = germanairlinesva::file::simdata::fromFile(
|
||||
|
||||
Reference in New Issue
Block a user