private static Dictionary<String, String> TagHandlerToDict(Mp3Lib.Mp3File mpf) { var TH = mpf.TagHandler; var ret = new Dictionary<string, string>(); ret.Add("Album", TH.Album); ret.Add("Artist", TH.Artist); ret.Add("Comment", TH.Comment); ret.Add("Composer", TH.Composer); ret.Add("Disc", TH.Disc); ret.Add("Genre", TH.Genre); ret.Add("Lyrics", TH.Lyrics); ret.Add("Song", TH.Song); ret.Add("Title", TH.Title); ret.Add("Track", TH.Track); ret.Add("Year", TH.Year); ret.Add("Path", mpf.FileName); return ret; }
public TagHandlerUpdate(Mp3Lib.Mp3File mff) { var TH = mff.TagHandler; this.Album = TH.Album; Artist = TH.Artist; Comment = TH.Comment; Composer = TH.Composer; Disc = TH.Disc; Genre = TH.Genre; Lyrics = TH.Lyrics; Song = TH.Song; Title = TH.Title; Track = TH.Track; Year = TH.Year; Path = mff.FileName; }
/// <summary> /// Ask the user if they want changes to be made. if yes, then make the changes, if no, return true, if cancel, return false /// </summary> /// <param name="newData">the copied mp3files taghandler</param> /// <param name="orig">the original mp3file</param> /// <param name="checkFirst"></param> /// <returns>return false if the user wants to cancel all changes, true in any other case</returns> public static bool queryUserMakeChangesAndContinue(TagHandlerUpdate newData, Mp3Lib.Mp3File orig, bool checkFirst) { usercheck UC = null; if (checkFirst) { if (areThereDifferences(orig, newData) == false) { MessageBox.Show("No changes need to be made for this file"); } else { UC = new usercheck(DictionaryExtras.DictToListOfListViewItems(TagHandlerToDict(orig)), DictionaryExtras.DictToListOfListViewItems(newData.toDict())); UC.ShowDialog(); } if (UC==null||UC.cancelval) return false; if (UC.makeChanges == false) return true; } return makeChangesAndContinue(newData,orig); }