diff options
Diffstat (limited to 'src/libslic3r/Config.cpp')
-rw-r--r-- | src/libslic3r/Config.cpp | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/src/libslic3r/Config.cpp b/src/libslic3r/Config.cpp index 378645f86..18b97665d 100644 --- a/src/libslic3r/Config.cpp +++ b/src/libslic3r/Config.cpp @@ -581,13 +581,7 @@ bool ConfigBase::set_deserialize_raw(const t_config_option_key &opt_key_src, con (optdef->type == coEnum || optdef->type == coBool) && ConfigHelpers::looks_like_enum_value(value)) { // Deserialize failed, try to substitute with a default value. assert(substitutions_ctxt.rule == ForwardCompatibilitySubstitutionRule::Enable || substitutions_ctxt.rule == ForwardCompatibilitySubstitutionRule::EnableSilent); -<<<<<<< HEAD - if (optdef->type == coEnum && opt_key == "gcode_flavor" && (value == "marlin2" || value == "marlinfirmware")) - static_cast<ConfigOptionEnum<GCodeFlavor>*>(opt)->value = gcfMarlin; - else if (optdef->type == coBool) -======= if (optdef->type == coBool) ->>>>>>> master static_cast<ConfigOptionBool*>(opt)->value = ConfigHelpers::enum_looks_like_true_value(value); else // Just use the default of the option. @@ -673,21 +667,6 @@ ConfigSubstitutions ConfigBase::load(const std::string &file, ForwardCompatibili } ConfigSubstitutions ConfigBase::load_from_ini(const std::string &file, ForwardCompatibilitySubstitutionRule compatibility_rule) -<<<<<<< HEAD -{ - try { - boost::property_tree::ptree tree; - boost::nowide::ifstream ifs(file); - boost::property_tree::read_ini(ifs, tree); - return this->load(tree, compatibility_rule); - } catch (const ConfigurationError &e) { - throw ConfigurationError(format("Failed loading configuration file \"%1%\": %2%", file, e.what())); - } -} - -ConfigSubstitutions ConfigBase::load(const boost::property_tree::ptree &tree, ForwardCompatibilitySubstitutionRule compatibility_rule) -{ -======= { try { boost::property_tree::ptree tree; @@ -748,7 +727,6 @@ ConfigSubstitutions ConfigBase::load_from_ini_string_commented(std::string &&dat ConfigSubstitutions ConfigBase::load(const boost::property_tree::ptree &tree, ForwardCompatibilitySubstitutionRule compatibility_rule) { ->>>>>>> master ConfigSubstitutionContext substitutions_ctxt(compatibility_rule); for (const boost::property_tree::ptree::value_type &v : tree) { try { @@ -759,50 +737,10 @@ ConfigSubstitutions ConfigBase::load(const boost::property_tree::ptree &tree, Fo } } return std::move(substitutions_ctxt.substitutions); -<<<<<<< HEAD -} - -// Load the config keys from the tail of a G-code file. -ConfigSubstitutions ConfigBase::load_from_gcode_file(const std::string &file, ForwardCompatibilitySubstitutionRule compatibility_rule) -{ - try { - // Read a 64k block from the end of the G-code. - boost::nowide::ifstream ifs(file); - { - const char slic3r_gcode_header[] = "; generated by Slic3r "; - const char prusaslicer_gcode_header[] = "; generated by PrusaSlicer "; - std::string firstline; - std::getline(ifs, firstline); - if (strncmp(slic3r_gcode_header, firstline.c_str(), strlen(slic3r_gcode_header)) != 0 && - strncmp(prusaslicer_gcode_header, firstline.c_str(), strlen(prusaslicer_gcode_header)) != 0) - throw ConfigurationError("Not a PrusaSlicer / Slic3r PE generated g-code."); - } - ifs.seekg(0, ifs.end); - auto file_length = ifs.tellg(); - auto data_length = std::min<std::fstream::pos_type>(65535, file_length); - ifs.seekg(file_length - data_length, ifs.beg); - std::vector<char> data(size_t(data_length) + 1, 0); - ifs.read(data.data(), data_length); - ifs.close(); - - ConfigSubstitutionContext substitutions_ctxt(compatibility_rule); - size_t key_value_pairs = load_from_gcode_string(data.data(), substitutions_ctxt); - if (key_value_pairs < 80) - throw ConfigurationError(format("Suspiciously low number of configuration values extracted from %1%: %2%", file, key_value_pairs)); - return std::move(substitutions_ctxt.substitutions); - } catch (const ConfigurationError &e) { - throw ConfigurationError(format("Failed loading configuration from G-code \"%1%\": %2%", file, e.what())); - } -} - -// Load the config keys from the given string. -size_t ConfigBase::load_from_gcode_string(const char* str, ConfigSubstitutionContext& substitutions) -======= } // Load the config keys from the given string. size_t ConfigBase::load_from_gcode_string_legacy(ConfigBase& config, const char* str, ConfigSubstitutionContext& substitutions) ->>>>>>> master { if (str == nullptr) return 0; @@ -847,11 +785,7 @@ size_t ConfigBase::load_from_gcode_string_legacy(ConfigBase& config, const char* if (key == nullptr) break; try { -<<<<<<< HEAD - this->set_deserialize(std::string(key, key_end), std::string(value, end), substitutions); -======= config.set_deserialize(std::string(key, key_end), std::string(value, end), substitutions); ->>>>>>> master ++num_key_value_pairs; } catch (UnknownOptionException & /* e */) { |