/// <summary> /// 从注册表载入信息,判断用户是否已经注册 /// </summary> /// <returns></returns> public bool IsRegUser() { // 检测本地注册信息, // 若已经注册成功 bool containsSerial = RegistryTool.RegistryCotains(AuthorName + @"\" + SoftName + @"\Set", "Serial"); //mainForm.F.RegistryRemove(AuthorName + @"\easyIcon\Set", "Serial"); if (containsSerial) { // 优先判断本地注册表数据 string serial = RegistryTool.RegistryStrValue(AuthorName + @"\" + SoftName + @"\Set", "Serial"); if (!serial.Equals("") && serial.Equals(MachineInfo_Serial.RegSerial(SoftName))) { if (Timer_CheckOnlineRegister.Enabled) { Timer_CheckOnlineRegister.Enabled = false; // 停止计时查询逻辑 } if (this.needRegCallBack != null) { this.needRegCallBack("end"); //4、若已注册,则执行结束逻辑 } return(true); } } // 若未注册,则弹出网络提示 bool available = System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable(); if (!available) { MessageBox.Show("网络不可用,无法获取软件状态信息\r\n请先连接网络后,再使用此工具"); Application.Exit(); // 自动退出应用 return(false); // 网络未连接视作未注册用户 } // 若未注册成功,在线检测是否需要注册 bool isNeed = needRegister(); if (this.needRegCallBack != null) // 2、先检测是否需要注册 { if (isNeed) { this.needRegCallBack("yes"); } else { this.needRegCallBack("no"); } } return(!isNeed); // 若不需要注册,则视作已注册用户 }
/// <summary> /// 显示软件公告信息 /// </summary> public void showExtMessage(string key, string msg) { //string msg = ExtInfo("msg").Replace("\\r", "\r").Replace("\\n", "\n").Replace("\\t", "\t"); msg = msg.Replace("\\r", "\r").Replace("\\n", "\n").Replace("\\t", "\t"); if (msg.Equals("")) { return; // 若无公告信息,则返回 } else { bool contains = RegistryTool.RegistryCotains(AuthorName + @"\" + SoftName + @"\Set", key); if (contains) { string preMsg = RegistryTool.RegistryStrValue(AuthorName + @"\" + SoftName + @"\Set", key); if (!preMsg.Equals("") && preMsg.Equals(msg)) { return; } } } MessageBox.Show(msg); RegistryTool.RegistrySave(AuthorName + @"\" + SoftName + @"\Set", key, msg); }