public static void DropInFiles(string[] files, ListView fileList) { var acceptall = false; var nochanges = false; const string YTA = "Yes To All"; const string nostr = "No"; const string noallstr = "No To All"; const string yesstr = "Yes"; const string cancelstr = "Cancel"; var l = new List <string>(); l.Add(YTA); l.Add(yesstr); l.Add(nostr); l.Add(noallstr); l.Add(cancelstr); foreach (var s in files) { var LVI = initLVI(fileList); LVI.Text = fileList.Items.Count.ToString(); LVI.Name = LVI.Text; LVI.SubItems.Add(s); Mp3File mf = null; var retrycount = 0; var retrymax = 10; retry: try { mf = new Mp3File(s); } catch (Exception exp) { retrycount++; if (retrycount >= retrymax) { MessageBox.Show("Error opening file:" + exp.ToString()); var DR = MessageBox.Show("Do you want to continue?", "option", MessageBoxButtons.YesNo); if (DR == DialogResult.No) { return; } continue; } //for a certain period, retry Thread.Sleep(100); goto retry; } LVI.Tag = mf; var sas = mf.Audio; sas.ScanWholeFile(); //clean files on entry var newData = new changes.TagHandlerUpdate(mf); if (nochanges == false) { Music_File_Info_Editor.changes.cleanMP3(newData); var changes = Music_File_Info_Editor.changes.areThereDifferences(mf, newData); var makechanges = true; if (changes && acceptall == false) { var tt = "The file:" + mf.FileName + " has a title/album/artist with blank characters at the start or end, or has multiple white space. Do you wish to fix these?"; var MMB = new MultipleMessageBox("option", tt, l); MMB.ShowDialog(); if (MMB.IsSet == false) { return; } switch (MMB.Result) { case cancelstr: return; case nostr: makechanges = false; break; case YTA: acceptall = true; break; case noallstr: makechanges = false; nochanges = true; break; } } if (makechanges) { if (Music_File_Info_Editor.changes.makeChangesAndContinue(newData, mf) == false) { return; } } } //only add if the name isnt there already var add = true; foreach (ListViewItem tt in fileList.Items) { var s1 = tt.SubItems[ListViewExtras.GetColumnNumber(fileList, "Path")].Text; if (s1.Equals(mf.FileName)) { add = false; break; } } if (add) { fileList.Items.Add(LVI); } } RefreshInfo(fileList); ListViewExtras.AutoResize(fileList); }
public static void DropInFiles(string[] files, ListView fileList) { var acceptall = false; var nochanges = false; const string YTA = "Yes To All"; const string nostr = "No"; const string noallstr = "No To All"; const string yesstr = "Yes"; const string cancelstr = "Cancel"; var l = new List<string>(); l.Add(YTA); l.Add(yesstr); l.Add(nostr); l.Add(noallstr); l.Add(cancelstr); foreach (var s in files) { var LVI = initLVI(fileList); LVI.Text = fileList.Items.Count.ToString(); LVI.Name = LVI.Text; LVI.SubItems.Add(s); Mp3File mf = null; var retrycount = 0; var retrymax = 10; retry: try { mf = new Mp3File(s); } catch (Exception exp) { retrycount++; if (retrycount >= retrymax) { MessageBox.Show("Error opening file:" + exp.ToString()); var DR = MessageBox.Show("Do you want to continue?", "option", MessageBoxButtons.YesNo); if (DR == DialogResult.No) return; continue; } //for a certain period, retry Thread.Sleep(100); goto retry; } LVI.Tag = mf; var sas = mf.Audio; sas.ScanWholeFile(); //clean files on entry var newData = new changes.TagHandlerUpdate(mf); if (nochanges == false) { Music_File_Info_Editor.changes.cleanMP3(newData); var changes = Music_File_Info_Editor.changes.areThereDifferences(mf, newData); var makechanges = true; if (changes && acceptall == false) { var tt = "The file:" + mf.FileName + " has a title/album/artist with blank characters at the start or end, or has multiple white space. Do you wish to fix these?"; var MMB = new MultipleMessageBox("option", tt, l); MMB.ShowDialog(); if (MMB.IsSet == false) return; switch (MMB.Result) { case cancelstr: return; case nostr: makechanges = false; break; case YTA: acceptall = true; break; case noallstr: makechanges = false; nochanges = true; break; } } if (makechanges) { if (Music_File_Info_Editor.changes.makeChangesAndContinue(newData, mf) == false) return; } } //only add if the name isnt there already var add = true; foreach (ListViewItem tt in fileList.Items) { var s1 = tt.SubItems[ListViewExtras.GetColumnNumber(fileList, "Path")].Text; if (s1.Equals(mf.FileName)) { add = false; break; } } if (add) fileList.Items.Add(LVI); } RefreshInfo(fileList); ListViewExtras.AutoResize(fileList); }