diff --git a/DiscordEuroscope/ConfigManager.cpp b/DiscordEuroscope/ConfigManager.cpp index 1b4e7cf..e44405f 100644 --- a/DiscordEuroscope/ConfigManager.cpp +++ b/DiscordEuroscope/ConfigManager.cpp @@ -167,23 +167,17 @@ namespace DiscordEuroScope_Configuration } } - assert(RadioCallsignObj.HasMember("custom") && RadioCallsignObj["custom"].IsArray()); + assert(RadioCallsignObj.HasMember("custom_callsigns") && RadioCallsignObj["custom_callsigns"].IsObject()); data.RadioCallsigns.clear(); - for (auto& it : RadioCallsignObj["custom"].GetArray()) + auto& obj = RadioCallsignObj["custom_callsigns"].GetObjectA(); + for (auto& it : obj) { - if (it.IsObject()) - { - RadioCallsignElement_t element; - if (it.HasMember("callsign") && it["callsign"].IsString()) - element.callsign = std::string(it["callsign"].GetString()); - if (it.HasMember("frequency") && it["frequency"].IsString()) - element.frequency = std::string(it["frequency"].GetString()); - if (it.HasMember("rcallsign") && it["rcallsign"].IsString()) - element.radio_callsign = std::string(it["rcallsign"].GetString()); - - element.icao = element.callsign.substr(0, element.callsign.find_first_of('_')); - data.RadioCallsigns.push_back(element); - } + RadioCallsignElement_t element; + assert(it.name.IsString() && it.value.IsString()); + element.callsign = it.name.GetString(); + element.radio_callsign = it.value.GetString(); + element.icao = element.callsign.substr(0, element.callsign.find_first_of('_')); + data.RadioCallsigns.push_back(element); } } diff --git a/DiscordEuroscope/DefaultFileContent.h b/DiscordEuroscope/DefaultFileContent.h index afa1444..e5ebc10 100644 --- a/DiscordEuroscope/DefaultFileContent.h +++ b/DiscordEuroscope/DefaultFileContent.h @@ -73,16 +73,10 @@ \"load_from_ese\": false,\r\ \"path_to_ese\" : \"..\\\\..\\\\\"\r\ },\r\ - \"custom\" : [\r\ - {\r\ - \"callsign\": \"^HECC_CTR$\",\r\ - \"rcallsign\" : \"Cairo Control Bandbox\"\r\ - },\r\ - {\r\ - \"callsign\": \"^HECC_(\\\\d+)(?:_)CTR$\",\r\ - \"rcallsign\" : \"Cairo Control ACC $0\"\r\ - }\r\ - ]\r\ + \"custom_callsigns\": {\r\ + \"^HECC_CTR$\": \"Cairo Control Bandbox\",\r\ + \"^HECC_(\\\\d+)(?:_)CTR$\" : \"Cairo Control ACC $0\"\r\ + }\r\ }\r\ }\r\ ") \ No newline at end of file diff --git a/DiscordEuroscope/ESEHandler.cpp b/DiscordEuroscope/ESEHandler.cpp index 3f0a636..b51a29e 100644 --- a/DiscordEuroscope/ESEHandler.cpp +++ b/DiscordEuroscope/ESEHandler.cpp @@ -1,3 +1,20 @@ +/* + Copyright(C) 2023-2024 Kirollos Nashaat + + This program is free software : you can redistribute it and /or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program.If not, see < https://www.gnu.org/licenses/>. +*/ + #include "stdafx.h" #include "ESEHandler.h" #include "ConfigData.h"