@@ -183,6 +183,7 @@ BGCODE_CONVERT_EXPORT EResult from_ascii_to_binary(FILE& src_file, FILE& dst_fil
183183{
184184 using namespace std ::literals;
185185 static constexpr const std::string_view GeneratedByPrusaSlicer = " generated by PrusaSlicer" sv;
186+ static constexpr const std::string_view PreparedBy = " prepared by" sv;
186187
187188 static constexpr const std::string_view PrinterModel = " printer_model" sv;
188189 static constexpr const std::string_view FilamentType = " filament_type" sv;
@@ -318,6 +319,15 @@ BGCODE_CONVERT_EXPORT EResult from_ascii_to_binary(FILE& src_file, FILE& dst_fil
318319 return ;
319320 }
320321
322+ pos = sv_line.find (PreparedBy);
323+ if (lines_counter < 5 && pos != std::string_view::npos) {
324+ std::string_view prep = trim (sv_line.substr (pos + PreparedBy.size ()));
325+ if (! prep.empty ())
326+ binary_data.file_metadata .raw_data .emplace_back (" Prepared by" , prep);
327+ processed_lines.emplace_back (lines_counter++);
328+ return ;
329+ }
330+
321331 // collect print + printer metadata
322332 // to keep the proper order they will be set into binary_data later
323333 auto collect_metadata = [&](const std::string_view& key, std::string& value, bool shared_in_config = false ) {
@@ -646,16 +656,20 @@ BGCODE_CONVERT_EXPORT EResult from_binary_to_ascii(FILE& src_file, FILE& dst_fil
646656
647657 auto producer_it = std::find_if (file_metadata_block.raw_data .begin (), file_metadata_block.raw_data .end (),
648658 [](const std::pair<std::string, std::string>& item) { return item.first == " Producer" ; });
649- std::string producer_str = (producer_it != file_metadata_block.raw_data .end ()) ? producer_it->second : " Unknown" ;
650-
651-
659+ auto prepared_it = std::find_if (file_metadata_block.raw_data .begin (), file_metadata_block.raw_data .end (),
660+ [](const std::pair<std::string, std::string>& item) { return item.first == " Prepared by" ; });
652661 auto produced_on_it = std::find_if (file_metadata_block.raw_data .begin (), file_metadata_block.raw_data .end (),
653662 [](const auto & item) { return item.first == " Produced on" ; });
663+
664+ std::string producer_str = (producer_it != file_metadata_block.raw_data .end ()) ? producer_it->second : " Unknown" ;
654665 if (produced_on_it != file_metadata_block.raw_data .end ())
655666 producer_str += " on " + produced_on_it->second ;
667+ if (prepared_it != file_metadata_block.raw_data .end ())
668+ producer_str += " \n ; prepared by " + prepared_it->second ;
656669
657670 if (!write_line (" ; generated by " + producer_str + " \n\n\n " ))
658671 return EResult::WriteError;
672+
659673 res = read_next_block_header (src_file, file_header, block_header, checksum_buffer.data (), checksum_buffer.size ());
660674 if (res != EResult::Success)
661675 // propagate error
0 commit comments