public static VideoFileMeta Load(XElement Element) { try { VideoFileMeta meta = new VideoFileMeta(); // load video track if (Element.Element("streamdetails").Element("video") != null) { VideoTrack video = new VideoTrack(); if (NfoLoader.Load <VideoTrack>(video, Element.Element("streamdetails").Element("video"))) { meta.Video = video; } } // load audio tracks foreach (XElement eleAudio in Element.Element("streamdetails").Elements("audio")) { AudioTrack audio = new AudioTrack(); if (NfoLoader.Load <AudioTrack>(audio, eleAudio)) { meta.Audio = meta.Audio.Union(new AudioTrack[] { audio }).ToArray(); } } // load subtitle tracks foreach (XElement eleSubtitle in Element.Element("streamdetails").Elements("subtitle")) { SubtitleTrack subtitle = new SubtitleTrack(); if (NfoLoader.Load <SubtitleTrack>(subtitle, eleSubtitle)) { meta.Subtitles = meta.Subtitles.Union(new SubtitleTrack[] { subtitle }).ToArray(); } } return(meta); } catch (Exception) { return(null); } }
public static VideoFileMeta Load(XElement Element) { try { VideoFileMeta meta = new VideoFileMeta(); // load video track if (Element.Element("streamdetails").Element("video") != null) { VideoTrack video = new VideoTrack(); if (NfoLoader.Load<VideoTrack>(video, Element.Element("streamdetails").Element("video"))) meta.Video = video; } // load audio tracks foreach(XElement eleAudio in Element.Element("streamdetails").Elements("audio")) { AudioTrack audio = new AudioTrack(); if (NfoLoader.Load<AudioTrack>(audio, eleAudio)) meta.Audio = meta.Audio.Union(new AudioTrack[] { audio }).ToArray(); } // load subtitle tracks foreach (XElement eleSubtitle in Element.Element("streamdetails").Elements("subtitle")) { SubtitleTrack subtitle = new SubtitleTrack(); if (NfoLoader.Load<SubtitleTrack>(subtitle, eleSubtitle)) meta.Subtitles = meta.Subtitles.Union(new SubtitleTrack[] { subtitle }).ToArray(); } return meta; } catch (Exception) { return null; } }