diff --git a/ArchiSteamFarm/ArchiHandler.cs b/ArchiSteamFarm/ArchiHandler.cs index cb19c1efd..e9add55f2 100644 --- a/ArchiSteamFarm/ArchiHandler.cs +++ b/ArchiSteamFarm/ArchiHandler.cs @@ -71,35 +71,43 @@ namespace ArchiSteamFarm { switch (packetMsg.MsgType) { case EMsg.ClientCommentNotifications: - HandleCommentNotifications(packetMsg); + ClientMsgProtobuf commentNotifications = new ClientMsgProtobuf(packetMsg); + Client.PostCallback(new UserNotificationsCallback(packetMsg.TargetJobID, commentNotifications.Body)); break; case EMsg.ClientItemAnnouncements: - HandleItemAnnouncements(packetMsg); + ClientMsgProtobuf itemAnnouncements = new ClientMsgProtobuf(packetMsg); + Client.PostCallback(new UserNotificationsCallback(packetMsg.TargetJobID, itemAnnouncements.Body)); break; case EMsg.ClientPlayingSessionState: - HandlePlayingSessionState(packetMsg); + ClientMsgProtobuf playingSessionState = new ClientMsgProtobuf(packetMsg); + Client.PostCallback(new PlayingSessionStateCallback(packetMsg.TargetJobID, playingSessionState.Body)); break; case EMsg.ClientPurchaseResponse: - HandlePurchaseResponse(packetMsg); + ClientMsgProtobuf purchaseResponse = new ClientMsgProtobuf(packetMsg); + Client.PostCallback(new PurchaseResponseCallback(packetMsg.TargetJobID, purchaseResponse.Body)); break; case EMsg.ClientRedeemGuestPassResponse: - HandleRedeemGuestPassResponse(packetMsg); + ClientMsgProtobuf redeemGuestPassResponse = new ClientMsgProtobuf(packetMsg); + Client.PostCallback(new RedeemGuestPassResponseCallback(packetMsg.TargetJobID, redeemGuestPassResponse.Body)); break; case EMsg.ClientSharedLibraryLockStatus: - HandleSharedLibraryLockStatus(packetMsg); + ClientMsgProtobuf sharedLibraryLockStatus = new ClientMsgProtobuf(packetMsg); + Client.PostCallback(new SharedLibraryLockStatusCallback(packetMsg.TargetJobID, sharedLibraryLockStatus.Body)); break; case EMsg.ClientUserNotifications: - HandleUserNotifications(packetMsg); + ClientMsgProtobuf userNotifications = new ClientMsgProtobuf(packetMsg); + Client.PostCallback(new UserNotificationsCallback(packetMsg.TargetJobID, userNotifications.Body)); break; case EMsg.ClientVanityURLChangedNotification: - HandleVanityURLChangedNotification(packetMsg); + ClientMsgProtobuf vanityURLChangedNotification = new ClientMsgProtobuf(packetMsg); + Client.PostCallback(new VanityURLChangedCallback(packetMsg.TargetJobID, vanityURLChangedNotification.Body)); break; } @@ -633,94 +641,6 @@ namespace ArchiSteamFarm { Client.Send(request); } - private void HandleCommentNotifications(IPacketMsg packetMsg) { - if (packetMsg == null) { - ArchiLogger.LogNullError(nameof(packetMsg)); - - return; - } - - ClientMsgProtobuf response = new ClientMsgProtobuf(packetMsg); - Client.PostCallback(new UserNotificationsCallback(packetMsg.TargetJobID, response.Body)); - } - - private void HandleItemAnnouncements(IPacketMsg packetMsg) { - if (packetMsg == null) { - ArchiLogger.LogNullError(nameof(packetMsg)); - - return; - } - - ClientMsgProtobuf response = new ClientMsgProtobuf(packetMsg); - Client.PostCallback(new UserNotificationsCallback(packetMsg.TargetJobID, response.Body)); - } - - private void HandlePlayingSessionState(IPacketMsg packetMsg) { - if (packetMsg == null) { - ArchiLogger.LogNullError(nameof(packetMsg)); - - return; - } - - ClientMsgProtobuf response = new ClientMsgProtobuf(packetMsg); - Client.PostCallback(new PlayingSessionStateCallback(packetMsg.TargetJobID, response.Body)); - } - - private void HandlePurchaseResponse(IPacketMsg packetMsg) { - if (packetMsg == null) { - ArchiLogger.LogNullError(nameof(packetMsg)); - - return; - } - - ClientMsgProtobuf response = new ClientMsgProtobuf(packetMsg); - Client.PostCallback(new PurchaseResponseCallback(packetMsg.TargetJobID, response.Body)); - } - - private void HandleRedeemGuestPassResponse(IPacketMsg packetMsg) { - if (packetMsg == null) { - ArchiLogger.LogNullError(nameof(packetMsg)); - - return; - } - - ClientMsgProtobuf response = new ClientMsgProtobuf(packetMsg); - Client.PostCallback(new RedeemGuestPassResponseCallback(packetMsg.TargetJobID, response.Body)); - } - - private void HandleSharedLibraryLockStatus(IPacketMsg packetMsg) { - if (packetMsg == null) { - ArchiLogger.LogNullError(nameof(packetMsg)); - - return; - } - - ClientMsgProtobuf response = new ClientMsgProtobuf(packetMsg); - Client.PostCallback(new SharedLibraryLockStatusCallback(packetMsg.TargetJobID, response.Body)); - } - - private void HandleUserNotifications(IPacketMsg packetMsg) { - if (packetMsg == null) { - ArchiLogger.LogNullError(nameof(packetMsg)); - - return; - } - - ClientMsgProtobuf response = new ClientMsgProtobuf(packetMsg); - Client.PostCallback(new UserNotificationsCallback(packetMsg.TargetJobID, response.Body)); - } - - private void HandleVanityURLChangedNotification(IPacketMsg packetMsg) { - if (packetMsg == null) { - ArchiLogger.LogNullError(nameof(packetMsg)); - - return; - } - - ClientMsgProtobuf response = new ClientMsgProtobuf(packetMsg); - Client.PostCallback(new VanityURLChangedCallback(packetMsg.TargetJobID, response.Body)); - } - [SuppressMessage("ReSharper", "MemberCanBeInternal")] public sealed class PurchaseResponseCallback : CallbackMsg { public readonly Dictionary Items;