/// <summary> /// 判断是否注册 /// </summary> /// <param name="info"></param> /// <returns></returns> private bool bRegister(out string info) { info = string.Empty; //读取MAC地址 string macAddress = HardwareHelper.GetMacAddress(); //配置文件中的MAC地址 string appAddress = null; if (string.IsNullOrEmpty(macAddress)) { info = "系统信息获取失败!"; return(false); } //读取配置文件中的MAC地址 appAddress = System.Configuration.ConfigurationManager.AppSettings["regCode"]; if (string.IsNullOrEmpty(appAddress)) { info = "获取注册信息失败,请先注册!"; return(false); } //比对信息是否一致 string[] myAddress = null; //反序列化 try { myAddress = DESEncrypt.Decrypt(appAddress).Split('|'); //EncodeHelper.DecryptString(appAddress, true).Split('|'); } catch { info = "系统注册错误,注册码不正确!"; return(false); } if (!myAddress[0].Equals(macAddress)) { info = "系统注册错误,注册码不正确!"; return(false); } if (myAddress.Length > 1 && !myAddress[1].Trim().Equals(string.Empty)) { if (DateTime.Now.CompareTo(Convert.ToDateTime(myAddress[1])) > 0) { //判断是否过期 info = "当前注册已到期,请联系供应商!"; return(false); } } return(true); }
public string GetRegInfo() { return(HardwareHelper.GetMacAddress()); }