예제 #1
0
        public bool Auth(string key)
        {
            if (!Key.Validation(key))
            {
                ResponseStatus = "Incorrect License Key!";
                return(false);
            }
            if (!Internet.Connection())
            {
                ResponseStatus = "Internet Connection is Required!";
                return(false);
            }
            Dead.Check();
            this.LicenseKey = key;

            var api = new Api();
            var LicenseCheckingResult = api.Check(this);

            this.ResponseStatus = api.ResponseStatus;
            api = null;

            GC.Collect();
            GC.WaitForPendingFinalizers();

            return(LicenseCheckingResult);
        }
예제 #2
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);
            }
        }