public MkvInfo(XDocument source) { // Build up our data model to work with here... and then create a CLI utility that works everywhere. :) // Probably can just make it take one file and then xargs them together in a chain var root = source.XPathSelectElement("MKVInfo/SegmentSize/SegmentInformation"); var outsideRoot = source.XPathSelectElement("MKVInfo/SegmentSize"); if (root != null) { Writer = root.Element("WritingApplication")?.Value; // Create attachments Attachments = new List <MkvAttachment>(); var attachmentNodes = outsideRoot.Element("Attachments").Elements(); foreach (var attachmentNode in attachmentNodes) { Attachments.Add(new MkvAttachment(attachmentNode)); } // Create chapters var chapters = outsideRoot.Element("Chapters"); if (chapters != null) { Chapters = new Chapter(chapters); } SegmentUid = new MkvSegmentUid(source.XPathSelectElement("MKVInfo/SegmentSize/SegmentInformation/SegmentUID").Value); } else { throw new Exception("Failed to find the node that was needed."); } }
public bool IsSame(MkvSegmentUid segment) { if (segment == null) { return(false); } return(segment._hexString == this._hexString); }
public ChapterAtom(XContainer chapterNode) { ChapterTimecodeStart = chapterNode.Element("ChapterTimeStart")?.Value; ChapterTimecodeEnd = chapterNode.Element("ChapterTimeEnd")?.Value; ChapterName = chapterNode.Element("ChapterDisplay")?.Element("ChapterString")?.Value; ChapterLanguage = chapterNode.Element("ChapterDisplay")?.Element("ChapterLanguage")?.Value; var segmentNode = chapterNode.Element("ChapterSegmentUID"); if (segmentNode != null) { ReferencedSegmentUid = new MkvSegmentUid(segmentNode.Value); } }