加密狗添加,io板卡映射修改

This commit is contained in:
hsc
2026-07-22 15:51:56 +08:00
parent be7b459385
commit ab7936c4ed
10 changed files with 490 additions and 8 deletions

View File

@@ -33,6 +33,7 @@
<ProjectReference Include="..\UIShare\UIShare.csproj" />
<ProjectReference Include="..\UpdateInfoMoudle\UpdateInfoMoudle.csproj" />
<ProjectReference Include="..\ZLGUSBCANFD\ZLGUSBCANFD.csproj" />
<ProjectReference Include="..\加密狗\加密狗.csproj" />
</ItemGroup>
<ItemGroup>

View File

@@ -23,6 +23,7 @@ using DeviceCommand.Base;
using AutoMapper;
using Microsoft.Extensions.Logging.Abstractions;
using ADP.Profiles;
using ;
namespace ADP
{
@@ -75,6 +76,52 @@ namespace ADP
RegionManager.SetRegionManager(Application.Current.MainWindow, re);
login.Show();
}
protected override void OnStartup(StartupEventArgs e)
{
if (System.Diagnostics.Debugger.IsAttached)
{
base.OnStartup(e);
return;
}
string strUserSn = "ACA89B2C1194650D4E93D97BE189FFCC";
string strApiKey = "C6D01BCD442347822876F8232245DE9422643C167B8C61CE4DF6049990E7395588675A8FC6AA4BF7AD353D669C993236BEA83F77551753885A47AF34185CC3A7";
Byte[] buffer = new Byte[256];
buffer = System.Text.Encoding.Default.GetBytes(strUserSn);
uint retcode;
retcode = .SN(buffer);
if (retcode != 0)
{
MessageBox.Show(string.Format("设置UserSN失败 error code: 0x{0:x}", retcode));
return;
}
uint count = 0;
retcode = API类.VikeyFind(ref count);
if (retcode != 0 || count == 0)
{
MessageBox.Show("未找到加密狗");
return;
}
buffer = System.Text.Encoding.Default.GetBytes(strApiKey);
retcode = .APIkey(0, buffer);
if (retcode != 0)
{
MessageBox.Show(string.Format("设置api密钥失败 error code: 0x{0:x}", retcode));
return;
}
var remaining = .(0);
if (remaining <= TimeSpan.Zero)
{
MessageBox.Show("加密狗已到期或未能读取时间,请联系供应商。", "加密狗验证失败", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
base.OnStartup(e);
}
protected override void RegisterRequiredTypes(IContainerRegistry containerRegistry)
{
base.RegisterRequiredTypes(containerRegistry);