加密狗添加,io板卡映射修改
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
<ProjectReference Include="..\UIShare\UIShare.csproj" />
|
||||
<ProjectReference Include="..\UpdateInfoMoudle\UpdateInfoMoudle.csproj" />
|
||||
<ProjectReference Include="..\ZLGUSBCANFD\ZLGUSBCANFD.csproj" />
|
||||
<ProjectReference Include="..\加密狗\加密狗.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user