diff options
Diffstat (limited to 'Software/Visual_Studio/Embroidery/Tango.Embroidery/Adapter.cpp')
| -rw-r--r-- | Software/Visual_Studio/Embroidery/Tango.Embroidery/Adapter.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Embroidery/Tango.Embroidery/Adapter.cpp b/Software/Visual_Studio/Embroidery/Tango.Embroidery/Adapter.cpp index 55eba8a93..3c68c0b57 100644 --- a/Software/Visual_Studio/Embroidery/Tango.Embroidery/Adapter.cpp +++ b/Software/Visual_Studio/Embroidery/Tango.Embroidery/Adapter.cpp @@ -7,6 +7,8 @@ #include "PMR\Embroidery\StitchFlag.pb-c.h" #include "PMR\Embroidery\StitchColor.pb-c.h" #include "PMR\Embroidery\Extents.pb-c.h" +#include "PMR\Embroidery\ConvertFileInput.pb-c.h" +#include "PMR\Embroidery\ConvertFileOutput.pb-c.h" @@ -93,3 +95,33 @@ size_t Adapter::AnalyzeEmbroideryFile(uint8_t * input_buffer, size_t input_buffe return analyze_output__pack(output, output_buffer); } + +size_t Adapter::ConvertFile(uint8_t * input_buffer, size_t input_buffer_size, uint8_t *& output_buffer) +{ + //Unpack input... + ConvertFileInput *input = convert_file_input__unpack(NULL, input_buffer_size, input_buffer); + + //Initialize Output... + ConvertFileOutput* output = (ConvertFileOutput*)malloc(sizeof(ConvertFileOutput)); + convert_file_output__init(output); + + EmbPattern* p = 0; + int successful = 0; + + output->has_successful = true; + + p = embPattern_create(); + + output->successful = embPattern_read(p, input->sourcefile); + + if (output->successful) + { + output->successful = embPattern_write(p, input->targetfile); + embPattern_free(p); + } + + //Pack output... + output_buffer = (uint8_t*)malloc(convert_file_output__get_packed_size(output)); + + return convert_file_output__pack(output, output_buffer); +} |
