Пример #1
0
        public void SellProgress(object sender, DoWorkEventArgs e)
        {
            var count = SellingList.Count;

            if (count != 0)
            {
                int incr = (100 / count);

                /*bool isSleep = false;
                 *
                 * if (count > 0)
                 * {
                 *  isSleep = true;
                 * }
                 *
                 * Random random = new Random();
                 * int min = sellDelay / 2;
                 * int max = sellDelay * 2;*/

                for (int i = 0; i < count; i++)
                {
                    if (IsRemove)
                    {
                        var req = "sessionid=" + SteamParseSite.GetSessId(cookieCont);
                        SteamParsing.SendPost(req, SteamLibrary.removeSell + SellingList[i].AssetId, SteamLibrary._market, cookieCont, false);
                    }
                    else
                    {
                        if (!SellingList[i].Price.Equals("None"))
                        {
                            var req = string.Format(SteamLibrary.sellReq, SteamParseSite.GetSessId(cookieCont), SellingList[i].App.AppID,
                                                    SellingList[i].App.Context, SellingList[i].AssetId, SellingList[i].Price);

                            SteamParsing.SendPost(req, SteamLibrary._sellitem, SteamLibrary._market, cookieCont, false);
                        }
                    }

                    doMessage(flag.Sell_progress, 0, (incr * (i + 1)).ToString(), true);

                    /*if ((isSleep) && (i != count - 1))
                     * {
                     *  if (isDelayRand)
                     *  {
                     *      Thread.Sleep(random.Next(min, max));
                     *  }
                     *  else
                     *  {
                     *      Thread.Sleep(sellDelay);
                     *  }
                     * }*/
                }

                doMessage(flag.Items_Sold, 0, string.Empty, true);
            }
            else
            {
                doMessage(flag.Items_Sold, 1, string.Empty, true);
            }
        }
Пример #2
0
        private SteamLibrary.BuyResponse BuyItem(CookieContainer c**k, string sessid, string itemId, string link,
                                                 string subtotal, string fee, string total)
        {
            string data = string.Format(SteamLibrary.buyReq, sessid, subtotal, fee, total, SteamParsing.Currencies.GetCode(), "1");

            //buy
            //29.08.2013 Steam Update Issue!
            //FIX: using SSL - https:// in url
            string buyres = SteamParsing.SendPost(data, SteamLibrary._blist + itemId, link, cookieCont, true);

            //testing purposes
            //string buyres = File.ReadAllText(@"C:\x.txt");

            try
            {
                if (buyres.Contains("message"))
                {
                    //Already buyed!
                    var ErrBuy = JsonConvert.DeserializeObject <SteamLibrary.InfoMessage>(buyres);
                    return(new SteamLibrary.BuyResponse(false, ErrBuy.Message));
                }
                else

                if (buyres != string.Empty)
                {
                    var AfterBuy = JsonConvert.DeserializeObject <SteamLibrary.WalletInfo>(buyres);

                    if (AfterBuy.WalletRes.Success == 1)
                    {
                        string balance = AfterBuy.WalletRes.Balance;
                        balance = balance.Insert(balance.Length - 2, ".");
                        return(new SteamLibrary.BuyResponse(true, balance));
                    }
                    else
                    {
                        return(new SteamLibrary.BuyResponse(false, "UnknownErr"));
                    }
                }
                else
                {
                    return(new SteamLibrary.BuyResponse(false, "UnknownErr"));
                }
            }
            catch (Exception)
            {
                return(new SteamLibrary.BuyResponse(false, "UnknownErr"));
            }
        }
Пример #3
0
        public void LoginProgress(object sender, DoWorkEventArgs e)
        {
            LoginProcess = true;
            Logged       = false;

            var accInfo = SteamParseSite.GetNameBalance(cookieCont);

            if (accInfo != null)
            {
                doMessage(flag.Already_logged, 0, accInfo, true);
                LoginProcess = false;
                Logged       = true;
                return;
            }

            string mailCode  = string.Empty;
            string guardDesc = string.Empty;
            string capchaId  = string.Empty;
            string capchaTxt = string.Empty;
            string mailId    = string.Empty;

            //Login cycle
begin:

            var rRSA = GetRSA("toshigawa_tori", cookieCont);

            if (rRSA == null)
            {
                SteamLibrary.AddtoLog("Network Problem");
                doMessage(flag.Login_cancel, 0, "Network Problem", true);
                LoginProcess = false;
                return;
            }

            string finalpass = SteamLibrary.EncryptPassword(Password, rRSA.Module, rRSA.Exponent);

            string MainReq = string.Format(SteamLibrary.loginReq, finalpass, UserName, mailCode, guardDesc, capchaId,
                                           capchaTxt, mailId, rRSA.TimeStamp);

            string BodyResp = SteamParsing.SendPost(MainReq, SteamLibrary._dologin, SteamLibrary._ref, cookieCont, true);

            //Checking login problem
            if (BodyResp.Contains("message"))
            {
                var rProcess = JsonConvert.DeserializeObject <SteamLibrary.RespProcess>(BodyResp);

                //Checking Incorrect Login
                if (rProcess.Message.Contains("Incorrect"))
                {
                    SteamLibrary.AddtoLog("Incorrect login");
                    doMessage(flag.Login_cancel, 0, "Incorrect login", true);
                    LoginProcess = false;
                    return;
                }
                else
                {
                    //Login correct, checking message type...
                    Dialog guardCheckForm = new Dialog();

                    if ((rProcess.isCaptcha) && (rProcess.Message.Contains("humanity")))
                    {
                        //Verifying humanity, loading capcha
                        guardCheckForm.capchgroupEnab = true;
                        guardCheckForm.codgroupEnab   = false;

                        string newcap = SteamLibrary._capcha + rProcess.Captcha_Id;
                        SteamParsing.SteamSite.loadImg(newcap, guardCheckForm.capchImg, false, false);
                    }
                    else
                    if (rProcess.isEmail)
                    {
                        //Steam guard wants email code
                        guardCheckForm.capchgroupEnab = false;
                        guardCheckForm.codgroupEnab   = true;
                    }
                    else
                    {
                        //Whoops!
                        goto begin;
                    }

                    //Re-assign main request values
                    if (guardCheckForm.ShowDialog() == DialogResult.OK)
                    {
                        mailCode  = guardCheckForm.MailCode;
                        guardDesc = guardCheckForm.GuardDesc;
                        capchaId  = rProcess.Captcha_Id;
                        capchaTxt = guardCheckForm.capchaText;
                        mailId    = rProcess.Email_Id;
                        guardCheckForm.Dispose();
                    }
                    else
                    {
                        SteamLibrary.AddtoLog("Dialog has been cancelled!");
                        doMessage(flag.Login_cancel, 0, "Dialog has been cancelled!", true);
                        e.Cancel     = true;
                        Logged       = false;
                        LoginProcess = false;
                        guardCheckForm.Dispose();
                        return;
                    }

                    goto begin;
                }
            }
            else
            {
                //No Messages, Success!
                var rFinal = JsonConvert.DeserializeObject <SteamLibrary.RespFinal>(BodyResp);

                if (rFinal.Success && rFinal.isComplete)
                {
                    //Okay
                    var accInfo2 = SteamParseSite.GetNameBalance(cookieCont);

                    doMessage(flag.Login_success, 0, accInfo2, true);

                    Logged = true;
                    SteamLibrary.AddtoLog("Login Success");
                }
                else
                {
                    //Fail
                    goto begin;
                }
            }

            LoginProcess = false;
        }
Пример #4
0
 //"RSA SecurID" for Steam
 public SteamLibrary.RespRSA GetRSA(string userName, CookieContainer cookieCont)
 {
     return(JsonConvert.DeserializeObject <SteamLibrary.RespRSA>(SteamParsing.SendPost("username=" + userName,
                                                                                       SteamLibrary._getrsa, SteamLibrary._ref, cookieCont, true)));
 }