/// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            if (steam != null)
            {
                GameServer = ServicesGameServer.Initialize(myIp, 8766, 27015, 27016, myServermode, GameServerVersion);

                MatchmakingServerList responseObject = new MatchmakingServerList();
                MatchMakingKeyValuePair[] filter = new MatchMakingKeyValuePair[2];
                filter[0] = new MatchMakingKeyValuePair("TestKey0", "TestValue0åäöõ");
                filter[1] = new MatchMakingKeyValuePair("TestKey1", "TestValue1ÅÄÖÕ");
                steam.MatchmakingServers.RequestInternetServerList(steam.AppID, filter, responseObject);

                steam.Friends.GameOverlayActivated += GameOverlayToggle;
                steam.Utils.SteamShutdown += SteamShutdownFunc;
            }

            base.Initialize();
        }
        private ServerListRequestHandle ServerRequest(ServerRequestType requestType, AppID appID,
            MatchMakingKeyValuePair[] filters, MatchmakingServerListResponse requestResponse)
        {
            // Code reuse FTW!

            // Allocate an array that will hold addresses to native MatchMakingKeyValuePair objects
            using (NativeBuffer arrayBuffer = new NativeBuffer(Marshal.SizeOf(typeof(IntPtr)) * filters.Length))
            {
                NativeBuffer[] nativeObjects = new NativeBuffer[filters.Length];
                // Fill each array slot with an address to an actual object
                try
                {
                    for (int i = 0; i < filters.Length; i++)
                    {
                        // Copy the managed objects to native memory
                        NativeBuffer buffer = NativeBuffer.CopyToNative(filters[i]);
                        nativeObjects[i] = buffer;
                        // Add the native address to the array
                        Marshal.WriteInt32(arrayBuffer.UnmanagedMemory, i * Marshal.SizeOf(typeof(int)), buffer.UnmanagedMemory.ToInt32());
                    }

                    // Now do the actual request

                    switch (requestType)
                    {
                        case ServerRequestType.Internet:
                            return new ServerListRequestHandle(
                                NativeMethods.MatchmakingServers_RequestInternetServerList(appID.AsUInt32,
                                arrayBuffer.UnmanagedMemory, (uint)filters.Length, requestResponse.ObjectId));
                        case ServerRequestType.Friends:
                            return new ServerListRequestHandle(
                                NativeMethods.MatchmakingServers_RequestFriendsServerList(appID.AsUInt32,
                                arrayBuffer.UnmanagedMemory, (uint)filters.Length, requestResponse.ObjectId));
                        case ServerRequestType.Favorites:
                            return new ServerListRequestHandle(
                                NativeMethods.MatchmakingServers_RequestFavoritesServerList(appID.AsUInt32,
                                arrayBuffer.UnmanagedMemory, (uint)filters.Length, requestResponse.ObjectId));
                        case ServerRequestType.History:
                            return new ServerListRequestHandle(
                                NativeMethods.MatchmakingServers_RequestHistoryServerList(appID.AsUInt32,
                                arrayBuffer.UnmanagedMemory, (uint)filters.Length, requestResponse.ObjectId));
                        case ServerRequestType.Spectator:
                            return new ServerListRequestHandle(
                                NativeMethods.MatchmakingServers_RequestSpectatorServerList(appID.AsUInt32,
                                arrayBuffer.UnmanagedMemory, (uint)filters.Length, requestResponse.ObjectId));
                        default:
                            // This should never happen as our code can not be allowed to make this error
                            throw new ArgumentException();
                    }
                }
                finally
                {
                    // Cleanup in all cases. Exception or not.
                    foreach (var item in nativeObjects)
                    {
                        if (item != null)
                        {
                            item.Dispose();
                        }
                    }
                }
            }
        }
 public ServerListRequestHandle RequestSpectatorServerList(AppID appID, MatchMakingKeyValuePair[] filters,
     MatchmakingServerListResponse requestServersResponse)
 {
     return ServerRequest(ServerRequestType.Spectator, appID, filters, requestServersResponse);
 }