Esempio n. 1
0
        /// <summary> Разобрать из json. </summary>
        /// <param name="response">Ответ сервера.</param>
        /// <returns></returns>
        public static ReadAllIncomingMessages FromJson(VkResponseArray response)
        {
            var readAllIncomingMessages = new ReadAllIncomingMessages();

            readAllIncomingMessages.InitializeStandartFields(response);
            return(readAllIncomingMessages);
        }
Esempio n. 2
0
 /// <summary>Разобрать из json.</summary>
 /// <param name="response">Ответ сервера.</param>
 /// <returns></returns>
 public static Update FromJson(VkResponseArray response)
 {
     var update = new Update();
       var code = (int) response.First();
       switch (code)
       {
     case 4:
       update.Type = typeof (NewMessage);
       update.NewMessage = NewMessage.FromJson(response);
       break;
     case 5:
       update.Type = typeof (EditMessage);
       update.EditMessage = EditMessage.FromJson(response);
       break;
     case 6:
       update.Type = typeof (ReadAllIncomingMessages);
       update.ReadAllIncomingMessages = ReadAllIncomingMessages.FromJson(response);
       break;
     case 7:
       update.Type = typeof (ReadAllOutcomingMessages);
       update.ReadAllOutcomingMessages = ReadAllOutcomingMessages.FromJson(response);
       break;
     case 8:
       update.Type = typeof (FriendBecameOnline);
       update.FriendBecameOnline = FriendBecameOnline.FromJson(response);
       break;
     case 9:
       update.Type = typeof (FriendBecameOffline);
       update.FriendBecameOffline = FriendBecameOffline.FromJson(response);
       break;
     case 61:
       update.Type = typeof (UserTypingInPrivateDialog);
       update.UserTypingInPrivateDialog = UserTypingInPrivateDialog.FromJson(response);
       break;
     default:
       throw new InvalidParameterException($"The type '{(object) code}' of event is not defined.");
       }
       return update;
 }