XP.Common 类库中新增授权管理(License Management)功能模块,支持两种授权模式:CLMS 正式授权和临时测试模式。开发统一的授权服务接口,并在主项目中完成集成。
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using XP.Common.License.Enums;
|
||||
using XP.Common.License.Implementations;
|
||||
|
||||
namespace XP.Common.License.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
/// 授权服务接口 | License service interface
|
||||
/// </summary>
|
||||
public interface ILicenseService
|
||||
{
|
||||
/// <summary>
|
||||
/// 执行授权检查 | Perform authorization check
|
||||
/// </summary>
|
||||
/// <returns>授权检查结果 | License check result</returns>
|
||||
LicenseCheckResult CheckAuthorization();
|
||||
|
||||
/// <summary>
|
||||
/// 当前会话是否已授权 | Whether the current session is authorized
|
||||
/// </summary>
|
||||
bool IsAuthorized { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取授权到期日期 | Get license expiration date
|
||||
/// </summary>
|
||||
/// <returns>授权到期日期,未授权时返回 null | License expiration date, null if not authorized</returns>
|
||||
DateTime? GetExpirationDate();
|
||||
|
||||
/// <summary>
|
||||
/// 检查模块是否授权 | Check if module is licensed
|
||||
/// </summary>
|
||||
/// <param name="moduleId">模块ID | Module ID</param>
|
||||
/// <returns>模块是否授权 | Whether the module is licensed</returns>
|
||||
bool IsModuleLicensed(ushort moduleId);
|
||||
|
||||
/// <summary>
|
||||
/// 获取SMA到期日期 | Get SMA expiration date
|
||||
/// </summary>
|
||||
/// <returns>SMA到期日期,未启用时返回 null | SMA expiration date, null if not enabled</returns>
|
||||
DateTime? GetSmaDate();
|
||||
|
||||
/// <summary>
|
||||
/// 当前授权模式 | Current license mode
|
||||
/// </summary>
|
||||
LicenseMode LicenseMode { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 临时测试模式超时事件(到期时触发,应用应执行正常关闭流程)| Temporary test mode timeout event (fires when expired, app should perform graceful shutdown)
|
||||
/// </summary>
|
||||
event EventHandler TestModeTimeout;
|
||||
|
||||
/// <summary>
|
||||
/// 临时测试模式剩余5分钟警告事件 | Temporary test mode 5-minute warning event
|
||||
/// </summary>
|
||||
event EventHandler TestModeWarning5Min;
|
||||
|
||||
/// <summary>
|
||||
/// 临时测试模式剩余1分钟警告事件 | Temporary test mode 1-minute warning event
|
||||
/// </summary>
|
||||
event EventHandler TestModeWarning1Min;
|
||||
|
||||
/// <summary>
|
||||
/// 获取临时测试模式剩余时间 | Get remaining time in temporary test mode
|
||||
/// </summary>
|
||||
/// <returns>剩余时间(秒),非测试模式返回 0 | Remaining time in seconds, 0 if not in test mode</returns>
|
||||
int GetRemainingTestTime();
|
||||
}
|
||||
Reference in New Issue
Block a user