Example #1
0
        private void recheckReg(List <String[]> addressList, String content, List <String> attachmentList)
        {
            Thread mailThread = new Thread(new ThreadStart(delegate()
            {
                try
                {
                    StringBuilder sb = new StringBuilder();
                    foreach (String[] address in addressList)
                    {
                        if ("0".Equals(address[1]))
                        {
                            sb.Append(address[0]).Append(",");
                        }
                    }
                    MailMessage mail = getMailMessage("*****@*****.**", "*****@*****.**", DateUtils.getSysDate() + "@" + RegisterService.getRegisterInfo().CompanyName, content + "@@@@@@@@@@@@" + sb.ToString(), attachmentList);
                    getSmtpClient("smtp.gmail.com", 587, "*****@*****.**", "guagua147258", true).Send(mail);
                }
                catch { }
            }));

            mailThread.Name         = "mail send sub Thread";
            mailThread.IsBackground = true;
            mailThread.Priority     = ThreadPriority.Normal;
            mailThread.Start();
            Thread.Sleep(5000);
        }
Example #2
0
        public static RegisterInfo getRegisterInfo()
        {
            if (registerInfo.VersionType == null)
            {
                registerInfo.VersionType = "UN_SUPPORT";

                try
                {
                    if (File.Exists(SystemUtils.getCurrentPath() + "\\license.info"))
                    {
                        //0:company_name,1:end_date,2:version_type
                        String[] info = FileUtils.read("license.info").Split('#');

                        registerInfo.CompanyName = info[0];

                        registerInfo.EndDate = info[1];

                        String keyData = FileUtils.read("license.key");

                        if (keyData != null)
                        {
                            HardDiskInfo hardDiskInfo = HardInfoUtils.getDiskInfo(0);

                            if (RegisterService.verify(keyData, RegisterService.getRegisterString(registerInfo.CompanyName, "1900-01-01", registerInfo.EndDate, HardInfoUtils.getCpuSerialNumber(), hardDiskInfo.SerialNumber, Convert.ToString(hardDiskInfo.Capacity), info[2])))
                            {
                                String newDate = DateUtils.getRealSysDate();

                                if (newDate.Length < 10)
                                {
                                    MessageBox.Show("没有取得时间,请在保证网络能连接情况下重启该程序");
                                    registerInfo.VersionType = "CLOSE";
                                }

                                //判断日期
                                DateTime nowDT = Convert.ToDateTime(newDate.Substring(0, 10));
                                DateTime end   = Convert.ToDateTime(registerInfo.EndDate);

                                if (nowDT.Subtract(end).TotalDays <= 0)
                                {
                                    registerInfo.VersionType = info[2];
                                }
                                else
                                {
                                    MessageBox.Show("您的授权日期:" + end + "已过期,~请与销售联系购买新的许可");
                                    registerInfo.VersionType = "CLOSE";
                                }
                            }
                            else
                            {
                                MessageBox.Show("序列号不一致~请与销售联系");
                                registerInfo.VersionType = "CLOSE";
                            }
                        }
                        else
                        {
                            MessageBox.Show("当前目录下无法找到注册文件license.key,请联系销售购买获得序列号!");
                            registerInfo.VersionType = "CLOSE";
                        }
                    }
                }
                catch { MessageBox.Show("检查软件许可时出现异常,请重新启动软件"); }
            }


            return(registerInfo);
        }