From 711bc7cb3d9a83b95767579767d7e5314ccec062 Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Thu, 23 May 2019 14:46:26 +0100 Subject: [PATCH] ServerInfo (AddTo|RemoveFrom)(History|Favorites) works --- Facepunch.Steamworks/Structs/Server.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Facepunch.Steamworks/Structs/Server.cs b/Facepunch.Steamworks/Structs/Server.cs index df5c620..08c1b4d 100644 --- a/Facepunch.Steamworks/Structs/Server.cs +++ b/Facepunch.Steamworks/Structs/Server.cs @@ -9,6 +9,8 @@ namespace Steamworks.Data { public struct ServerInfo : IEquatable { + static ISteamMatchmakingServers Internal => Steamworks.ServerList.Base.Internal; + public string Name { get; set; } public int Ping { get; set; } public string GameDir { get; set; } @@ -24,6 +26,7 @@ public struct ServerInfo : IEquatable public int Version { get; set; } public string TagString { get; set; } public ulong SteamId { get; set; } + public uint AddressRaw { get; set; } public IPAddress Address { get; set; } public int ConnectionPort { get; set; } public int QueryPort { get; set; } @@ -53,6 +56,7 @@ internal static ServerInfo From( gameserveritem_t item ) { return new ServerInfo() { + AddressRaw = item.NetAdr.IP, Address = Utility.Int32ToIp( item.NetAdr.IP ), ConnectionPort = item.NetAdr.ConnectionPort, QueryPort = item.NetAdr.QueryPort, @@ -84,7 +88,7 @@ internal static ServerInfo From( gameserveritem_t item ) /// public void AddToHistory() { - //Client.native.matchmaking.AddFavoriteGame( AppId, Utility.IpToInt32( Address ), (ushort)ConnectionPort, (ushort)QueryPort, k_unFavoriteFlagHistory, (uint)Utility.Epoch.Current ); + SteamMatchmaking.Internal.AddFavoriteGame( SteamClient.AppId, AddressRaw, (ushort)ConnectionPort, (ushort)QueryPort, k_unFavoriteFlagHistory, (uint)Epoch.Current ); } /// @@ -100,7 +104,7 @@ public async Task> QueryRulesAsync() /// public void RemoveFromHistory() { - //Client.native.matchmaking.RemoveFavoriteGame( AppId, Utility.IpToInt32( Address ), (ushort)ConnectionPort, (ushort)QueryPort, k_unFavoriteFlagHistory ); + SteamMatchmaking.Internal.RemoveFavoriteGame( SteamClient.AppId, AddressRaw, (ushort)ConnectionPort, (ushort)QueryPort, k_unFavoriteFlagHistory ); } /// @@ -108,7 +112,7 @@ public void RemoveFromHistory() /// public void AddToFavourites() { - //Client.native.matchmaking.AddFavoriteGame( AppId, Utility.IpToInt32( Address ), (ushort)ConnectionPort, (ushort)QueryPort, k_unFavoriteFlagFavorite, (uint)Utility.Epoch.Current ); + SteamMatchmaking.Internal.AddFavoriteGame( SteamClient.AppId, AddressRaw, (ushort)ConnectionPort, (ushort)QueryPort, k_unFavoriteFlagFavorite, (uint)Epoch.Current ); } /// @@ -116,7 +120,7 @@ public void AddToFavourites() /// public void RemoveFromFavourites() { - //Client.native.matchmaking.RemoveFavoriteGame( AppId, Utility.IpToInt32( Address ), (ushort)ConnectionPort, (ushort)QueryPort, k_unFavoriteFlagFavorite ); + SteamMatchmaking.Internal.RemoveFavoriteGame( SteamClient.AppId, AddressRaw, (ushort)ConnectionPort, (ushort)QueryPort, k_unFavoriteFlagFavorite ); } public bool Equals( ServerInfo other )