예제 #1
0
        private bool RegisterCheck()
        {
            string msg = "";

            // 检测激活码是否正确,没有文件,或激活码错误都算作激活失败
            if (!Register.IsAuthorize(softAuthorize.GetMachineCodeString(), "HPTS", ref Gloabal.SoftVersion, ref Gloabal.ExpireDate, ref msg))
            {
                // 显示注册窗口
                Ui.MessageBoxMuti(msg, this);
                using (frmRegist form =
                           new frmRegist())
                {
                    if (form.ShowDialog() != DialogResult.OK)
                    {
                        _regFlag = form._regFlag;
                    }
                }

                if (_regFlag)
                {
                    Application.ExitThread();
                    Application.Exit();
                    Application.Restart();
                    Process.GetCurrentProcess().Kill();
                    return(false);
                }

                Close();
                return(false);
            }

            return(true);
        }
예제 #2
0
        private void btnGetMachineCode_Click(object sender, EventArgs e)
        {
            //Tool.Register aa=new Tool.Register();
            //aa.SubKey = "SOFTWARE\\FigoAA\\";
            //aa.CreateSubKey("SOFTWARE\\FigoAA\\");
            //aa.WriteRegeditKey("value", 1);
            //aa.WriteRegeditKey("value", "Test");

            ////RegistryKey aimdir = Registry.LocalMachine.CreateSubKey("SOFTWARE\\TagReceiver\\Params\\SerialPort");
            ////aimdir.SetValue( "PortName", "Figo2018");
            ////  aimdir.Close();

            txtMachineCode.Text = softAuthorize.GetMachineCodeString();
        }
예제 #3
0
 /// <summary>
 /// 检测机器是否注册激活
 /// </summary>
 /// <returns></returns>
 public bool Check_RegCode()
 {
     try
     {
         //创建Httphelper对象
         http        = new HttpHelper();
         machinecode = soft.GetMachineCodeString();
         //创建Httphelper参数对象
         item = new HttpItem()
         {
             URL          = "http://47.98.156.83/panoramicAppLogin/reg_app.php?action=show_regcode&machine_code=" + machinecode, //URL     必需项
             Method       = "post",                                                                                              //URL     可选项 默认为Get
             ContentType  = "application/x-www-form-urlencoded",                                                                 //返回类型    可选项有默认值
             PostDataType = PostDataType.String
         };
         ////请求的返回值对象
         result = http.GetHtml(item);
         byte[] json_byte = Encoding.ASCII.GetBytes(result.Html);
         GetData = Encoding.UTF8.GetString(json_byte).Replace('?', ' ');
         if (AuthorizeEncrypted(machinecode).Equals(GetData.Split('|')[0].ToString().Trim()))
         {
             //InitMail init = new InitMail();
             //init.SendMail("ip登陆", init.ReplaceText("猪猪云全景", InitMail.HttpGET(@"http://47.98.156.83/sha1.php"), DateTime.Now.ToString("yyyy-MM-dd HH: mm:ss"), InitMail.HttpGET("http://whois.pconline.com.cn/ip.jsp?ip=" + InitMail.HttpGET(@"http://47.98.156.83/sha1.php")), "已激活", AuthorizeEncrypted(soft.GetMachineCodeString()), soft.GetMachineCodeString(), GetData.Split('|')[1].ToString().Trim(),"付费用户", "猪猪全景"));
             return(false);//激活
         }
         else
         {
             return(true);//没有激活
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("网络连接失败! ", "提示");
         return(true);
     }
 }
예제 #4
0
 /// <summary>
 /// 新增永久激活用户
 /// </summary>
 /// <param name="softAuthorize"></param>
 public void AppActivate(SoftAuthorize softAuthorize)
 {
     if (Check_RegCode())
     {
         // 显示注册窗口
         if (!IsOpenADW)
         {
             ADW_RegCode = "";
         }
         using (FormAuthorize form =
                    new FormAuthorize(
                        softAuthorize,
                        ADW_RegCode,
                        AuthorizeEncrypted))
         {
             if (form.ShowDialog() != DialogResult.OK)
             {
                 // 授权失败,退出
                 //Mesbox("授权失败!  ");
             }
             else
             {
                 try
                 {
                     //创建Httphelper对象
                     http = new HttpHelper();
                     //创建Httphelper参数对象
                     item = new HttpItem()
                     {
                         URL          = "http://47.98.156.83/panoramicAppLogin/reg_app.php?action=submit_regcode&machine_code=" + softAuthorize.GetMachineCodeString() + "&reg_code=" + AuthorizeEncrypted(softAuthorize.GetMachineCodeString()), //URL     必需项
                         Method       = "post",                                                                                                                                                                                                   //URL     可选项 默认为Get
                         ContentType  = "application/x-www-form-urlencoded",                                                                                                                                                                      //返回类型    可选项有默认值
                         PostDataType = PostDataType.String
                     };
                     ////请求的返回值对象
                     result  = http.GetHtml(item);
                     GetData = result.Html.Trim();
                     if (GetData.Equals("400") || GetData.Equals("激活失败"))
                     {
                         return;
                     }
                     else
                     {
                         Main.appisReg = false;
                         MessageBox.Show("授权成功! 重新打开应用", "提示");
                         ReLoign();
                     }
                 }
                 catch (Exception ex)
                 {
                     Main.appisReg = true;
                     MessageBox.Show("网络连接失败! ", "提示");
                 }
             }
         }
     }
     else
     {
         Main.appisReg = false;
     }
 }
예제 #5
0
 private void frmRegist_Load(object sender, EventArgs e)
 {
     txtMachineCode.Text = softAuthorize.GetMachineCodeString();
 }