private static bool AlbumMerge(Album Changing, AlbumModifier AM, IImportContext IT, IProgress<ImportExportError> progress) { try { AM._UnderTrans = true; if (!Changing.Images.SequenceEqual(AM._AM.Images, (im1, im2) => im1.CompareContent(im2))) { int i = 0; foreach (AlbumImage im in Changing.Images) { AM.Images.Insert(i++, im.Clone(AM._AM)); } } //forceons l'ecriture des infos albums pour les tracks migres AM.Name = AM.Name; AM.ForceAuthorReWrite(); if (AM._AM.Genre == null) AM.Genre = Changing.Genre; if (AM._AM.Interface.Year == 0) AM.Year = Changing.Interface.Year; IList<Track> tracks = Changing.RawTracks.ToList(); using (IMusicTransaction IMut = IT.CreateTransaction()) { foreach (Track tr in tracks) { AM.Tracks.Add(new TrackModifier(tr.CloneTo(IT, AM._AM), AM)); } AM.TrivialCommit(IMut, progress); IT.AddForRemove(Changing); IMut.Commit(); } } catch (Exception e) { Trace.WriteLine("Problem during Album Merge: " + e.ToString()); } AM._UnderTrans = false; AM._AM.Context = null; return true; }