Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 30 additions & 18 deletions src_cpp/src_common/data/root.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,41 @@ namespace FakePDB::Data {
nlohmann_json_j["names"] = nlohmann_json_t.names;
}

inline void from_json(const nlohmann::json &nlohmann_json_j, Root &nlohmann_json_t) {
if(nlohmann_json_j.contains("general")) {
nlohmann_json_j.at("general").get_to(nlohmann_json_t.general);
}
inline void from_json(const nlohmann::json& nlohmann_json_j, Root& nlohmann_json_t) {
try {
if (nlohmann_json_j.contains("general")) {
nlohmann_json_j.at("general").get_to(nlohmann_json_t.general);
}

if(nlohmann_json_j.contains("pe")) {
nlohmann_json_j.at("pe").get_to(nlohmann_json_t.pe);
}
if (nlohmann_json_j.contains("pe")) {
nlohmann_json_j.at("pe").get_to(nlohmann_json_t.pe);
}

if(nlohmann_json_j.contains("segments")){
nlohmann_json_j.at("segments").get_to(nlohmann_json_t.segments);
}
if (nlohmann_json_j.contains("segments")) {
nlohmann_json_j.at("segments").get_to(nlohmann_json_t.segments);
}

if(nlohmann_json_j.contains("exports")) {
nlohmann_json_j.at("exports").get_to(nlohmann_json_t.exports);
}
if (nlohmann_json_j.contains("exports")) {
nlohmann_json_j.at("exports").get_to(nlohmann_json_t.exports);
}

if(nlohmann_json_j.contains("functions")) {
nlohmann_json_j.at("functions").get_to(nlohmann_json_t.functions);
}
if (nlohmann_json_j.contains("functions")) {
nlohmann_json_j.at("functions").get_to(nlohmann_json_t.functions);
}

if (nlohmann_json_j.contains("names")) {
nlohmann_json_j.at("names").get_to(nlohmann_json_t.names);
}

} catch (const nlohmann::json::type_error& e) {
printf("Deserialization type error: %s\n", e.what());
printf("Press any key to exit ...\n");
getchar();

if(nlohmann_json_j.contains("names")) {
nlohmann_json_j.at("names").get_to(nlohmann_json_t.names);
} catch (const std::exception& e) {
printf("Deserialization error: %s\n", e.what());
printf("Press any key to exit ...\n");
getchar();
}
}
}
Loading