This object represents one size of a photo or a file / sticker thumbnail.
        private void Parse(JObject jsonObject)
        {
            TotalCount = jsonObject["total_count"].Value <int>();
            var arrayOfArrays = jsonObject["photos"].Value <JArray>();

            Photos =
                arrayOfArrays.Cast <JArray>().Select(array => PhotoSizeInfo.ParseArray(array)).ToArray();
        }
Example #2
0
 private void Parse(JObject jsonObject)
 {
     FileId = jsonObject["file_id"].Value <string>();
     Width  = jsonObject["width"].Value <int>();
     Height = jsonObject["height"].Value <int>();
     Thumb  = new PhotoSizeInfo(jsonObject["thumb"].Value <JObject>());
     if (jsonObject["file_size"] != null)
     {
         FileSize = jsonObject["file_size"].Value <int>();
     }
 }
Example #3
0
 private void Parse(JObject jsonObject)
 {
     FileId   = jsonObject["file_id"].Value <string>();
     Width    = jsonObject["width"].Value <int>();
     Height   = jsonObject["height"].Value <int>();
     Duration = jsonObject["duration"].Value <int>();
     Thumb    = new PhotoSizeInfo(jsonObject["thumb"].Value <JObject>());
     if (jsonObject["mime_type"] != null)
     {
         MimeType = jsonObject["mime_type"].Value <string>();
     }
     if (jsonObject["file_size"] != null)
     {
         FileSize = jsonObject["file_size"].Value <int>();
     }
     if (jsonObject["caption"] != null)
     {
         Caption = jsonObject["caption"].Value <string>();
     }
 }
Example #4
0
 private void Parse(JObject jsonObject)
 {
     FileId = jsonObject["file_id"].Value <string>();
     if (jsonObject["thumb"] != null)
     {
         Thumb = new PhotoSizeInfo(jsonObject["thumb"].Value <JObject>());
     }
     if (jsonObject["file_name"] != null)
     {
         FileName = jsonObject["file_name"].Value <string>();
     }
     if (jsonObject["mime_type"] != null)
     {
         MimeType = jsonObject["mime_type"].Value <string>();
     }
     if (jsonObject["file_size"] != null)
     {
         FileSize = jsonObject["file_size"].Value <int>();
     }
 }
Example #5
0
 private void Parse(JObject jsonObject)
 {
     FileId = jsonObject["file_id"].Value<string>();
     if (jsonObject["thumb"] != null)
         Thumb = new PhotoSizeInfo(jsonObject["thumb"].Value<JObject>());
     if (jsonObject["file_name"] != null)
         FileName = jsonObject["file_name"].Value<string>();
     if (jsonObject["mime_type"] != null)
         MimeType = jsonObject["mime_type"].Value<string>();
     if (jsonObject["file_size"] != null)
         FileSize = jsonObject["file_size"].Value<int>();
 }
Example #6
0
 private void Parse(JObject jsonObject)
 {
     FileId = jsonObject["file_id"].Value<string>();
     Width = jsonObject["width"].Value<int>();
     Height = jsonObject["height"].Value<int>();
     Thumb = new PhotoSizeInfo(jsonObject["thumb"].Value<JObject>());
     if (jsonObject["file_size"] != null)
         FileSize = jsonObject["file_size"].Value<int>();
 }
Example #7
0
 private void Parse(JObject jsonObject)
 {
     FileId = jsonObject["file_id"].Value<string>();
     Width = jsonObject["width"].Value<int>();
     Height = jsonObject["height"].Value<int>();
     Duration = jsonObject["duration"].Value<int>();
     Thumb = new PhotoSizeInfo(jsonObject["thumb"].Value<JObject>());
     if (jsonObject["mime_type"] != null)
         MimeType = jsonObject["mime_type"].Value<string>();
     if (jsonObject["file_size"] != null)
         FileSize = jsonObject["file_size"].Value<int>();
     if (jsonObject["caption"] != null)
         Caption = jsonObject["caption"].Value<string>();
 }
Example #8
0
 private void Parse(JObject jsonObject)
 {
     MessageId = jsonObject["message_id"].Value <int>();
     From      = new UserInfo(jsonObject["from"].Value <JObject>());
     DateUnix  = jsonObject["date"].Value <int>();
     Date      = DateUnix.ToDateTime();
     Chat      = ParseChat(jsonObject["chat"].Value <JObject>());
     if (jsonObject["forward_from"] != null)
     {
         ForwardFrom = new UserInfo(jsonObject["forward_from"].Value <JObject>());
     }
     if (jsonObject["forward_date"] != null)
     {
         ForwardDateUnix = jsonObject["forward_date"].Value <int>();
         ForwardDate     = ForwardDateUnix.ToDateTime();
     }
     if (jsonObject["reply_to_message"] != null)
     {
         ReplyToMessage = new MessageInfo(jsonObject["reply_to_message"].Value <JObject>());
     }
     if (jsonObject["text"] != null)
     {
         Text = jsonObject["text"].Value <string>();
     }
     if (jsonObject["audio"] != null)
     {
         Audio = new AudioInfo(jsonObject["audio"].Value <JObject>());
     }
     if (jsonObject["document"] != null)
     {
         Document = new DocumentInfo(jsonObject["document"].Value <JObject>());
     }
     if (jsonObject["photo"] != null)
     {
         Photo = PhotoSizeInfo.ParseArray(jsonObject["photo"].Value <JArray>());
     }
     if (jsonObject["sticker"] != null)
     {
         Sticker = new StickerInfo(jsonObject["sticker"].Value <JObject>());
     }
     if (jsonObject["video"] != null)
     {
         Video = new VideoInfo(jsonObject["video"].Value <JObject>());
     }
     if (jsonObject["contact"] != null)
     {
         Contact = new ContactInfo(jsonObject["contact"].Value <JObject>());
     }
     if (jsonObject["location"] != null)
     {
         Location = new LocationInfo(jsonObject["location"].Value <JObject>());
     }
     if (jsonObject["new_chat_participant"] != null)
     {
         NewChatParticipant = new UserInfo(jsonObject["new_chat_participant"].Value <JObject>());
     }
     if (jsonObject["left_chat_participant"] != null)
     {
         LeftChatParticipant = new UserInfo(jsonObject["left_chat_participant"].Value <JObject>());
     }
     if (jsonObject["new_chat_title"] != null)
     {
         NewChatTitle = jsonObject["new_chat_title"].Value <string>();
     }
     if (jsonObject["new_chat_photo"] != null)
     {
         NewChatPhoto = PhotoSizeInfo.ParseArray(jsonObject["new_chat_photo"].Value <JArray>());
     }
     if (jsonObject["delete_chat_photo"] != null)
     {
         DeleteChatPhoto = true;
     }
     if (jsonObject["group_chat_created"] != null)
     {
         GroupChatCreated = true;
     }
 }