From e4e3b0dbce87688dc29519826510810a176d52ae Mon Sep 17 00:00:00 2001 From: Russ Treadwell Date: Wed, 22 Jan 2020 22:52:03 -0500 Subject: [PATCH] Fix EnumerateFollowingList and rename to GetFollowingList --- Facepunch.Steamworks/SteamFriends.cs | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/Facepunch.Steamworks/SteamFriends.cs b/Facepunch.Steamworks/SteamFriends.cs index fd4ec6a..df21149 100644 --- a/Facepunch.Steamworks/SteamFriends.cs +++ b/Facepunch.Steamworks/SteamFriends.cs @@ -310,10 +310,24 @@ public static async Task GetFollowerCount(SteamId steamID) return r.Value.Count; } - public static async Task EnumerateFollowingList(uint StartIndex) - { - var r = await Internal.EnumerateFollowingList(StartIndex); - return r.Value.GSteamID; - } - } + public static async Task GetFollowingList() + { + int resultCount = 0; + var steamIds = new List(); + + FriendsEnumerateFollowingList_t? result; + + do + { + if ((result = await Internal.EnumerateFollowingList((uint)resultCount)) != null) + { + resultCount += result.Value.ResultsReturned; + + Array.ForEach(result.Value.GSteamID, id => { if (id > 0) steamIds.Add(id); }); + } + } while (result != null && resultCount < result.Value.TotalResultCount); + + return steamIds.ToArray(); + } + } }