public StreamSelectDialog(ChapterExtractor extractor) { InitializeComponent(); extractor.StreamDetected += (sender, arg) => { listBox1.Items.Add(arg.ProgramChain); }; extractor.ChaptersLoaded += (sender, arg) => { for (int i = 0; i < listBox1.Items.Count; i++) { if (((ChapterInfo)listBox1.Items[i]).SourceName == arg.ProgramChain.SourceName) { listBox1.Items[i] = arg.ProgramChain; break; } } }; extractor.ExtractionComplete += (sender, arg) => { List<ChapterInfo> list = new List<ChapterInfo>(listBox1.Items.Cast<ChapterInfo>()); list = list.OrderByDescending(p => p.Duration).ToList(); listBox1.Items.Clear(); listBox1.Items.AddRange(list.ToArray()); }; }
public StreamSelectDialog(ChapterExtractor extractor) { InitializeComponent(); this.MinimumSize = new Size(700, 400); extracted = new List <ChapterInfo>(); extractor.StreamDetected += (sender, arg) => { extracted.Add(arg.ProgramChain); if (!Hidden(arg.ProgramChain)) { listBox1.Items.Add(arg.ProgramChain); } }; extractor.ChaptersLoaded += (sender, arg) => { for (int i = 0; i < listBox1.Items.Count; i++) { if (((ChapterInfo)listBox1.Items[i]).SourceName == arg.ProgramChain.SourceName) { listBox1.Items[i] = arg.ProgramChain; break; } } }; extractor.ExtractionComplete += (sender, arg) => { Reload(); }; }
public StreamSelectDialog(ChapterExtractor extractor) { InitializeComponent(); extracted = new List<ChapterInfo>(); extractor.StreamDetected += (sender, arg) => { extracted.Add(arg.ProgramChain); if (!Hidden(arg.ProgramChain)) listBox1.Items.Add(arg.ProgramChain); }; extractor.ChaptersLoaded += (sender, arg) => { for (int i = 0; i < listBox1.Items.Count; i++) { if (((ChapterInfo)listBox1.Items[i]).SourceName == arg.ProgramChain.SourceName) { listBox1.Items[i] = arg.ProgramChain; break; } } }; extractor.ExtractionComplete += (sender, arg) => { Reload(); }; }
private void OpenDisc(string path) { Cursor = Cursors.WaitCursor; tsslStatus.Text = "Scanning for chapters..."; try { ChapterExtractor ex = Directory.Exists(Path.Combine(path, "VIDEO_TS")) ? new DvdExtractor() as ChapterExtractor : Directory.Exists(Path.Combine(path, "ADV_OBJ")) ? new HddvdExtractor() as ChapterExtractor : Directory.Exists(Path.Combine(Path.Combine(path, "BDMV"), "PLAYLIST")) ? new BlurayExtractor() as ChapterExtractor : null; if (ex == null) { throw new Exception("The location was not detected as DVD, HD-DVD or Blu-Ray."); } using (StreamSelectDialog frm = new StreamSelectDialog(ex)) { ex.GetStreams(path); if (frm.ShowDialog(this) == DialogResult.OK) { Settings.Default.LastOpenDir = new DirectoryPathAbsolute(path).Path; Settings.Default.Save(); pgc = frm.ProgramChain; if (pgc.FramesPerSecond == 0) { pgc.FramesPerSecond = Settings.Default.DefaultFps; } if (pgc.LangCode == null) { pgc.LangCode = Settings.Default.DefaultLangCode; } FreshChapterView(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); Trace.WriteLine(ex); tsslStatus.Text = "Could not load chapters from disc."; } finally { Cursor = Cursors.Default; } }
public static List <ChapterInfo> ReadPgcListFromFile(string file) { ChapterExtractor ex = null; string fileLower = file.ToLower(); if (fileLower.EndsWith("txt")) { ex = new TextExtractor(); } else if (fileLower.EndsWith("xpl")) { ex = new XplExtractor(); } else if (fileLower.EndsWith("ifo")) { ex = new Ifo2Extractor(); } else if (fileLower.EndsWith("mpls")) { ex = new MplsExtractor(); } else if (fileLower.EndsWith("xml")) { throw new Exception("Format not yet supported."); } else if (fileLower.EndsWith("chapters")) { List <ChapterInfo> ret = new List <ChapterInfo>(); ret.Add(ChapterInfo.Load(file)); return(ret); } else { throw new Exception("The selected file is not a recognized format."); } return(ex.GetStreams(file)); }