@@ -27,67 +27,53 @@ struct BoundingBox
2727 public float x4 ;
2828 public float y4 ;
2929 }
30- static partial class NativeMethods
30+ internal class NativeMethods
3131 {
32- [ LibraryImport ( "oneocr.dll" ) ]
33- [ UnmanagedCallConv ( CallConvs = [ typeof ( CallConvCdecl ) ] ) ]
34- public static partial long CreateOcrInitOptions ( out long ctx ) ;
32+ [ DllImport ( @"DLL\\oneocr.dll" , CallingConvention = CallingConvention . Cdecl ) ]
33+ public static extern long CreateOcrInitOptions ( out long ctx ) ;
3534
36- [ LibraryImport ( "oneocr.dll" ) ]
37- [ UnmanagedCallConv ( CallConvs = [ typeof ( CallConvCdecl ) ] ) ]
38- public static partial long GetOcrLineCount ( long instance , out long count ) ;
35+ [ DllImport ( @"DLL\\oneocr.dll" , CallingConvention = CallingConvention . Cdecl ) ]
36+ public static extern long GetOcrLineCount ( long instance , out long count ) ;
3937
40- [ LibraryImport ( "oneocr.dll" ) ]
41- [ UnmanagedCallConv ( CallConvs = [ typeof ( CallConvCdecl ) ] ) ]
42- public static partial long GetOcrLine ( long instance , long index , out long line ) ;
38+ [ DllImport ( @"DLL\\oneocr.dll" , CallingConvention = CallingConvention . Cdecl ) ]
39+ public static extern long GetOcrLine ( long instance , long index , out long line ) ;
4340
44- [ LibraryImport ( "oneocr.dll" ) ]
45- [ UnmanagedCallConv ( CallConvs = [ typeof ( CallConvCdecl ) ] ) ]
46- public static partial long GetOcrLineContent ( long line , out IntPtr content ) ;
41+ [ DllImport ( @"DLL\\oneocr.dll" , CallingConvention = CallingConvention . Cdecl ) ]
42+ public static extern long GetOcrLineContent ( long line , out IntPtr content ) ;
4743
48- [ LibraryImport ( "oneocr.dll" ) ]
49- [ UnmanagedCallConv ( CallConvs = [ typeof ( CallConvCdecl ) ] ) ]
50- public static partial long GetOcrLineBoundingBox ( long line , out IntPtr boundingBoxPtr ) ;
44+ [ DllImport ( @"DLL\\oneocr.dll" , CallingConvention = CallingConvention . Cdecl ) ]
45+ public static extern long GetOcrLineBoundingBox ( long line , out IntPtr boundingBoxPtr ) ;
5146
52- [ LibraryImport ( "oneocr.dll" ) ]
53- [ UnmanagedCallConv ( CallConvs = [ typeof ( CallConvCdecl ) ] ) ]
54- public static partial long GetOcrLineWordCount ( long instance , out long count ) ;
47+ [ DllImport ( @"DLL\\oneocr.dll" , CallingConvention = CallingConvention . Cdecl ) ]
48+ public static extern long GetOcrLineWordCount ( long instance , out long count ) ;
5549
56- [ LibraryImport ( "oneocr.dll" ) ]
57- [ UnmanagedCallConv ( CallConvs = [ typeof ( CallConvCdecl ) ] ) ]
58- public static partial long GetOcrWord ( long instance , long index , out long line ) ;
50+ [ DllImport ( @"DLL\\oneocr.dll" , CallingConvention = CallingConvention . Cdecl ) ]
51+ public static extern long GetOcrWord ( long instance , long index , out long line ) ;
5952
60- [ LibraryImport ( "oneocr.dll" ) ]
61- [ UnmanagedCallConv ( CallConvs = [ typeof ( CallConvCdecl ) ] ) ]
62- public static partial long GetOcrWordContent ( long line , out IntPtr content ) ;
53+ [ DllImport ( @"DLL\\oneocr.dll" , CallingConvention = CallingConvention . Cdecl ) ]
54+ public static extern long GetOcrWordContent ( long line , out IntPtr content ) ;
6355
64- [ LibraryImport ( "oneocr.dll" ) ]
65- [ UnmanagedCallConv ( CallConvs = [ typeof ( CallConvCdecl ) ] ) ]
66- public static partial long GetOcrWordBoundingBox ( long line , out IntPtr boundingBoxPtr ) ;
56+ [ DllImport ( @"DLL\\oneocr.dll" , CallingConvention = CallingConvention . Cdecl ) ]
57+ public static extern long GetOcrWordBoundingBox ( long line , out IntPtr boundingBoxPtr ) ;
6758
68- [ LibraryImport ( "oneocr.dll" ) ]
69- [ UnmanagedCallConv ( CallConvs = [ typeof ( CallConvCdecl ) ] ) ]
70- public static partial long OcrProcessOptionsSetMaxRecognitionLineCount ( long opt , long count ) ;
59+ [ DllImport ( @"DLL\\oneocr.dll" , CallingConvention = CallingConvention . Cdecl ) ]
60+ public static extern long OcrProcessOptionsSetMaxRecognitionLineCount ( long opt , long count ) ;
7161
72- [ LibraryImport ( "oneocr.dll" ) ]
73- [ UnmanagedCallConv ( CallConvs = [ typeof ( CallConvCdecl ) ] ) ]
74- public static partial long RunOcrPipeline ( long pipeline , ref Img img , long opt , out long instance ) ;
62+ [ DllImport ( @"DLL\\oneocr.dll" , CallingConvention = CallingConvention . Cdecl ) ]
63+ public static extern long RunOcrPipeline ( long pipeline , ref Img img , long opt , out long instance ) ;
7564
76- [ LibraryImport ( "oneocr.dll" ) ]
77- [ UnmanagedCallConv ( CallConvs = [ typeof ( CallConvCdecl ) ] ) ]
78- public static partial long CreateOcrProcessOptions ( out long opt ) ;
65+ [ DllImport ( @"DLL\\oneocr.dll" , CallingConvention = CallingConvention . Cdecl ) ]
66+ public static extern long CreateOcrProcessOptions ( out long opt ) ;
7967
80- [ LibraryImport ( "oneocr.dll" ) ]
81- [ UnmanagedCallConv ( CallConvs = [ typeof ( CallConvCdecl ) ] ) ]
82- public static partial long OcrInitOptionsSetUseModelDelayLoad ( long ctx , byte flag ) ;
68+ [ DllImport ( @"DLL\\oneocr.dll" , CallingConvention = CallingConvention . Cdecl ) ]
69+ public static extern long OcrInitOptionsSetUseModelDelayLoad ( long ctx , byte flag ) ;
8370
84- [ LibraryImport ( "oneocr.dll" , StringMarshalling = StringMarshalling . Utf8 ) ]
85- [ UnmanagedCallConv ( CallConvs = [ typeof ( CallConvCdecl ) ] ) ]
86- public static partial long CreateOcrPipeline ( string modelPath , string key , long ctx , out long pipeline ) ;
71+ [ DllImport ( @"DLL\\oneocr.dll" , CallingConvention = CallingConvention . Cdecl ) ]
72+ public static extern long CreateOcrPipeline ( string modelPath , string key , long ctx , out long pipeline ) ;
73+
74+ [ DllImport ( @"DLL\\oneocr.dll" , EntryPoint = "CreateOcrPipeline" , CharSet = CharSet . Unicode , CallingConvention = CallingConvention . Cdecl ) ]
75+ public static extern long CreateOcrPipeline_Utf16 ( string modelPath , string key , long ctx , out long pipeline ) ;
8776
88- [ LibraryImport ( "oneocr.dll" , EntryPoint = "CreateOcrPipeline" , StringMarshalling = StringMarshalling . Utf16 ) ]
89- [ UnmanagedCallConv ( CallConvs = [ typeof ( CallConvCdecl ) ] ) ]
90- public static partial long CreateOcrPipeline_Utf16 ( string modelPath , string key , long ctx , out long pipeline ) ;
9177
9278 }
9379}
0 commit comments