Beispiel #1
0
        /// <summary>
        /// Sets the privacy settings of the account.
        /// </summary>
        /// <param name="settings">Settings to set.</param>
        /// <param name="account">Account of settings to change.</param>
        public void SetPrivacySettings(PrivacySettings settings, Account account)
        //implement settings as an interface later!
        {
            string url = "https://steamcommunity.com/profiles/" + account.SteamId + "/edit/settings";

            string sessionid =
                (from Cookie cookie in _account.AuthContainer.GetCookies(new Uri("https://steamcommunity.com"))
                 where cookie.Name == "sessionid"
                 select cookie.Value).FirstOrDefault();

            var data = new Dictionary <string, string>
            {
                { "sessionID", sessionid },
                { "type", PrivacySettings.Type },
                { "privacySetting", ((int)settings.PrivacySetting).ToString() },
                { "commentSetting", PrivacySettings.EPrivacySettingToCommentSetting(settings.CommentSetting) },
                { "inventoryPrivacySetting", ((int)settings.InventoryPrivacySetting).ToString() },
                { "inventoryGiftPrivacy", settings.InventoryGiftPrivacy.IntValue().ToString() },
                { "tradeConfirmationSetting", settings.TradeConfirmationSetting.IntValue().ToString() },
                { "marketConfirmationSetting", settings.MarketConfirmationSetting.IntValue().ToString() }
            };

            _web.Fetch(url, "POST", data, _account.AuthContainer);
        }
        /// <summary>
        /// Sets the privacy settings of the account.
        /// </summary>
        /// <param name="settings">Settings to set.</param>
        /// <param name="account">Account of settings to change.</param>
        public void SetPrivacySettings(PrivacySettings settings, Account account)
            //implement settings as an interface later!
        {
            string url = "https://steamcommunity.com/profiles/" + account.SteamId + "/edit/settings";

            string sessionid =
                (from Cookie cookie in _account.AuthContainer.GetCookies(new Uri("https://steamcommunity.com"))
                    where cookie.Name == "sessionid"
                    select cookie.Value).FirstOrDefault();

            var data = new Dictionary<string, string>
            {
                {"sessionID", sessionid},
                {"type", PrivacySettings.Type},
                {"privacySetting", ((int) settings.PrivacySetting).ToString()},
                {"commentSetting", PrivacySettings.EPrivacySettingToCommentSetting(settings.CommentSetting)},
                {"inventoryPrivacySetting", ((int) settings.InventoryPrivacySetting).ToString()},
                {"inventoryGiftPrivacy", settings.InventoryGiftPrivacy.IntValue().ToString()},
                {"tradeConfirmationSetting", settings.TradeConfirmationSetting.IntValue().ToString()},
                {"marketConfirmationSetting", settings.MarketConfirmationSetting.IntValue().ToString()}
            };
            _web.Fetch(url, "POST", data, _account.AuthContainer);
        }