Example #1
0
        static void InitSteam3()
        {
            DebugLog.AppendText("Initializing Steam3...");

            if (!Steamworks.LoadSteamClient())
            {
                throw new InvalidOperationException("Unable to load steamclient.dll");
            }

            DebugLog.AppendText("Getting Steam3 interface: ISteamClient009...");
            SteamClient = Steamworks.CreateInterface <ISteamClient009>();
            DebugLog.AppendText(string.Format("ISteamClient009 = 0x{0:8X}", SteamClient.Interface));

            DebugLog.AppendText("Getting Steam3 interface: IClientEngine...");
            ClientEngine = Steamworks.CreateInterface <IClientEngine>();
            DebugLog.AppendText(string.Format("IClientEngine = 0x{0:8X}{1}", ClientEngine.Interface, Environment.NewLine));

            if (SteamClient == null || ClientEngine == null)
            {
                throw new InvalidOperationException("Unable to get required steamclient interfaces.");
            }


            DebugLog.AppendText("Creating steam pipe...");
            HSteamPipe = SteamClient.CreateSteamPipe();
            DebugLog.AppendText(string.Format("HSteamPipe = {0}", HSteamPipe));

            DebugLog.AppendText("Connecting to global user...");
            HSteamUser = SteamClient.ConnectToGlobalUser(HSteamPipe);
            DebugLog.AppendText(string.Format("HSteamUser = {0}{1}", HSteamUser, Environment.NewLine));

            if (HSteamUser == 0 || HSteamPipe == 0)
            {
                throw new InvalidOperationException("Unable to connect to global user.");
            }

            DebugLog.AppendText("Getting IClient interface: IClientApps...");
            ClientApps = ClientEngine.GetIClientApps <IClientApps>(HSteamUser, HSteamPipe);
            DebugLog.AppendText(string.Format("IClientApps = 0x{0:8X}", ClientApps.Interface));

            DebugLog.AppendText("Getting IClient interface: IClientUser...");
            ClientUser = ClientEngine.GetIClientUser <IClientUser>(HSteamUser, HSteamPipe);
            DebugLog.AppendText(string.Format("IClientUser = 0x{0:8X}", ClientUser.Interface));

            if (ClientApps == null || ClientUser == null)
            {
                throw new InvalidOperationException("Unable to get required interfaces.");
            }

            DebugLog.AppendText("Steam3 startup success." + Environment.NewLine);
        }
Example #2
0
        static void InitSteam3()
        {
            DebugLog.AppendText( "Initializing Steam3..." );

            if ( !Steamworks.LoadSteamClient() )
                throw new InvalidOperationException( "Unable to load steamclient.dll" );

            DebugLog.AppendText( "Getting Steam3 interface: ISteamClient009..." );
            SteamClient = Steamworks.CreateInterface<ISteamClient009>();
            DebugLog.AppendText( string.Format( "ISteamClient009 = 0x{0:8X}", SteamClient.Interface ) );

            DebugLog.AppendText( "Getting Steam3 interface: IClientEngine..." );
            ClientEngine = Steamworks.CreateInterface<IClientEngine>();
            DebugLog.AppendText( string.Format( "IClientEngine = 0x{0:8X}{1}", ClientEngine.Interface, Environment.NewLine ) );

            if ( SteamClient == null || ClientEngine == null )
                throw new InvalidOperationException( "Unable to get required steamclient interfaces." );


            DebugLog.AppendText( "Creating steam pipe..." );
            HSteamPipe = SteamClient.CreateSteamPipe();
            DebugLog.AppendText( string.Format( "HSteamPipe = {0}", HSteamPipe ) );

            DebugLog.AppendText( "Connecting to global user..." );
            HSteamUser = SteamClient.ConnectToGlobalUser( HSteamPipe );
            DebugLog.AppendText( string.Format( "HSteamUser = {0}{1}", HSteamUser, Environment.NewLine ) );

            if ( HSteamUser == 0 || HSteamPipe == 0 )
                throw new InvalidOperationException( "Unable to connect to global user." );

            DebugLog.AppendText( "Getting IClient interface: IClientApps..." );
            ClientApps = ClientEngine.GetIClientApps<IClientApps>( HSteamUser, HSteamPipe );
            DebugLog.AppendText( string.Format( "IClientApps = 0x{0:8X}", ClientApps.Interface ) );

            DebugLog.AppendText( "Getting IClient interface: IClientUser..." );
            ClientUser = ClientEngine.GetIClientUser<IClientUser>( HSteamUser, HSteamPipe );
            DebugLog.AppendText( string.Format( "IClientUser = 0x{0:8X}", ClientUser.Interface ) );

            if ( ClientApps == null || ClientUser == null )
                throw new InvalidOperationException( "Unable to get required interfaces." );

            DebugLog.AppendText( "Steam3 startup success." + Environment.NewLine );
        }