public async Task LoadGames() { var w = new WebClient(); SteamProfile profile = await SteamManager.GetSteamProfileByID(Id); if (profile == null) { throw new ArgumentException("Invalid Profile"); } await SteamManager.LoadGamesForProfile(profile); var sb = new StringBuilder(); var allgames = profile.Games.ToList(); var AllGameIds = allgames.Select(d => d.App.ID.ToString()); var GamesToLoadIds = allgames.Select(d => d.App.ID.ToString()).ToList(); foreach (string s in GamesToLoadIds) { sb.Append(s); if (s != GamesToLoadIds.Last()) { sb.Append(","); } } }
public FriendInfo(long id) { new Task(async() => { Profile = await SteamManager.GetSteamProfileByID(id); await SteamManager.LoadGamesForProfile(Profile); }).Start(); }
private async void Test(ulong id, string name) { SteamProfile test = await SteamManager.GetSteamProfileByID((long)id); await SteamManager.LoadGamesForProfile(test); Console.WriteLine("User {0} Game List:", test.PersonaName); foreach (SteamProfileGame game in test.Games) { Console.WriteLine(" {0}", game.App.Name); } }
private async void GetSteamProfile(ulong steamId) { long id = (long)steamId; SteamProfile friendProfile = await SteamManager.GetSteamProfileByID(id); if (friendProfile != null) { await SteamManager.LoadGamesForProfile(friendProfile); lock (Friends) { Friends[friendProfile.SteamID] = friendProfile; } OnFriendListUpdate?.Invoke(this, friendProfile.SteamID); } }
public async Task <SteamProfile> Get(string userName) { SteamManager.SteamAPIKey = "1E17298A1D3EEC9E33720A02FEAD5232"; var steamId = await SteamManager.GetSteamIDByName(userName); if (steamId != 0) { var profile = await SteamManager.GetSteamProfileByID(steamId); if (profile != null) { await SteamManager.LoadGamesForProfile(profile); } return(profile); } return(default(SteamProfile)); }
/// <summary> /// Processes the queue message. /// </summary> /// <param name="appIdList">The asin list.</param> public static async Task ProcessQueueMessage([QueueTrigger("SteamQueue")] IList <int> appIdList) { Args.IsNotNull(() => appIdList); var userName = ConfigurationManager.AppSettings["SteamUserName"]; SteamManager.SteamAPIKey = ConfigurationManager.AppSettings["SteamApiKey"]; var steamId = await SteamManager.GetSteamIDByName(userName); if (steamId != 0) { var profile = await SteamManager.GetSteamProfileByID(steamId); if (profile != null) { await SteamManager.LoadGamesForProfile(profile); } } }
private async void AddUser(object sender, RoutedEventArgs e) { var name = HelperFunctions.FindChild <TextBox>(this, "UserName").Text; HelperFunctions.FindChild <TextBox>(this, "UserName").Text = ""; if (allGames == null) { allGames = await SteamManager.GetFullAppDictionary(); } long steamID; if (name.IsDigitsOnly() && name.Length == 17) { long.TryParse(name, out steamID); } else { steamID = await SteamManager.GetSteamIDByName(name); } if (steamID != 0) { var profile = await SteamManager.GetSteamProfileByID(steamID); if (profile != null) { await SteamManager.LoadGamesForProfile(profile); if (profile.Games.Count == 0) { } else if (games.Count == 0) { foreach (var game in profile.Games) { games.Add(game); } } else { games = games.Join(profile.Games.ToList(), la => la.App, lb => lb.App, (la, lb) => la).ToList(); } DataContext = null; var gameStringList = games.Select(game => game.App.Name + "\n").ToList(); gameStringList.Sort(); var gameString = gameStringList.Aggregate("", (current, str) => current + str); DataContext = gameString; profiles.Add(profile); foreach (var steamProfile in profiles.Where(steamProfile => !HelperFunctions.FindChild <TextBox>(this, "Users").Text.Contains(steamProfile.PersonaName))) { HelperFunctions.FindChild <TextBox>(this, "Users").Text += steamProfile.PersonaName + "\n"; } } else { MessageBox.Show(this, "No profile found for the id " + steamID); } } else { MessageBox.Show(this, "No Steam ID found for user " + name); } }