예제 #1
0
        private void wdrawThread_DoWork(object sender, DoWorkEventArgs e)
        {
            var wdPage = SendGet(wdRefUrl);

            string token = wdPage.Substring(wdPage.IndexOf("token") + 14, 32);

            var fullReq = string.Format(wdReq, token, Address);

            var wdJSON = SimpleJSON.ParseJson(SendPost(fullReq, wdUrl, wdRefUrl));

            if (wdJSON["result"] == "error")
            {
                doMessage(flag.SendText, wdJSON["message"]);
            }
            else
            if (wdJSON["result"] == "success")
            {
                doMessage(flag.SendText, "Withdraw success!");
            }
        }
예제 #2
0
        private void loginThread_DoWork(object sender, DoWorkEventArgs e)
        {
            var res = loginRes.UnknownError;

            try
            {
                if (isLogged(Cookie))
                {
                    doMessage(flag.SendText, "Getting Balance...");

                    if (GetBalance(SendGet(siteUrl)))
                    {
                        res = loginRes.AlreadyLogged;
                        return;
                    }
                    else
                    {
                        Cookie = null;
                    }
                }

                doMessage(flag.SendText, "Getting Info...");
                doMessage(flag.ReportProgress, 10);

                string tokenPage = SendGet(loginRefUrl);

                string token = Regex.Match(tokenPage, "(?<=name=\"token\" value=\")(.*)(?=\" />)", RegexOptions.Singleline).ToString();

                doMessage(flag.SendText, "Checking Account Status...");
                doMessage(flag.ReportProgress, 20);

                string checkReq  = string.Format(loginReq, token, Username, Password);
                string checkPage = SendPost(checkReq, checkAcc, loginRefUrl);

                if (checkPage[0] != '{')
                {
                    res = loginRes.NetworkProblem;
                    return;
                }

                var checkJSON = SimpleJSON.ParseJson(checkPage);

                if (checkJSON["result"] == "error")
                {
                    string mess = checkJSON["message"];

                    if (mess.Contains("username"))
                    {
                        res = loginRes.BadPassword;
                    }
                    else
                    if (mess.Contains("suspended"))
                    {
                        res = loginRes.AccountBlocked;
                    }
                    else
                    {
                        res = loginRes.UnknownError;
                    }
                }
                else
                if (checkJSON["result"] == "success")
                {
                    string mainReq = string.Format(loginReq, token, Username, Password);

                    doMessage(flag.SendText, "Login Attempt...");
                    doMessage(flag.ReportProgress, 50);

                    string BodyResp = SendPost(mainReq, loginUrl, loginRefUrl);

                    doMessage(flag.SendText, "Getting Balance...");

                    if (GetBalance(SendGet(siteUrl)))
                    {
                        res = loginRes.LoginSuccess;
                    }
                    else
                    {
                        res = loginRes.NetworkProblem;
                    }
                }
                else
                {
                    res = loginRes.UnknownError;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                res = loginRes.CodeException;
            }
            finally
            {
                doMessage(flag.SendText, res.ToString());
                doMessage(flag.ReportProgress, 100);
            }
        }