Skip to content

Commit 32a3efb

Browse files
authored
Merge pull request #129 from killkimno/1.300v
1.307 업데이트
2 parents 32496df + d46dddb commit 32a3efb

File tree

8 files changed

+52
-67
lines changed

8 files changed

+52
-67
lines changed

MORT/Form1.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MORT/OcrApi/OneOcr/NativeMethods.cs

Lines changed: 32 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

MORT/OcrApi/OneOcr/OneOcr.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using MORT.Logger;
2-
using System;
1+
using System;
32
using System.Collections.Generic;
43
using System.Diagnostics;
54
using System.Drawing;
@@ -9,8 +8,6 @@
98
using System.Runtime.InteropServices;
109
using System.Text;
1110
using System.Threading.Tasks;
12-
using System.Windows.Interop;
13-
using static System.Windows.Forms.VisualStyles.VisualStyleElement.ListView;
1411

1512
namespace MORT.OcrApi.OneOcr
1613
{
@@ -20,6 +17,7 @@ public class OneOcr
2017
public const string OneOcrModel = "oneocr.onemodel";
2118
private const string OnnxRuntimeDll = "onnxruntime.dll";
2219
private string OneOcrPath { get; } = Path.Combine(AppContext.BaseDirectory, "DLL");
20+
//private string OneOcrPath { get; } = AppContext.BaseDirectory;
2321

2422
public bool VerticalMode { get; set; } = true;
2523
public bool IsAvailable { get; private set; } = false;

MORT/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ static void Main()
4949

5050
static void EnsureDllPathRegistered()
5151
{
52+
return;
5253
if(_dllPathRegistered) return;
5354

5455
try
@@ -125,6 +126,7 @@ static void EnsureDllPathRegistered()
125126

126127
static void UnregisterDllPath()
127128
{
129+
return;
128130
try
129131
{
130132
if(_addDllDirCookie != IntPtr.Zero)

MORT/Properties/Settings.Designer.cs

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MORT/Properties/Settings.settings

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
<Profiles />
44
<Settings>
55
<Setting Name="MORT_VERSION" Type="System.String" Scope="Application">
6-
<Value Profile="(Default)">1.306V</Value>
6+
<Value Profile="(Default)">1.307V</Value>
77
</Setting>
88
<Setting Name="LAYER_TEXT" Type="System.String" Scope="Application">
99
<Value Profile="(Default)">MORT {0}
1010
레이어 번역창</Value>
1111
</Setting>
1212
<Setting Name="MORT_VERSION_VALUE" Type="System.Int32" Scope="Application">
13-
<Value Profile="(Default)">1306</Value>
13+
<Value Profile="(Default)">1307</Value>
1414
</Setting>
1515
<Setting Name="TOOLTIP_LIST" Type="System.String" Scope="Application">
1616
<Value Profile="(Default)">MORT를 처음 쓰시면 그 외-&gt; MORT 사용법을 확인해 주세요,
@@ -45,7 +45,7 @@ OCR 영역을 빠르게 추가하고 싶을 땐 빠른 OCR 영역을 사용하
4545
구글 OCR의 사용량은 실제 사용량과 다를 수 있습니다. 수시로 구글 콘솔에서 확인하셔야 합니다</Value>
4646
</Setting>
4747
<Setting Name="MORT_RELEASE" Type="System.String" Scope="Application">
48-
<Value Profile="(Default)">2025 12 28</Value>
48+
<Value Profile="(Default)">2025 12 29</Value>
4949
</Setting>
5050
<Setting Name="BASIC_TEXT" Type="System.String" Scope="Application">
5151
<Value Profile="(Default)">Monkeyhead's OCR Realtime TransLate {0}

MORT/TransAPI/GeminiTranslatorAPI.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ public void Initialize(string sourceCode, string resultCode)
3131
{
3232
_sourceCode = sourceCode;
3333
_resultCode = resultCode;
34-
_defaultCommand = $"- Translate to {resultCode}, keep special characters, and output only the translation.";
34+
_defaultCommand = $"- Translate to {resultCode}, Output ONLY the translation result. No explanation. Do not continue the story, keep special characters.";
35+
//_defaultCommand = $"- Translate to {resultCode}, keep special characters, and output only the translation";
36+
//_defaultCommand = $"- {resultCode} Only result. Keep format/symbols";
3537
}
3638

3739
public void InitializeModel(string model, string apiKey, bool useDefaultModel)
@@ -198,19 +200,16 @@ private void InitializeCommand()
198200
}
199201

200202
// 4. 기본 명령 추가
201-
_resultCommand += $"{_defaultCommand}";
203+
_resultCommand += $"\n{_defaultCommand}";
202204
}
203205

204206
_inited = true;
205207
}
206208

207209
private string CombineTextOptimized(string text)
208210
{
209-
if(!string.IsNullOrEmpty(_command) && _disableDefaultCommand)
210-
{
211-
return _command + " " + text;
212-
}
213-
return _resultCommand + " " + text;
211+
string commandPrefix = !string.IsNullOrEmpty(_command) && _disableDefaultCommand ? _command : _resultCommand;
212+
return $"{commandPrefix}\nInput: {text}";
214213
}
215214

216215

MORT/app.config

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@
7373
<applicationSettings>
7474
<MORT.Properties.Settings>
7575
<setting name="MORT_VERSION" serializeAs="String">
76-
<value>1.306V</value>
76+
<value>1.307V</value>
7777
</setting>
7878
<setting name="LAYER_TEXT" serializeAs="String">
7979
<value>MORT {0}
8080
레이어 번역창</value>
8181
</setting>
8282
<setting name="MORT_VERSION_VALUE" serializeAs="String">
83-
<value>1306</value>
83+
<value>1307</value>
8484
</setting>
8585
<setting name="TOOLTIP_LIST" serializeAs="String">
8686
<value>MORT를 처음 쓰시면 그 외-&gt; MORT 사용법을 확인해 주세요,
@@ -115,7 +115,7 @@ OCR 영역을 빠르게 추가하고 싶을 땐 빠른 OCR 영역을 사용하
115115
구글 OCR의 사용량은 실제 사용량과 다를 수 있습니다. 수시로 구글 콘솔에서 확인하셔야 합니다</value>
116116
</setting>
117117
<setting name="MORT_RELEASE" serializeAs="String">
118-
<value>2025 12 28</value>
118+
<value>2025 12 29</value>
119119
</setting>
120120
<setting name="BASIC_TEXT" serializeAs="String">
121121
<value>Monkeyhead's OCR Realtime TransLate {0}

0 commit comments

Comments
 (0)