blob: b4752f2a619f72a74ab3ffaa4cd4b824beb40d6f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
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<ConvertFileInput, ConvertFileOutput> nativePMR = new NativePMR<ConvertFileInput, ConvertFileOutput>(ConvertFile);
ConvertFileOutput output = nativePMR.Invoke(input);
if (!output.Successful)
{
throw new IOException("Error occurred in native embroidery library.");
}
}
}
}
|