private void btnAddDisc_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "CUE files (*.cue)|*.cue|ISO files (*.iso)|*.iso"; ofd.CheckFileExists = true; ofd.CheckPathExists = true; ofd.Multiselect = false; if (ofd.ShowDialog() != DialogResult.OK) { return; } Disc disc = Disc.FromCuePath(ofd.FileName, new CueBinPrefs()); string baseName = Path.GetFileName(ofd.FileName); ListViewItem lvi = new ListViewItem(baseName); DiscRecord dr = new DiscRecord(); dr.Disc = disc; dr.BaseName = baseName; lvi.Tag = dr; lvDiscs.SelectedIndices.Clear(); lvDiscs.Items.Add(lvi); lvDiscs.Items[lvDiscs.Items.Count - 1].Selected = true; }
private void lvDiscs_SelectedIndexChanged(object sender, EventArgs e) { UnbindDisc(); if (lvDiscs.SelectedIndices.Count != 0) { DiscRecord dr = (DiscRecord)lvDiscs.SelectedItems[0].Tag; BindDisc(dr); } }
void BindDisc(DiscRecord discRecord) { Disc disc = discRecord.Disc; boundDiscRecord = discRecord; DiscStructure toc = disc.ReadStructure(); boundDisc = disc; lblSessions.Text = toc.Sessions.Count.ToString(); lblTracks.Text = toc.Sessions.Sum((ses) => ses.Tracks.Count).ToString(); lblSectors.Text = string.Format("{0} ({1})", toc.LengthInSectors, toc.FriendlyLength.Value); lblSize.Text = string.Format("{0:0.00} MB", toc.BinarySize / 1024.0 / 1024.0); btnExportCue.Enabled = true; UpdateCue(); }
private void btnAddDisc_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "CUE files (*.cue)|*.cue|ISO files (*.iso)|*.iso"; ofd.CheckFileExists = true; ofd.CheckPathExists = true; ofd.Multiselect = false; if (ofd.ShowDialog() != DialogResult.OK) return; Disc disc = Disc.FromCuePath(ofd.FileName, new CueBinPrefs()); string baseName = Path.GetFileName(ofd.FileName); ListViewItem lvi = new ListViewItem(baseName); DiscRecord dr = new DiscRecord(); dr.Disc = disc; dr.BaseName = baseName; lvi.Tag = dr; lvDiscs.SelectedIndices.Clear(); lvDiscs.Items.Add(lvi); lvDiscs.Items[lvDiscs.Items.Count-1].Selected = true; }