Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
CarerayImage
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 25aba30b
由
刘韬
编写于
2025-10-15 14:55:13 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
添加 AlgoUpdater
1 个父辈
d5bb5421
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
57 行增加
和
0 行删除
CarerayImage/CarerayImage.csproj
CarerayImage/NeoXUpdater.cs
CarerayImage/CarerayImage.csproj
查看文件 @
25aba30
...
...
@@ -50,6 +50,7 @@
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Numerics" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
...
...
@@ -63,6 +64,7 @@
<Compile Include="HaoboSDK\HBI_FPD_DLL_v2.cs" />
<Compile Include="HaoboSDK\HBI_FPD_DLL_v1.cs" />
<Compile Include="NeoX.cs" />
<Compile Include="NeoXUpdater.cs" />
<Compile Include="ONNXAlgoMatch.cs" />
<Compile Include="eyemLib.cs" />
<Compile Include="haobo_v2.cs" />
...
...
CarerayImage/NeoXUpdater.cs
0 → 100644
查看文件 @
25aba30
using
System
;
using
System.Diagnostics
;
using
System.IO
;
using
System.Windows.Forms
;
public
static
class
AlgoUpdater
{
/// <summary>
/// 杀掉 algomatch.exe(若存在),然后将当前目录的 NeoX.dll 复制到 AlgoMatch\NeoX.dll。
/// 复制失败则抛出异常。
/// </summary>
public
static
void
UpdateNeoX
()
{
// 1. 杀掉 algomatch.exe
foreach
(
Process
p
in
Process
.
GetProcessesByName
(
"AlgoMatch"
))
{
try
{
p
.
Kill
();
// 强制结束
p
.
WaitForExit
(
5000
);
// 最多等待 5 秒
}
catch
(
Exception
ex
)
{
// 若杀进程失败,可记录日志或继续(不影响复制)
Console
.
WriteLine
(
$
"Warning: 结束进程失败: {ex.Message}"
);
}
}
// 2. 构造路径
string
currentDir
=
AppDomain
.
CurrentDomain
.
BaseDirectory
;
string
sourceFile
=
Path
.
Combine
(
currentDir
,
"NeoX.dll"
);
string
targetDir
=
Path
.
Combine
(
currentDir
,
"AlgoMatch"
);
string
targetFile
=
Path
.
Combine
(
targetDir
,
"NeoX.dll"
);
// 3. 检查源文件
if
(!
File
.
Exists
(
sourceFile
))
{
MessageBox
.
Show
(
"The source file NeoX.dll does not exist. \r\nFile:"
+
sourceFile
);
return
;
}
// 4. 确保目标目录存在
Directory
.
CreateDirectory
(
targetDir
);
// 5. 复制(可覆盖)
try
{
File
.
Copy
(
sourceFile
,
targetFile
,
overwrite
:
true
);
}
catch
(
Exception
ex
)
{
MessageBox
.
Show
(
"Failed to copy NeoX.dll to the AlgoMatch directory. \r\nException:"
+
ex
);
}
}
}
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论