Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SteamClient"/> class with a specific configuration and identifier
        /// </summary>
        /// <param name="configuration">The configuration to use for this client.</param>
        /// <param name="identifier">A specific identifier to be used to uniquely identify this instance.</param>
        /// <exception cref="ArgumentNullException">The configuration object or identifier is <c>null</c></exception>
        /// <exception cref="ArgumentException">The identifier is an empty string</exception>
        public SteamClient(SteamConfiguration configuration, string identifier)
            : base(configuration, identifier)
        {
            callbackQueue = new Queue <ICallbackMsg>();

            this.handlers = new OrderedDictionary();

            // Start calculating machine info so that it is (hopefully) ready by the time we get to logging in.
            HardwareUtils.Init(configuration.MachineInfoProvider);

            // add this library's handlers
            // notice: SteamFriends should be added before SteamUser due to AccountInfoCallback
            this.AddHandler(new SteamFriends());
            this.AddHandler(new SteamUser());
            this.AddHandler(new SteamApps());
            this.AddHandler(new SteamGameCoordinator());
            this.AddHandler(new SteamGameServer());
            this.AddHandler(new SteamUserStats());
            this.AddHandler(new SteamMasterServer());
            this.AddHandler(new SteamCloud());
            this.AddHandler(new SteamWorkshop());
            this.AddHandler(new SteamTrading());
            this.AddHandler(new SteamUnifiedMessages());
            this.AddHandler(new SteamScreenshots());
            this.AddHandler(new SteamMatchmaking());
            this.AddHandler(new SteamNetworking());
            this.AddHandler(new SteamContent());

            using (var process = Process.GetCurrentProcess())
            {
                this.processStartTime = process.StartTime;
            }

            dispatchMap = new Dictionary <EMsg, Action <IPacketMsg> >
            {
                { EMsg.ClientCMList, HandleCMList },

                // to support asyncjob life time
                { EMsg.JobHeartbeat, HandleJobHeartbeat },
                { EMsg.DestJobFailed, HandleJobFailed },
            };

            jobManager = new AsyncJobManager();
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SteamClient"/> class with a specific connection type.
        /// </summary>
        /// <param name="type">The connection type to use.</param>
        public SteamClient(ProtocolType type = ProtocolType.Tcp)
            : base(type)
        {
            callbackQueue = new Queue <ICallbackMsg>();

            this.handlers = new Dictionary <Type, ClientMsgHandler>();

            // add this library's handlers
            this.AddHandler(new SteamUser());
            this.AddHandler(new SteamFriends());
            this.AddHandler(new SteamApps());
            this.AddHandler(new SteamGameCoordinator());
            this.AddHandler(new SteamGameServer());
            this.AddHandler(new SteamUserStats());
            this.AddHandler(new SteamMasterServer());
            this.AddHandler(new SteamCloud());
            this.AddHandler(new SteamWorkshop());
            this.AddHandler(new SteamTrading());
            this.AddHandler(new SteamUnifiedMessages());
            this.AddHandler(new SteamScreenshots());

            using (var process = Process.GetCurrentProcess())
            {
                this.processStartTime = process.StartTime;
            }

            dispatchMap = new Dictionary <EMsg, Action <IPacketMsg> >
            {
                // we're interested in this client message to post the connected callback
                { EMsg.ChannelEncryptResult, HandleEncryptResult },

                { EMsg.ClientCMList, HandleCMList },
                { EMsg.ClientServerList, HandleServerList },

                // to support asyncjob life time
                { EMsg.JobHeartbeat, HandleJobHeartbeat },
                { EMsg.DestJobFailed, HandleJobFailed },
            };

            jobManager = new AsyncJobManager();
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SteamClient"/> class with a specific configuration.
        /// </summary>
        /// <param name="configuration">The configuration to use for this client.</param>
        /// <exception cref="ArgumentNullException">The configuration object is <c>null</c></exception>
        public SteamClient(SteamConfiguration configuration)
            : base(configuration)
        {
            callbackQueue = new Queue <ICallbackMsg>();

            this.handlers = new OrderedDictionary();

            // add this library's handlers
            // notice: SteamFriends should be added before SteamUser due to AccountInfoCallback
            this.AddHandler(new SteamFriends());
            this.AddHandler(new SteamUser());
            this.AddHandler(new SteamApps());
            this.AddHandler(new SteamGameCoordinator());
            this.AddHandler(new SteamGameServer());
            this.AddHandler(new SteamUserStats());
            this.AddHandler(new SteamMasterServer());
            this.AddHandler(new SteamCloud());
            this.AddHandler(new SteamWorkshop());
            this.AddHandler(new SteamTrading());
            this.AddHandler(new SteamUnifiedMessages());
            this.AddHandler(new SteamScreenshots());
            this.AddHandler(new SteamMatchmaking());

            using (var process = Process.GetCurrentProcess())
            {
                this.processStartTime = process.StartTime;
            }

            dispatchMap = new Dictionary <EMsg, Action <IPacketMsg> >
            {
                { EMsg.ClientCMList, HandleCMList },
                { EMsg.ClientServerList, HandleServerList },

                // to support asyncjob life time
                { EMsg.JobHeartbeat, HandleJobHeartbeat },
                { EMsg.DestJobFailed, HandleJobFailed },
            };

            jobManager = new AsyncJobManager();
        }