예제 #1
0
        internal bool Check(Authorize Provider)
        {
            try
            {
                using (var Request = new HttpRequest())
                {
                    Request.ConnectTimeout   = 7500;
                    Request.ReadWriteTimeout = 7500;

                    var Response = Request.Post(Provider.ServerAuthUrl, PostData(Provider), "application/x-www-form-urlencoded");
                    if (Response.Address.ToString() != Provider.ServerAuthUrl)
                    {
                        this.ResponseStatus = "Incorrect Request!";
                        return(false);
                    }
                    if (Response.ToString() == "-1")
                    {
                        this.ResponseStatus = "Incorrect License!";
                        return(false);
                    }
                    if (Response.ToString() == "0")
                    {
                        this.ResponseStatus = "Your License is inactive!";
                        return(false);
                    }
                    if (Response.ToString() == "1")
                    {
                        this.ResponseStatus = "License is binded to another PC!";
                        return(false);
                    }
                    if (Response.ToString() == "2")
                    {
                        this.ResponseStatus = "License binding Error!";
                        return(false);
                    }
                    if (Response.ToString() == "3")
                    {
                        this.ResponseStatus = "Unknown Server Error!";
                        return(false);
                    }
                    if (Response.ToString() == "69")
                    {
                        this.ResponseStatus = "";
                        Dead.GoKill();
                        return(false);
                    }
                    if (Int64.TryParse(Response.ToString(), out long time) == false)
                    {
                        this.ResponseStatus = "Unexpected Server Response!";
                        return(false);
                    }
                    this.ResponseStatus = "License OK";
                    return(true);
                }
            }
            catch
            {
                this.ResponseStatus = "License Checking Error!";
                return(false);
            }
        }
예제 #2
0
 protected string PostData(Authorize var)
 {
     return("hwid=" + HWID() + "&license=" + var.LicenseKey + "&type=" + var.ProductName);
 }