private void QuickOpen(string dir) { this.txtFolder.Text = dir; this.flowDiscs.Controls.Clear(); if (string.IsNullOrEmpty(dir)) { this.flowDiscs.Controls.Add(new ErrorItem("Please choose a folder containing your disc backups.")); return; } try { var discs = new List <Disc>(); var dirs = new DirectoryPathAbsolute(dir).ChildrenDirectoriesPath; foreach (var d in dirs) { if (Directory.Exists(Path.Combine(d.Path, "VIDEO_TS"))) { discs.Add(new Disc(d.Path, "DVD")); } else if (Directory.Exists(Path.Combine(Path.Combine(d.Path, "BDMV"), "PLAYLIST"))) { discs.Add(new Disc(d.Path, "Bluray")); } else if (Directory.Exists(Path.Combine(d.Path, "ADV_OBJ"))) { discs.Add(new Disc(d.Path, "HDDVD")); } } foreach (var disc in discs) { var di = new DiscItem(disc); di.Opened += (s, e) => { this.DiscPath = ((Disc)((DiscItem)s).Tag).Path; this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }; this.flowDiscs.Controls.Add(di); } if (discs.Count == 0) { this.flowDiscs.Controls.Add(new ErrorItem("No discs found. Please select your backup folder containing discs.")); } } catch (Exception ex) { this.flowDiscs.Controls.Add(new ErrorItem(ex.Message)); } }
private void QuickOpen(string dir) { this.txtFolder.Text = dir; this.flowDiscs.Controls.Clear(); if (string.IsNullOrEmpty(dir)) { this.flowDiscs.Controls.Add(new ErrorItem("Please choose a folder containing your disc backups.")); return; } try { var discs = new List<Disc>(); var dirs = new DirectoryPathAbsolute(dir).ChildrenDirectoriesPath; foreach (var d in dirs) { if (Directory.Exists(Path.Combine(d.Path, "VIDEO_TS"))) discs.Add(new Disc(d.Path, "DVD")); else if (Directory.Exists(Path.Combine(Path.Combine(d.Path, "BDMV"), "PLAYLIST"))) discs.Add(new Disc(d.Path, "Bluray")); else if (Directory.Exists(Path.Combine(d.Path, "ADV_OBJ"))) discs.Add(new Disc(d.Path, "HDDVD")); } foreach (var disc in discs) { var di = new DiscItem(disc); di.Opened += (s, e) => { this.DiscPath = ((Disc)((DiscItem)s).Tag).Path; this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }; this.flowDiscs.Controls.Add(di); } if (discs.Count == 0) { this.flowDiscs.Controls.Add(new ErrorItem("No discs found. Please select your backup folder containing discs.")); } } catch (Exception ex) { this.flowDiscs.Controls.Add(new ErrorItem(ex.Message)); } }