Convert ESP to Recorder
This commit is contained in:
@@ -21,7 +21,13 @@ namespace file
|
||||
{
|
||||
private:
|
||||
std::string user;
|
||||
std::string scenery;
|
||||
std::string XP11Scenery;
|
||||
std::string XP12Scenery;
|
||||
std::string FSXScenery;
|
||||
std::string FSXSEScenery;
|
||||
std::string P3D3Scenery;
|
||||
std::string P3D4Scenery;
|
||||
std::string P3D5Scenery;
|
||||
std::string token;
|
||||
std::string FSXPath;
|
||||
std::string FSXSEPath;
|
||||
@@ -33,7 +39,13 @@ namespace file
|
||||
inline void writeFile() const
|
||||
{
|
||||
std::ofstream out(BASE_DIRECTORY CONFIG);
|
||||
out << "scenery=" << this->scenery << "\n";
|
||||
out << "xp11Scenery=" << this->XP11Scenery << "\n";
|
||||
out << "xp12Scenery=" << this->XP12Scenery << "\n";
|
||||
out << "fsxScenery=" << this->FSXScenery << "\n";
|
||||
out << "fsxSEScenery=" << this->FSXSEScenery << "\n";
|
||||
out << "p3d3Scenery=" << this->P3D3Scenery << "\n";
|
||||
out << "p3d4Scenery=" << this->P3D4Scenery << "\n";
|
||||
out << "p3d5Scenery=" << this->P3D5Scenery << "\n";
|
||||
out << "user=" << this->user << "\n";
|
||||
out << "token=" << this->token << "\n";
|
||||
out << "fsxPath=" << this->FSXPath << "\n";
|
||||
@@ -55,8 +67,20 @@ namespace file
|
||||
if (fields.size() >= 2) {
|
||||
utilities::trim(fields[0]);
|
||||
utilities::trim(fields[1]);
|
||||
if (fields[0] == "scenery") {
|
||||
this->scenery = fields[1];
|
||||
if (fields[0] == "xp11Scenery") {
|
||||
this->XP11Scenery = fields[1];
|
||||
} else if (fields[0] == "xp12Scenery") {
|
||||
this->XP12Scenery = fields[1];
|
||||
} else if (fields[0] == "fsxScenery") {
|
||||
this->FSXScenery = fields[1];
|
||||
} else if (fields[0] == "fsxSEScenery") {
|
||||
this->FSXSEScenery = fields[1];
|
||||
} else if (fields[0] == "p3d3Scenery") {
|
||||
this->P3D3Scenery = fields[1];
|
||||
} else if (fields[0] == "p3d4Scenery") {
|
||||
this->P3D4Scenery = fields[1];
|
||||
} else if (fields[0] == "p3d5Scenery") {
|
||||
this->P3D5Scenery = fields[1];
|
||||
} else if (fields[0] == "user") {
|
||||
this->user = fields[1];
|
||||
} else if (fields[0] == "token") {
|
||||
@@ -79,25 +103,78 @@ namespace file
|
||||
in.close();
|
||||
}
|
||||
|
||||
inline void updateScenery(std::string scenery)
|
||||
inline void updateScenery(int simVersion, std::string scenery)
|
||||
{
|
||||
this->scenery = scenery;
|
||||
switch (simVersion) {
|
||||
case FSX_VERSION:
|
||||
this->FSXScenery = scenery;
|
||||
break;
|
||||
case FSXSE_VERSION:
|
||||
this->FSXSEScenery = scenery;
|
||||
break;
|
||||
case P3D3_VERSION:
|
||||
this->P3D3Scenery = scenery;
|
||||
break;
|
||||
case P3D4_VERSION:
|
||||
this->P3D4Scenery = scenery;
|
||||
break;
|
||||
case P3D5_VERSION:
|
||||
this->P3D5Scenery = scenery;
|
||||
break;
|
||||
default:
|
||||
if (simVersion < 12000) {
|
||||
this->XP11Scenery = scenery;
|
||||
} else {
|
||||
this->XP12Scenery = scenery;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
this->writeFile();
|
||||
}
|
||||
|
||||
inline const std::string getUser() const { return this->user; }
|
||||
inline const std::string getScenery() const { return this->scenery; }
|
||||
inline const std::string getToken() const { return this->token; }
|
||||
inline const std::string getFSXPath() const { return this->FSXPath; }
|
||||
inline const std::string getFSXSEPath() const
|
||||
inline const std::string getScenery(int simVersion) const
|
||||
{
|
||||
return this->FSXSEPath;
|
||||
switch (simVersion) {
|
||||
case FSX_VERSION:
|
||||
return this->FSXScenery;
|
||||
case FSXSE_VERSION:
|
||||
return this->FSXSEScenery;
|
||||
case P3D3_VERSION:
|
||||
return this->P3D3Scenery;
|
||||
case P3D4_VERSION:
|
||||
return this->P3D4Scenery;
|
||||
case P3D5_VERSION:
|
||||
return this->P3D5Scenery;
|
||||
default:
|
||||
if (simVersion < 12000) {
|
||||
return this->XP11Scenery;
|
||||
} else {
|
||||
return this->XP12Scenery;
|
||||
}
|
||||
}
|
||||
}
|
||||
inline const std::string getToken() const { return this->token; }
|
||||
inline const std::string getPath(int simVersion) const
|
||||
{
|
||||
switch (simVersion) {
|
||||
case FSX_VERSION:
|
||||
return this->FSXPath;
|
||||
case FSXSE_VERSION:
|
||||
return this->FSXSEPath;
|
||||
case P3D3_VERSION:
|
||||
return this->P3D3Path;
|
||||
case P3D4_VERSION:
|
||||
return this->P3D4Path;
|
||||
case P3D5_VERSION:
|
||||
return this->P3D5Path;
|
||||
case MSFS_VERSION:
|
||||
return this->MSFSPath;
|
||||
default:
|
||||
return "/";
|
||||
}
|
||||
}
|
||||
inline const std::string getP3D3Path() const { return this->P3D3Path; }
|
||||
inline const std::string getP3D4Path() const { return this->P3D4Path; }
|
||||
inline const std::string getP3D5Path() const { return this->P3D5Path; }
|
||||
inline const std::string getMSFSPath() const { return this->MSFSPath; }
|
||||
};
|
||||
} // namespace config
|
||||
} // namespace file
|
||||
|
||||
Reference in New Issue
Block a user