public GameServerItem GetServerDetails(ServerListRequestHandle request, int server) { IntPtr returnValue; returnValue = NativeMethods.MatchmakingServers_GetServerDetails(request.AsUInt32, server); return(GameServerItem.Create(returnValue, NativeMethods.MatchmakingServers_GetGameServerItemSize())); }
/// <summary> /// Callback that is called directly from native code /// </summary> /// <param name="instanceId"></param> /// <param name="server"></param> /// <param name="serverSize"></param> private static void ServerRespondedCallback(uint instanceId, IntPtr server, int serverSize) { try { var target = MatchmakingServers.PingResponse[instanceId]; target.serverResponded.Add(GameServerItem.Create(server, serverSize)); } catch (Exception e) { // If we get a null reference exception it means that either the Steam.Instance, // Steam.Instance.MatchmakingServers, // Steam.Instance.MatchmakingServers.PingResponse, // target or target.serverResponded is null. // // Either way, this should not happen during correct usage. But since we can't // throw an exception as this method is called from native code, we try to save it. try { MatchmakingServers.SaveException(e); } catch (Exception) { // If anything goes wrong while saving the exception, just ignore it. } } }