Example #1
0
        void HandleChatActionResult(IPacketMsg packetMsg)
        {
            var actionResult = new ClientMsg <MsgClientChatActionResult>(packetMsg);

            var callback = new ChatActionResultCallback(actionResult.Body);

            this.Client.PostCallback(callback);
        }
Example #2
0
        void HandleIgnoreFriendResponse(IPacketMsg packetMsg)
        {
            var response = new ClientMsg <MsgClientSetIgnoreFriendResponse>(packetMsg);

            var callback = new IgnoreFriendCallback(response.TargetJobID, response.Body);

            this.Client.PostCallback(callback);
        }
Example #3
0
        void HandleGuestPassList(IPacketMsg packetMsg)
        {
            var guestPasses = new ClientMsg <MsgClientUpdateGuestPassesList>(packetMsg);

            var callback = new GuestPassListCallback(guestPasses.Body, guestPasses.Payload);

            this.Client.PostCallback(callback);
        }
Example #4
0
        void HandleVACBanStatus(IPacketMsg packetMsg)
        {
            var vacStatus = new ClientMsg <MsgClientVACBanStatus>(packetMsg);

            var callback = new VACStatusCallback(vacStatus.Body, vacStatus.Payload.ToArray());

            this.Client.PostCallback(callback);
        }
Example #5
0
        void HandleChatEnter(IPacketMsg packetMsg)
        {
            var chatEnter = new ClientMsg <MsgClientChatEnter>(packetMsg);

            var callback = new ChatEnterCallback(chatEnter.Body);

            this.Client.PostCallback(callback);
        }
Example #6
0
        void HandleNumberOfPlayersResponse(IPacketMsg packetMsg)
        {
            var msg = new ClientMsg <MsgClientGetNumberOfCurrentPlayersResponse>(packetMsg);

            var callback = new NumberOfPlayersCallback(msg.Header.TargetJobID, msg.Body);

            Client.PostCallback(callback);
        }
Example #7
0
        void HandleSendGuestPassResponse(IPacketMsg packetMsg)
        {
            var response = new ClientMsg <MsgClientSendGuestPassResponse>(packetMsg);

            var callback = new SendGuestPassCallback(response.Body);

            this.Client.PostCallback(callback);
        }
Example #8
0
        void HandleMarketingMessageUpdate(IPacketMsg packetMsg)
        {
            var marketingMessage = new ClientMsg <MsgClientMarketingMessageUpdate2>(packetMsg);

            byte[] payload = marketingMessage.Payload.ToArray();

            var callback = new MarketingMessageCallback(marketingMessage.Body, payload);

            this.Client.PostCallback(callback);
        }
Example #9
0
        void HandleChatMsg(IPacketMsg packetMsg)
        {
            var chatMsg = new ClientMsg <MsgClientChatMsg>(packetMsg);

            byte[] msgData = chatMsg.Payload.ToArray();

            var callback = new ChatMsgCallback(chatMsg.Body, msgData);

            this.Client.PostCallback(callback);
        }
Example #10
0
        void HandleChatEnter(IPacketMsg packetMsg)
        {
            var chatEnter = new ClientMsg <MsgClientChatEnter>(packetMsg);

            byte[] payload = chatEnter.Payload.ToArray();

            var callback = new ChatEnterCallback(chatEnter.Body, payload);

            this.Client.PostCallback(callback);
        }
Example #11
0
        void HandleChatRoomInfo(IPacketMsg packetMsg)
        {
            var roomInfo = new ClientMsg <MsgClientChatRoomInfo>(packetMsg);

            byte[] payload = roomInfo.Payload.ToArray();

            var callback = new ChatRoomInfoCallback(roomInfo.Body, payload);

            this.Client.PostCallback(callback);
        }
Example #12
0
        /// <summary>
        /// Request the legacy CD game keys for the requested appid.
        /// </summary>
        /// <param name="appid">The AppID to request game keys for.</param>
        public AsyncJob <LegacyGameKeyCallback> GetLegacyGameKey(uint appid)
        {
            var request = new ClientMsg <MsgClientGetLegacyGameKey>();

            request.SourceJobID = Client.GetNextJobID();
            request.Body.AppId  = appid;

            this.Client.Send(request);

            return(new AsyncJob <LegacyGameKeyCallback>(this.Client, request.SourceJobID));
        }
Example #13
0
        void HandleSendGuestPassResponse(IPacketMsg packetMsg)
        {
            var response = new ClientMsg <MsgClientSendGuestPassResponse>(packetMsg);

#if STATIC_CALLBACKS
            var callback = new SendGuestPassCallback(Client, response.Body);
            SteamClient.PostCallback(callback);
#else
            var callback = new SendGuestPassCallback(response.Body);
            this.Client.PostCallback(callback);
#endif
        }
Example #14
0
        void HandleGuestPassList(IPacketMsg packetMsg)
        {
            var guestPasses = new ClientMsg <MsgClientUpdateGuestPassesList>(packetMsg);

#if STATIC_CALLBACKS
            var callback = new GuestPassListCallback(Client, guestPasses.Body, guestPasses.Payload);
            SteamClient.PostCallback(callback);
#else
            var callback = new GuestPassListCallback(guestPasses.Body, guestPasses.Payload);
            this.Client.PostCallback(callback);
#endif
        }
Example #15
0
        void HandleVACBanStatus(IPacketMsg packetMsg)
        {
            var vacStatus = new ClientMsg <MsgClientVACBanStatus>(packetMsg);

#if STATIC_CALLBACKS
            var callback = new VACStatusCallback(Client, vacStatus.Body, vacStatus.Payload.ToArray());
            SteamClient.PostCallback(callback);
#else
            var callback = new VACStatusCallback(vacStatus.Body, vacStatus.Payload.ToArray());
            this.Client.PostCallback(callback);
#endif
        }
Example #16
0
        void HandleChatActionResult(IPacketMsg packetMsg)
        {
            var actionResult = new ClientMsg <MsgClientChatActionResult>(packetMsg);

#if STATIC_CALLBACKS
            var callback = new ChatActionResultCallback(Client, actionResult.Body);
            SteamClient.PostCallback(callback);
#else
            var callback = new ChatActionResultCallback(actionResult.Body);
            this.Client.PostCallback(callback);
#endif
        }
Example #17
0
        /// <summary>
        /// Retrieves the number of current players or a given <see cref="GameID"/>.
        /// Results are returned in a <see cref="NumberOfPlayersCallback"/> from a <see cref="SteamClient.JobCallback&lt;T&gt;"/>.
        /// </summary>
        /// <param name="gameId">The GameID to request the number of players for.</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 GetNumberOfCurrentPlayers(GameID gameId)
        {
            var msg = new ClientMsg <MsgClientGetNumberOfCurrentPlayers>();

            msg.SourceJobID = Client.GetNextJobID();

            msg.Body.GameID = gameId;

            Client.Send(msg);

            return(msg.SourceJobID);
        }
Example #18
0
        void HandleChatEnter(IPacketMsg packetMsg)
        {
            var chatEnter = new ClientMsg <MsgClientChatEnter>(packetMsg);

#if STATIC_CALLBACKS
            var callback = new ChatEnterCallback(Client, chatEnter.Body);
            SteamClient.PostCallback(callback);
#else
            var callback = new ChatEnterCallback(chatEnter.Body);
            this.Client.PostCallback(callback);
#endif
        }
Example #19
0
        /// <summary>
        /// Retrieves the number of current players for a given <see cref="GameID"/>.
        /// Results are returned in a <see cref="NumberOfPlayersCallback"/>.
        /// </summary>
        /// <param name="gameId">The GameID to request the number of players for.</param>
        /// <returns>The Job ID of the request. This can be used to find the appropriate <see cref="NumberOfPlayersCallback"/>.</returns>
        public AsyncJob <NumberOfPlayersCallback> GetNumberOfCurrentPlayers(GameID gameId)
        {
            var msg = new ClientMsg <MsgClientGetNumberOfCurrentPlayers>();

            msg.SourceJobID = Client.GetNextJobID();

            msg.Body.GameID = gameId;

            Client.Send(msg);

            return(new AsyncJob <NumberOfPlayersCallback>(this.Client, msg.SourceJobID));
        }
Example #20
0
        void HandleChatMemberInfo(IPacketMsg packetMsg)
        {
            var membInfo = new ClientMsg <MsgClientChatMemberInfo>(packetMsg);

            byte[] payload = membInfo.Payload.ToArray();

#if STATIC_CALLBACKS
            var callback = new ChatMemberInfoCallback(Client, membInfo.Body, payload);
            SteamClient.PostCallback(callback);
#else
            var callback = new ChatMemberInfoCallback(membInfo.Body, payload);
            this.Client.PostCallback(callback);
#endif
        }
Example #21
0
        void HandleNumberOfPlayersResponse(IPacketMsg packetMsg)
        {
            var msg = new ClientMsg <MsgClientGetNumberOfCurrentPlayersResponse>(packetMsg);

#if STATIC_CALLBACKS
            var innerCallback = new NumberOfPlayersCallback(Client, msg.Body);
            var callback      = new SteamClient.JobCallback <NumberOfPlayersCallback>(Client, msg.Header.TargetJobID, innerCallback);
            SteamClient.PostCallback(callback);
#else
            var innerCallback = new NumberOfPlayersCallback(msg.Body);
            var callback      = new SteamClient.JobCallback <NumberOfPlayersCallback>(msg.Header.TargetJobID, innerCallback);
            Client.PostCallback(callback);
#endif
        }
Example #22
0
        void HandleIgnoreFriendResponse(IPacketMsg packetMsg)
        {
            var response = new ClientMsg <MsgClientSetIgnoreFriendResponse>(packetMsg);

#if STATIC_CALLBACKS
            var innerCallback = new IgnoreFriendCallback(Client, response.Body);
            var callback      = new SteamClient.JobCallback <IgnoreFriendCallback>(Client, response.TargetJobID, innerCallback);
            SteamClient.PostCallback(callback);
#else
            var innerCallback = new IgnoreFriendCallback(response.Body);
            var callback      = new SteamClient.JobCallback <IgnoreFriendCallback>(response.TargetJobID, innerCallback);
            this.Client.PostCallback(callback);
#endif
        }
Example #23
0
        /// <summary>
        /// Ignores or unignores a friend on Steam.
        /// Results are returned in a <see cref="IgnoreFriendCallback"/>.
        /// </summary>
        /// <param name="steamId">The SteamID of the friend to ignore or unignore.</param>
        /// <param name="setIgnore">if set to <c>true</c>, the friend will be ignored; otherwise, they will be unignored.</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 IgnoreFriend(SteamID steamId, bool setIgnore = true)
        {
            var ignore = new ClientMsg <MsgClientSetIgnoreFriend>();

            ignore.SourceJobID = Client.GetNextJobID();

            ignore.Body.MySteamId     = Client.SteamID;
            ignore.Body.Ignore        = ( byte )(setIgnore ? 1 : 0);
            ignore.Body.SteamIdFriend = steamId;

            this.Client.Send(ignore);

            return(ignore.SourceJobID);
        }
Example #24
0
        void HandleChatMsg(IPacketMsg packetMsg)
        {
            var chatMsg = new ClientMsg <MsgClientChatMsg>(packetMsg);

            byte[] msgData = chatMsg.Payload.ToArray();

#if STATIC_CALLBACKS
            var callback = new ChatMsgCallback(Client, chatMsg.Body, msgData);
            SteamClient.PostCallback(callback);
#else
            var callback = new ChatMsgCallback(chatMsg.Body, msgData);
            this.Client.PostCallback(callback);
#endif
        }
Example #25
0
        void HandleLogOnResponse(IPacketMsg packetMsg)
        {
            if (packetMsg.IsProto)
            {
                var logonResp = new ClientMsgProtobuf <CMsgClientLogonResponse>(packetMsg);

                var callback = new LoggedOnCallback(logonResp.Body);
                this.Client.PostCallback(callback);
            }
            else
            {
                var logonResp = new ClientMsg <MsgClientLogOnResponse>(packetMsg);

                var callback = new LoggedOnCallback(logonResp.Body);
                this.Client.PostCallback(callback);
            }
        }
Example #26
0
        void HandleLoggedOff(IPacketMsg packetMsg)
        {
            EResult result = EResult.Invalid;

            if (packetMsg.IsProto)
            {
                var loggedOff = new ClientMsgProtobuf <CMsgClientLoggedOff>(packetMsg);
                result = ( EResult )loggedOff.Body.eresult;
            }
            else
            {
                var loggedOff = new ClientMsg <MsgClientLoggedOff>(packetMsg);
                result = loggedOff.Body.Result;
            }

            this.Client.PostCallback(new LoggedOffCallback(result));
        }
Example #27
0
        /// <summary>
        /// Attempts to join a chat room.
        /// </summary>
        /// <param name="steamId">The SteamID of the chat room.</param>
        public void JoinChat(SteamID steamId)
        {
            SteamID chatId = steamId.ConvertToUInt64(); // copy the steamid so we don't modify it

            var joinChat = new ClientMsg <MsgClientJoinChat>();

            if (chatId.IsClanAccount)
            {
                // this steamid is incorrect, so we'll fix it up
                chatId.AccountInstance = ( uint )SteamID.ChatInstanceFlags.Clan;
                chatId.AccountType     = EAccountType.Chat;
            }

            joinChat.Body.SteamIdChat = chatId;

            Client.Send(joinChat);
        }
Example #28
0
        /// <summary>
        /// Ignores or unignores a friend on Steam.
        /// Results are returned in a <see cref="IgnoreFriendCallback"/>.
        /// The returned <see cref="AsyncJob{T}"/> can also be awaited to retrieve the callback result.
        /// </summary>
        /// <param name="steamId">The SteamID of the friend to ignore or unignore.</param>
        /// <param name="setIgnore">if set to <c>true</c>, the friend will be ignored; otherwise, they will be unignored.</param>
        /// <returns>The Job ID of the request. This can be used to find the appropriate <see cref="IgnoreFriendCallback"/>.</returns>
        public AsyncJob <IgnoreFriendCallback> IgnoreFriend(SteamID steamId, bool setIgnore = true)
        {
            if (steamId == null)
            {
                throw new ArgumentNullException(nameof(steamId));
            }

            var ignore = new ClientMsg <MsgClientSetIgnoreFriend>();

            ignore.SourceJobID = Client.GetNextJobID();

            ignore.Body.MySteamId     = Client.SteamID;
            ignore.Body.Ignore        = ( byte )(setIgnore ? 1 : 0);
            ignore.Body.SteamIdFriend = steamId;

            this.Client.Send(ignore);

            return(new AsyncJob <IgnoreFriendCallback>(this.Client, ignore.SourceJobID));
        }
Example #29
0
        /// <summary>
        /// Unbans the specified SteamID from the given chat room.
        /// </summary>
        /// <param name="steamIdChat">The SteamID of chat room to unban the member from.</param>
        /// <param name="steamIdMember">The SteamID of the member to unban from the chat.</param>
        public void UnbanChatMember(SteamID steamIdChat, SteamID steamIdMember)
        {
            SteamID chatId = steamIdChat.ConvertToUInt64(); // copy the steamid so we don't modify it

            var unbanMember = new ClientMsg <MsgClientChatAction>();

            if (chatId.IsClanAccount)
            {
                // this steamid is incorrect, so we'll fix it up
                chatId.AccountInstance = ( uint )SteamID.ChatInstanceFlags.Clan;
                chatId.AccountType     = EAccountType.Chat;
            }

            unbanMember.Body.SteamIdChat        = chatId;
            unbanMember.Body.SteamIdUserToActOn = steamIdMember;

            unbanMember.Body.ChatAction = EChatAction.UnBan;

            this.Client.Send(unbanMember);
        }
Example #30
0
        /// <summary>
        /// Attempts to join a chat room.
        /// </summary>
        /// <param name="steamId">The SteamID of the chat room.</param>
        public void JoinChat(SteamID steamId)
        {
            if (steamId == null)
            {
                throw new ArgumentNullException(nameof(steamId));
            }

            SteamID chatId = steamId.ConvertToUInt64(); // copy the steamid so we don't modify it

            var joinChat = new ClientMsg <MsgClientJoinChat>();

            if (chatId.IsClanAccount)
            {
                chatId = chatId.ToChatID();
            }

            joinChat.Body.SteamIdChat = chatId;

            Client.Send(joinChat);
        }