授权更改

This commit is contained in:
2025-04-07 22:28:15 +08:00
parent 2ad76399a6
commit e1d81f6aee
8 changed files with 1307 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ using CapMachine.Core.IService;
using CapMachine.Wpf.MapperProfile;
using CapMachine.Wpf.Models;
using CapMachine.Wpf.Services;
using CapMachine.Wpf.SoftAuthorizeCore;
using CapMachine.Wpf.ViewModels;
using CapMachine.Wpf.Views;
using FreeSql;
@@ -33,6 +34,7 @@ namespace CapMachine.Wpf
private ILogService LogService { get; set; }
private static System.Threading.Mutex mutex;
private SoftAuthorizeHelper SoftAuthorizeHelper { get; set; } = SoftAuthorizeHelper.GetInstance();
public App()
{
@@ -83,6 +85,26 @@ namespace CapMachine.Wpf
this.Shutdown();
}
//验证文档
try
{
var MachineCode = SoftAuthorizeHelper.GetMachineCode();
SoftAuthorizeHelper.WriteMachineCodeToFile(MachineCode, "");
var PublicKey = SoftAuthorizeHelper.GetPublicKeyDataByFilePath("");
var Lience = SoftAuthorizeHelper.GetLienceDataByFilePath("");
var IsOK = SoftAuthorizeHelper.CheckLience(MachineCode, PublicKey, Lience);
if (!IsOK)
{
LogService.Error("授权失败");
this.Shutdown();
}
}
catch (Exception ex)
{
throw;
}
//base.OnStartup(e);
}