/// <summary> /// 调用注册逻辑 /// </summary> public void RegLogic() { string price = getPrice(); // 获取软件金额 //string machinCode = MachineInfo.SoftSerial(SoftName); // 获取当前的机器码 string machinCode = MachineInfo_Serial.MachineSerial(); // 获取当前的机器码 string SeverUrl = "http://" + this.QrPayServerAddress + "/pages/pay.aspx"; PayForm.Pay(SoftName, "软件注册", price, SeverUrl, machinCode, "author(" + AuthorName + ")", PayResult); }
/// <summary> /// 在线注册逻辑,自动检测是否已在线注册,若已经注册,则完成本地注册逻辑。 /// 启动后首次,通过接口发送软件启动信息至服务器; /// 再次检测时,在查询本地注册信息之后,若未注册则在线查询。 /// 通过needRegCallBack执行回调处理逻辑 /// </summary> public void RegLogic_Online(NeedRegisterCallBack needRegCallBack = null) { if (needRegCallBack != null) { this.needRegCallBack = needRegCallBack; // 记录回调处理逻辑 } string onlineSerial = ""; // 0、发送软件启动信息至服务器 bool isFirst = isFirstGetOnlineSerial; if (isFirst) { // 获取序列号信息 onlineSerial = GetOnlineSerial(MachineInfo_Serial.MachineSerial(), SoftName, MachineInfo_Serial.ComputerName(), MachineInfo_Serial.UserName(), ""); // 显示软件msg信息 string SoftExt = ExtInfo("msg"); showExtMessage("SoftExt", SoftExt); // 显示机器软件对应的msg信息 string MachineSoftMsg = GetValue("msg", MachineInfo_Serial.MachineSerial(), SoftName); showExtMessage("MachineSoftMsg", MachineSoftMsg); } if (!this.IsRegUser()) // 1、若本地未注册 { if (!isFirst) { onlineSerial = GetOnlineSerial(MachineInfo_Serial.MachineSerial(), SoftName, MachineInfo_Serial.ComputerName(), MachineInfo_Serial.UserName(), ""); } // 2、则查询是否已在线注册 if (!onlineSerial.Equals("") && onlineSerial.Equals(MachineInfo_Serial.RegSerial(SoftName))) { RegistryTool.RegistrySave(AuthorName + @"\" + SoftName + @"\Set", "Serial", onlineSerial); MessageBox.Show("恭喜,您已成功注册!(异步注册)\r\n\r\n即便重装系统,也无需再次注册.\r\nCopyright © 2018 Scimence"); } } }
/// <summary> /// 获取客户端的当前启动次数 /// </summary> /// <returns></returns> private int getStartTimes() { if (startTimes == -1) { try { string times = GetValue("startTimes", MachineInfo_Serial.MachineSerial(), SoftName); if (times.Equals("")) { startTimes = 0; } else { startTimes = int.Parse(times); } } catch (Exception) { return(10000); } } return(startTimes); }