using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using Tango.PMR; using Tango.PMR.Embroidery; namespace Tango.EmbroideryUI { public static class EmbroideryFileConverter { [DllImport("Tango.Embroidery.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "ConvertFile")] public static extern int ConvertFile(IntPtr data, int size, ref IntPtr output); public static void ConvertEmbroideryFile(String sourceFile, String targetFile) { ConvertFileInput input = new ConvertFileInput(); input.SourceFile = sourceFile; input.TargetFile = targetFile; NativePMR nativePMR = new NativePMR(ConvertFile); ConvertFileOutput output = nativePMR.Invoke(input); if (!output.Successful) { throw new IOException("Error occurred in native embroidery library."); } } } }