//Private #region # 验证服务器机器 —— void AuthenticateMachine() /// <summary> /// 验证服务器机器 /// </summary> private void AuthenticateMachine() { bool authenticateMachine = true; #if DEBUG authenticateMachine = false; #endif if (authenticateMachine) { License?license = LicenseReader.GetLicense(); if (license == null) { throw new NoPermissionException("未找到许可证,请联系系统管理员!"); } string uniqueCode = UniqueCode.Compute(); bool equal = string.Equals(license.Value.UniqueCode, uniqueCode, StringComparison.CurrentCultureIgnoreCase); if (!equal) { throw new NoPermissionException("许可证授权与本机不匹配,请联系系统管理员!"); } if (DateTime.Today > license.Value.LicenseExpiredDate) { throw new NoPermissionException("许可证授权已过期,请联系系统管理员!"); } } }
/// <summary> /// 加载本机机器码按钮点击事件 /// </summary> private void Btn_LoadLocalMachine_Click(object sender, EventArgs e) { string uniqueCode = UniqueCode.Compute(); this.Txt_UniqueCode.Text = uniqueCode; }