public HitboxVideo(JToken video) { MediaUserName = (string)video["media_user_name"]; MediaId = (int)video["media_id"]; MediaFile = (string)video["media_file"]; MediaUserId = (int)video["media_user_id"]; MediaDateAdded = DateTime.Parse((string)video["media_date_added"]); MediaTitle = (string)video["media_title"]; MediaDescription = (string)video["media_description"]; MediaGame = (string)video["category_name"]; try { MediaDuration = (double)video["media_duration"]; } catch (Exception) { MediaDuration = 0; } string profileString = (string)video["media_profiles"]; JToken profiles = JToken.Parse(profileString); MediaProfiles = new HitboxMediaProfile[profiles.Count()]; for (int i = 0; i < MediaProfiles.Length; ++i) { MediaProfiles[i] = new HitboxMediaProfile(profiles[i]); } MediaTypeId = (int)video["media_type_id"]; }
public HitboxVideo( JToken video ) { MediaUserName = (string)video["media_user_name"]; MediaId = (int)video["media_id"]; MediaFile = (string)video["media_file"]; MediaUserId = (int)video["media_user_id"]; MediaDateAdded = DateTime.Parse( (string)video["media_date_added"] ); MediaTitle = (string)video["media_title"]; MediaDescription = (string)video["media_description"]; MediaGame = (string)video["category_name"]; MediaDuration = (double)video["media_duration"]; string profileString = (string)video["media_profiles"]; JToken profiles = JToken.Parse( profileString ); MediaProfiles = new HitboxMediaProfile[profiles.Count()]; for ( int i = 0; i < MediaProfiles.Length; ++i ) { MediaProfiles[i] = new HitboxMediaProfile( profiles[i] ); } MediaTypeId = (int)video["media_type_id"]; }