public Media(JsonData media) { if (media == null) { return; } Image = new MediaImage(media.GetValue <JsonData>("image")); MediaID = media.GetValue <string>("media_id_string").GetULong(0); Size = media.GetValue <int>("size"); JsonData video = media.GetValue <JsonData>("video"); VideoType = video.GetValue <string>("video_type"); ExpiresAfterSeconds = media.GetValue <int>("expires_after_secs"); ProcessingInfo = new MediaProcessingInfo(media.GetValue <JsonData>("processing_info")); }
public Media(JsonElement media) { if (media.IsNull()) { return; } media.TryGetProperty("image", out JsonElement imageValue); Image = new MediaImage(imageValue); MediaID = (media.GetString("media_id_string") ?? "0").GetULong(); Size = media.GetInt("size"); media.TryGetProperty("video", out JsonElement video); VideoType = video.GetString("video_type"); ExpiresAfterSeconds = media.GetInt("expires_after_secs"); media.TryGetProperty("processing_info", out JsonElement processingInfoValue); ProcessingInfo = new MediaProcessingInfo(processingInfoValue); }