| 884 | } |
| 885 | |
| 886 | bool SerializerService::deserializeSimulationFromFiles(DeserializedSimulation& data, std::filesystem::path const& filename) |
| 887 | { |
| 888 | try { |
| 889 | log(Priority::Important, "load simulation from " + filename.string()); |
| 890 | std::filesystem::path settingsFilename(filename); |
| 891 | settingsFilename.replace_extension(std::filesystem::path(".settings.json")); |
| 892 | std::filesystem::path statisticsFilename(filename); |
| 893 | statisticsFilename.replace_extension(std::filesystem::path(".statistics.csv")); |
| 894 | |
| 895 | if (!deserializeDataDescription(data.mainData, filename)) { |
| 896 | return false; |
| 897 | } |
| 898 | { |
| 899 | std::ifstream stream(settingsFilename.string(), std::ios::binary); |
| 900 | if (!stream) { |
| 901 | return false; |
| 902 | } |
| 903 | deserializeAuxiliaryData(data.auxiliaryData, stream); |
| 904 | } |
| 905 | { |
| 906 | std::ifstream stream(statisticsFilename.string(), std::ios::binary); |
| 907 | if (!stream) { |
| 908 | return true; |
| 909 | } |
| 910 | deserializeStatistics(data.statistics, stream); |
| 911 | } |
| 912 | return true; |
| 913 | } catch (...) { |
| 914 | return false; |
| 915 | } |
| 916 | } |
| 917 | |
| 918 | bool SerializerService::deleteSimulation(std::filesystem::path const& filename) |
| 919 | { |
no test coverage detected