public void FillInterfaces(BaseSteamworks steamworks, int hpipe, int huser)
        {
            var clientPtr = api.SteamInternal_CreateInterface("SteamClient017");

            if (clientPtr == IntPtr.Zero)
            {
                throw new System.Exception("Steam Server: Couldn't load SteamClient017");
            }

            client = new SteamNative.SteamClient(steamworks, clientPtr);

            user            = client.GetISteamUser(huser, hpipe, SteamNative.Defines.STEAMUSER_INTERFACE_VERSION);
            utils           = client.GetISteamUtils(hpipe, SteamNative.Defines.STEAMUTILS_INTERFACE_VERSION);
            networking      = client.GetISteamNetworking(huser, hpipe, SteamNative.Defines.STEAMNETWORKING_INTERFACE_VERSION);
            gameServerStats = client.GetISteamGameServerStats(huser, hpipe, SteamNative.Defines.STEAMGAMESERVERSTATS_INTERFACE_VERSION);
            http            = client.GetISteamHTTP(huser, hpipe, SteamNative.Defines.STEAMHTTP_INTERFACE_VERSION);
            inventory       = client.GetISteamInventory(huser, hpipe, SteamNative.Defines.STEAMINVENTORY_INTERFACE_VERSION);
            ugc             = client.GetISteamUGC(huser, hpipe, SteamNative.Defines.STEAMUGC_INTERFACE_VERSION);
            apps            = client.GetISteamApps(huser, hpipe, SteamNative.Defines.STEAMAPPS_INTERFACE_VERSION);
            gameServer      = client.GetISteamGameServer(huser, hpipe, SteamNative.Defines.STEAMGAMESERVER_INTERFACE_VERSION);
            friends         = client.GetISteamFriends(huser, hpipe, SteamNative.Defines.STEAMFRIENDS_INTERFACE_VERSION);
            servers         = client.GetISteamMatchmakingServers(huser, hpipe, SteamNative.Defines.STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION);
            userstats       = client.GetISteamUserStats(huser, hpipe, SteamNative.Defines.STEAMUSERSTATS_INTERFACE_VERSION);
            screenshots     = client.GetISteamScreenshots(huser, hpipe, SteamNative.Defines.STEAMSCREENSHOTS_INTERFACE_VERSION);
            remoteStorage   = client.GetISteamRemoteStorage(huser, hpipe, SteamNative.Defines.STEAMREMOTESTORAGE_INTERFACE_VERSION);
            matchmaking     = client.GetISteamMatchmaking(huser, hpipe, SteamNative.Defines.STEAMMATCHMAKING_INTERFACE_VERSION);
        }
        internal Workshop(BaseSteamworks steamworks, SteamNative.SteamUGC ugc, SteamNative.SteamRemoteStorage remoteStorage)
        {
            this.ugc           = ugc;
            this.steamworks    = steamworks;
            this.remoteStorage = remoteStorage;

            steamworks.RegisterCallback <SteamNative.DownloadItemResult_t>(onDownloadResult);
            steamworks.RegisterCallback <SteamNative.ItemInstalled_t>(onItemInstalled);
        }
        /// <summary>
        /// You should never have to call this manually
        /// </summary>
        public void Dispose()
        {
            ugc           = null;
            steamworks    = null;
            remoteStorage = null;
            friends       = null;

            OnFileDownloaded = null;
            OnItemInstalled  = null;
        }
Beispiel #4
0
        internal Workshop(BaseSteamworks steamworks, SteamNative.SteamUGC ugc, SteamNative.SteamRemoteStorage remoteStorage)
        {
            this.ugc           = ugc;
            this.steamworks    = steamworks;
            this.remoteStorage = remoteStorage;

            SteamNative.DownloadItemResult_t.RegisterCallback(steamworks, onDownloadResult);
            SteamNative.ItemInstalled_t.RegisterCallback(steamworks, onItemInstalled);
            //  SteamNative.SteamUGCQueryCompleted_t.RegisterCallback( steamworks, onQueryComplete );

            // steamworks.AddCallback<ItemInstalled, ItemInstalled.Small>( onItemInstalled, ItemInstalled.CallbackId );
        }
        public void Dispose()
        {
            if (client != null)
            {
                if (hPipe != 0)
                {
                    if (hUser != 0)
                    {
                        client.ReleaseUser(hPipe, hUser);
                        hUser = 0;
                    }

                    client.BReleaseSteamPipe(hPipe);
                    hPipe = 0;
                }

                if (!client.BShutdownIfAllPipesClosed())
                {
                    Console.WriteLine("BShutdownIfAllPipesClosed returned false");
                }

                client.Dispose();
                client = null;
            }

            if (user != null)
            {
                user.Dispose();
                user = null;
            }

            if (utils != null)
            {
                utils.Dispose();
                utils = null;
            }

            if (networking != null)
            {
                networking.Dispose();
                networking = null;
            }

            if (gameServerStats != null)
            {
                gameServerStats.Dispose();
                gameServerStats = null;
            }

            if (http != null)
            {
                http.Dispose();
                http = null;
            }

            if (inventory != null)
            {
                inventory.Dispose();
                inventory = null;
            }

            if (ugc != null)
            {
                ugc.Dispose();
                ugc = null;
            }

            if (apps != null)
            {
                apps.Dispose();
                apps = null;
            }

            if (gameServer != null)
            {
                //
                // Calling this can cause the process to hang
                //
                //gameServer.LogOff();

                gameServer.Dispose();
                gameServer = null;
            }

            if (friends != null)
            {
                friends.Dispose();
                friends = null;
            }

            if (servers != null)
            {
                servers.Dispose();
                servers = null;
            }

            if (userstats != null)
            {
                userstats.Dispose();
                userstats = null;
            }

            if (screenshots != null)
            {
                screenshots.Dispose();
                screenshots = null;
            }

            if (remoteStorage != null)
            {
                remoteStorage.Dispose();
                remoteStorage = null;
            }

            if (api != null)
            {
                if (isServer)
                {
                    api.SteamGameServer_Shutdown();
                }
                else
                {
                    api.SteamAPI_Shutdown();
                }

                api.Dispose();
                api = null;
            }
        }
Beispiel #6
0
 internal RemoteStorage(Client c)
 {
     client = c;
     native = client.native.remoteStorage;
 }
Beispiel #7
0
 public void Dispose()
 {
     client = null;
     native = null;
 }
Beispiel #8
0
        public void Dispose()
        {
            if (user != null)
            {
                user.Dispose();
                user = null;
            }

            if (utils != null)
            {
                utils.Dispose();
                utils = null;
            }

            if (networking != null)
            {
                networking.Dispose();
                networking = null;
            }

            if (gameServerStats != null)
            {
                gameServerStats.Dispose();
                gameServerStats = null;
            }

            if (http != null)
            {
                http.Dispose();
                http = null;
            }

            if (inventory != null)
            {
                inventory.Dispose();
                inventory = null;
            }

            if (ugc != null)
            {
                ugc.Dispose();
                ugc = null;
            }

            if (apps != null)
            {
                apps.Dispose();
                apps = null;
            }

            if (gameServer != null)
            {
                gameServer.Dispose();
                gameServer = null;
            }

            if (friends != null)
            {
                friends.Dispose();
                friends = null;
            }

            if (servers != null)
            {
                servers.Dispose();
                servers = null;
            }

            if (userstats != null)
            {
                userstats.Dispose();
                userstats = null;
            }

            if (screenshots != null)
            {
                screenshots.Dispose();
                screenshots = null;
            }

            if (remoteStorage != null)
            {
                remoteStorage.Dispose();
                remoteStorage = null;
            }

            if (matchmaking != null)
            {
                matchmaking.Dispose();
                matchmaking = null;
            }

            if (applist != null)
            {
                applist.Dispose();
                applist = null;
            }

            if (client != null)
            {
                client.Dispose();
                client = null;
            }

            if (api != null)
            {
                if (isServer)
                {
                    api.SteamGameServer_Shutdown();
                }
                else
                {
                    api.SteamAPI_Shutdown();
                }

                //
                // The functions above destroy the pipeline handles
                // and all of the classes. Trying to call a steam function
                // at this point will result in a crash - because any
                // pointers we stored are not invalid.
                //

                api.Dispose();
                api = null;
            }
        }