コード例 #1
0
        /// <summary>
        /// Attempt to logon to the UFS and authorize the client for the given AppIDs.
        /// The <see cref="UFSClient"/> should be connected before this point.
        /// Results are returned in a <see cref="LoggedOnCallback"/>.
        /// </summary>
        /// <param name="appIds">The AppIDs to authorize when connecting to the UFS.</param>
        /// <returns>The Job ID of the request. This can be used to find the appropriate <see cref="LoggedOnCallback"/>.</returns>
        public JobID Logon(IEnumerable <uint> appIds)
        {
            if (appIds == null)
            {
                throw new ArgumentNullException(nameof(appIds));
            }

            var jobId = steamClient.GetNextJobID();

            if (!steamClient.IsConnected)
            {
                var callback = new LoggedOnCallback(jobId, EResult.NoConnection);
                steamClient.PostCallback(callback);
                return(jobId);
            }

            var loginReq = new ClientMsgProtobuf <CMsgClientUFSLoginRequest>(EMsg.ClientUFSLoginRequest);

            loginReq.SourceJobID = jobId;

            loginReq.Body.apps.AddRange(appIds);
            loginReq.Body.protocol_version = MsgClientLogon.CurrentProtocol;
            loginReq.Body.am_session_token = steamClient.SessionToken;

            Send(loginReq);

            return(loginReq.SourceJobID);
        }
コード例 #2
0
ファイル: UFSClient.cs プロジェクト: icodingforfood/SteamKit2
        /// <summary>
        /// Attempt to logon to the UFS and authorize the client for the given AppIDs.
        /// The <see cref="UFSClient"/> should be connected before this point.
        /// Results are returned in a <see cref="LoggedOnCallback"/>.
        /// </summary>
        /// <param name="appIds">The AppIDs to authorize when connecting to the UFS.</param>
        /// <returns>The Job ID of the request. This can be used to find the appropriate <see cref="SteamClient.JobCallback&lt;T&gt;"/>.</returns>
        public JobID Logon(IEnumerable <uint> appIds)
        {
            var loginReq = new ClientMsgProtobuf <CMsgClientUFSLoginRequest>(EMsg.ClientUFSLoginRequest);

            loginReq.SourceJobID = steamClient.GetNextJobID();

            loginReq.Body.apps.AddRange(appIds);
            loginReq.Body.protocol_version = MsgClientLogon.CurrentProtocol;
            loginReq.Body.am_session_token = steamClient.SessionToken;

            Send(loginReq);

            return(loginReq.SourceJobID);
        }
コード例 #3
0
        private AsyncJob <SteamTicketAccepted> VerifyTicket(uint appId, MemoryStream stream, out uint crc)
        {
            var authTicket = stream.ToArray();

            crc = BitConverter.ToUInt32(CryptoHelper.CRCHash(authTicket));
            var items = _gameTickets.GetOrAdd(appId, new List <CMsgAuthTicket>());

            items.Add(new CMsgAuthTicket()
            {
                gameid     = appId,
                ticket     = authTicket,
                ticket_crc = crc
            });

            var authList = new ClientMsgProtobuf <CMsgClientAuthList>(EMsg.ClientAuthList);

            authList.Body.tokens_left = (uint)_gcTokens.Count;
            authList.Body.app_ids.AddRange(_gameTickets.Keys);
            authList.Body.tickets.AddRange(_gameTickets.Values.SelectMany(x => x));
            authList.SourceJobID = Client.GetNextJobID();
            Client.Send(authList);

            return(new AsyncJob <SteamTicketAccepted>(Client, authList.SourceJobID));
        }
コード例 #4
0
        /// <summary>
        /// Attempt to logon to the UFS and authorize the client for the given AppIDs.
        /// The <see cref="UFSClient"/> should be connected before this point.
        /// Results are returned in a <see cref="LoggedOnCallback"/>.
        /// </summary>
        /// <param name="appIds">The AppIDs to authorize when connecting to the UFS.</param>
        /// <returns>The Job ID of the request. This can be used to find the appropriate <see cref="SteamClient.JobCallback&lt;T&gt;"/>.</returns>
        public JobID Logon(IEnumerable <uint> appIds)
        {
            var jobId = steamClient.GetNextJobID();

            if (!steamClient.IsConnected)
            {
                var cb    = new LoggedOnCallback(EResult.NoConnection);
                var jobCb = new SteamClient.JobCallback <LoggedOnCallback>(jobId, cb);
                steamClient.PostCallback(jobCb);
                return(jobId);
            }

            var loginReq = new ClientMsgProtobuf <CMsgClientUFSLoginRequest>(EMsg.ClientUFSLoginRequest);

            loginReq.SourceJobID = jobId;

            loginReq.Body.apps.AddRange(appIds);
            loginReq.Body.protocol_version = MsgClientLogon.CurrentProtocol;
            loginReq.Body.am_session_token = steamClient.SessionToken;

            Send(loginReq);

            return(loginReq.SourceJobID);
        }