Ejemplo n.º 1
0
        internal async Task <HtmlDocument> GetConfirmations(string deviceID, string confirmationHash, uint time)
        {
            if (string.IsNullOrEmpty(deviceID) || string.IsNullOrEmpty(confirmationHash) || (time == 0))
            {
                Logging.LogNullError(nameof(deviceID) + " || " + nameof(confirmationHash) + " || " + nameof(time), Bot.BotName);
                return(null);
            }

            if (!await RefreshSessionIfNeeded().ConfigureAwait(false))
            {
                return(null);
            }

            string request = SteamCommunityURL + "/mobileconf/conf?l=english&p=" + deviceID + "&a=" + SteamID + "&k=" + WebUtility.UrlEncode(confirmationHash) + "&t=" + time + "&m=android&tag=conf";

            return(await WebBrowser.UrlGetToHtmlDocumentRetry(request).ConfigureAwait(false));
        }
        internal async Task <HtmlDocument> GetBadgePage(byte page)
        {
            if (page == 0)
            {
                Bot.ArchiLogger.LogNullError(nameof(page));
                return(null);
            }

            if (!await RefreshSessionIfNeeded().ConfigureAwait(false))
            {
                return(null);
            }

            string request = SteamCommunityURL + "/my/badges?l=english&p=" + page;

            return(await WebBrowser.UrlGetToHtmlDocumentRetry(request).ConfigureAwait(false));
        }
Ejemplo n.º 3
0
        internal async Task <HashSet <ulong> > GetFamilySharingSteamIDs()
        {
            if (!await RefreshSessionIfNeeded().ConfigureAwait(false))
            {
                return(null);
            }

            string       request      = SteamStoreURL + "/account/managedevices";
            HtmlDocument htmlDocument = await WebBrowser.UrlGetToHtmlDocumentRetry(request).ConfigureAwait(false);

            HtmlNodeCollection htmlNodes = htmlDocument?.DocumentNode.SelectNodes("(//table[@class='accountTable'])[last()]//a/@data-miniprofile");

            if (htmlNodes == null)
            {
                return(null);                // OK, no authorized steamIDs
            }

            HashSet <ulong> result = new HashSet <ulong>();

            foreach (string miniProfile in htmlNodes.Select(htmlNode => htmlNode.GetAttributeValue("data-miniprofile", null)))
            {
                if (string.IsNullOrEmpty(miniProfile))
                {
                    Logging.LogNullError(nameof(miniProfile), Bot.BotName);
                    return(null);
                }

                uint steamID3;
                if (!uint.TryParse(miniProfile, out steamID3) || (steamID3 == 0))
                {
                    Logging.LogNullError(nameof(steamID3), Bot.BotName);
                    return(null);
                }

                ulong steamID = new SteamID(steamID3, EUniverse.Public, EAccountType.Individual);
                result.Add(steamID);
            }

            return(result);
        }