DotNet.Authorize/AuthorizeClient.cs

(开头部分) 8KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace DotNet.Authorize
{
    /// <summary>
    /// 软件授权客户端类
    /// </summary>
    public static class AuthorizeClient
    {
        /// <summary>
        /// 软件注册信息
        /// </summary>
        public static DotNet.Authorize.AuthInfo SoftAuthInfo = new AuthInfo();

        /// <summary>
        /// 保存注册信息
        /// </summary>
        /// <param name="activationCode">激活码</param>
        /// <returns>保存成功返回True,保存失败返回False</returns>
        /// <param name="fileLicense">授权文件名(含路径)</param>
        /// <param name="fileIsExpired">授权过期标识文件名(含路径)</param>
        /// <param name="modulus">RSA公钥Modulus</param>
        /// <param name="exponent">RSA公钥Exponent</param>
        /// <param name="failedMsg">授权失败提示信息</param>
        public static bool SaveSoftVerifyInfo(string activationCode, string fileLicense, string fileIsExpired, string modulus, string exponent, out string failedMsg)
        {
            DotNet.Authorize.AuthInfo oldSoftAuthInfo = new DotNet.Authorize.AuthInfo();//这里只能新建一个授权信息变量,如果直接将原变量赋值,是实例引用,改变原值会影响新值

            DotNet.Authorize.RSAPublicKey publicKey = new DotNet.Authorize.RSAPublicKey(modulus, exponent);
            DotNet.Authorize.RSAKeyInfo rsaKeyInfo = new DotNet.Authorize.RSAKeyInfo(publicKey);

            oldSoftAuthInfo.ActivationCode = DotNet.Authorize.AuthorizeClient.SoftAuthInfo.ActivationCode;
            oldSoftAuthInfo.RSAPublicKey = rsaKeyInfo;

            FileOperate LicenseFile = new FileOperate();
            LicenseFile.WriteTxtFile(fileLicense, activationCode);

            bool isExpired = AuthorizeClient.GetIsExpiredFlag(fileIsExpired);
            AuthorizeClient.SaveIsExpiredFlag(false, fileIsExpired);

            //修改过后要将配置信息重新读取到内存
            AuthorizeClient.GetAuthInfo(fileLicense, fileIsExpired, modulus, exponent);

            bool retValue = false;
            if (AuthorizeClient.SoftAuthInfo.IsLegalActivationCode && !AuthorizeClient.SoftAuthInfo.IsExpired)
            {
                retValue = true;
            }
            else
            {
                retValue = false;
            }

            failedMsg = AuthorizeClient.SoftAuthInfo.AuthorizeMessage;

            if (!retValue)
            {
后面还有 155 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。