Exemplo n.º 1
0
        protected void Fetch()
        {
            if (FormMain.ProfileLoaded && string.IsNullOrWhiteSpace(FormMain.CurrentProfile.SteamWebApiKey))
            {
                using (SteamKeyDialog dialog = new SteamKeyDialog())
                {
                    dialog.ShowDialog();
                }
            }

            if (FormMain.ProfileLoaded && !string.IsNullOrWhiteSpace(FormMain.CurrentProfile.SteamWebApiKey))
            {
                Logger.Info("Updating profile using Steam Web API!");

                string json;
                using (WebClient wc = new WebClient())
                {
                    wc.Encoding = Encoding.UTF8;
                    json        = wc.DownloadString(string.Format(Constants.SteamWebApiOwnedGames, FormMain.CurrentProfile.SteamWebApiKey, SteamId));
                }

                ownedGamesObject = JsonConvert.DeserializeObject <GetOwnedGamesObject>(json);
            }
            else
            {
                doc = GameList.FetchGameList(SteamId);
            }
        }
Exemplo n.º 2
0
        protected void Fetch()
        {
            if (FormMain.ProfileLoaded && string.IsNullOrWhiteSpace(FormMain.CurrentProfile.SteamWebApiKey))
            {
                using (SteamKeyDialog dialog = new SteamKeyDialog())
                {
                    dialog.ShowDialog();
                }
            }

            if (FormMain.ProfileLoaded && !string.IsNullOrWhiteSpace(FormMain.CurrentProfile.SteamWebApiKey))
            {
                Logger.Info("Updating profile using Steam Web API!");

                HttpClient client = new HttpClient();
                using (Stream s = client.GetStreamAsync(string.Format(Constants.SteamWebApiOwnedGames, FormMain.CurrentProfile.SteamWebApiKey, SteamId)).Result)
                    using (StreamReader sr = new StreamReader(s))
                        using (JsonReader reader = new JsonTextReader(sr))
                        {
                            JsonSerializer serializer = new JsonSerializer();
                            ownedGamesObject = serializer.Deserialize <GetOwnedGamesObject>(reader);
                        }
            }
            else
            {
                doc = GameList.FetchGameList(SteamId);
            }
        }
Exemplo n.º 3
0
 private static bool UpdateGameList_Web_Xml(Profile profile)
 {
     try
     {
         IXPathNavigable doc = GameList.FetchGameList(profile.SteamID64);
         profile.GameData.IntegrateGameList(doc, false, profile.IgnoreList, out int _);
         return(true);
     }
     catch (Exception e)
     {
         Logger.Exception("Automatic mode: Error on XML web profile update.", e);
         return(false);
     }
 }
Exemplo n.º 4
0
 protected void Fetch()
 {
     doc = custom ? GameList.FetchGameList(customUrl) : GameList.FetchGameList(SteamId);
 }