软件注册更改

This commit is contained in:
2025-04-07 21:50:03 +08:00
parent 9273f6db42
commit 3f520a2a27
11 changed files with 1326 additions and 13 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;
@@ -34,6 +35,12 @@ namespace CapMachine.Wpf
private static System.Threading.Mutex mutex;
/// <summary>
/// 授权
/// </summary>
private SoftAuthorizeHelper SoftAuthorizeHelper { get; set; } = SoftAuthorizeHelper.GetInstance();
public App()
{
try
@@ -83,6 +90,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);
}
@@ -115,7 +142,7 @@ namespace CapMachine.Wpf
containerRegistry.RegisterSingleton<SysRunService>();
containerRegistry.RegisterSingleton<ComActionService>();
containerRegistry.RegisterSingleton<ProRuntimeService>();
string strsqllite = System.AppDomain.CurrentDomain.BaseDirectory + @"Db\CapMachine.db";