private static void AddDiffs(TagDiffs diffs, FileErrors errors, string filePath) { TagLib.File file; try { file = TagLib.File.Create(filePath); } catch (TagLib.CorruptFileException ex) { errors.Add(new FileError { FilePath = filePath, Message = ex.Message }); return; } var current = new Dictionary<Tags, string>(); var expected = new Dictionary<Tags, string>(); var folderPath = System.IO.Path.GetDirectoryName(filePath); var parts = folderPath.Split('\\'); expected.Add(Tags.Album, parts[parts.Length - 1]); expected.Add(Tags.Performers, parts[parts.Length - 2]); expected.Add(Tags.AlbumArtists, parts[parts.Length - 2]); expected.Add(Tags.Genre, parts[parts.Length - 3]); expected.Add(Tags.Title, System.IO.Path.GetFileNameWithoutExtension(filePath)); current.Add(Tags.Album, file.Tag.Album); current.Add(Tags.Performers, String.Join(";", file.Tag.Performers)); current.Add(Tags.AlbumArtists, String.Join(";", file.Tag.AlbumArtists)); current.Add(Tags.Genre, String.Join(";", file.Tag.Genres)); current.Add(Tags.Title, file.Tag.Title); foreach (var tag in expected.Keys) { if (expected[tag] != current[tag]) { var diff = new TagDiff(); diff.Tag = tag; diff.FilePath = filePath; diff.OldValue = current[tag]; diff.NewValue = expected[tag]; diffs.Add(diff); } } }