private void UpdateAccountsFile()
        {
            var accounts = new List <SavedSteamAccount>();

            for (var i = 0; i < this.AccountsDataGridView.RowCount; i++)
            {
                var login    = (string)AccountsDataGridUtils.GetDataGridViewLoginCell(this.AccountsDataGridView, i).Value;
                var password = (string)AccountsDataGridUtils
                               .GetDataGridViewTruePasswordHiddenCell(this.AccountsDataGridView, i).Value;
                var steamApi = (string)AccountsDataGridUtils.GetDataGridViewSteamApiCell(this.AccountsDataGridView, i)
                               .Value;
                var mafile = (SteamGuardAccount)AccountsDataGridUtils
                             .GetDataGridViewMafileHiddenCell(this.AccountsDataGridView, i).Value;

                accounts.Add(
                    new SavedSteamAccount {
                    Login = login, Password = password, SteamApi = steamApi, MaFile = mafile
                });
            }

            SavedSteamAccount.UpdateAll(accounts);
        }
Exemplo n.º 2
0
        public bool FetchTradeToken()
        {
            var response = SteamWeb.Request(
                "https://steamcommunity.com/my/tradeoffers/privacy",
                "GET",
                string.Empty,
                this.Cookies);

            if (response == null)
            {
                return(false);
            }

            var token = string.Empty;

            try
            {
                token = Regex.Match(response, @"https://steamcommunity\.com/tradeoffer/new/\?partner=.+&token=(.+?)""")
                        .Groups[1].Value;
            }
            catch (Exception)
            {
                // ignored
            }

            if (token != string.Empty)
            {
                var acc = SavedSteamAccount.Get().FirstOrDefault(a => a.Login == this.Guard.AccountName);
                if (acc != null)
                {
                    acc.TradeToken = token;
                    SavedSteamAccount.UpdateAll(SavedSteamAccount.Get());
                }
            }

            return(!string.IsNullOrEmpty(token));
        }