39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
/*
|
|
* pdfbt:PDF 扒图报价工具(由 cadbt 改造,CAD 查看器 → PDF 查看 + 框选 OCR)
|
|
*/
|
|
using System;
|
|
using System.Windows.Forms;
|
|
|
|
namespace pdfbt
|
|
{
|
|
internal sealed class Program
|
|
{
|
|
[STAThread]
|
|
private static int Main(string[] args)
|
|
{
|
|
// 自检模式:pdfbt.exe --selftest <pdf路径> [输出目录]
|
|
if (args != null && args.Length >= 2 && args[0] == "--selftest")
|
|
{
|
|
return SelfTest.Run(args);
|
|
}
|
|
|
|
// 单实例保护:重复启动时激活已有实例并退出
|
|
bool createdNew;
|
|
using (var mutex = new System.Threading.Mutex(true, "pdfbt_SingleInstance", out createdNew))
|
|
{
|
|
if (!createdNew)
|
|
{
|
|
MessageBox.Show("pdfbt 已在运行中。", "pdfbt",
|
|
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
return 0;
|
|
}
|
|
Application.EnableVisualStyles();
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|
Application.Run(new MainForm());
|
|
GC.KeepAlive(mutex);
|
|
}
|
|
return 0;
|
|
}
|
|
}
|
|
}
|