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

            friendBecameOffline.InitializeStandartFields(response);
            friendBecameOffline.UserId = -((long)response[1]);
            friendBecameOffline.Extra  = (ulong)response[2];
            friendBecameOffline.Ts     = (ulong)response[3];

            return(friendBecameOffline);
        }
Example #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;
 }