private bool ValidateMusicFileSet(MusicDb db, List <MusicFile> files) { // 0. make sure there are some files if (!(files.Count > 0)) { log.Warning($"ValidateMusicFileSet(): file set is empty"); return(false); } // 1. make sure that all files are in the same original folder and in the same style if (!files.All(f => f.Style == files[0].Style && f.DiskRoot == files[0].DiskRoot && f.StylePath == files[0].StylePath && f.OpusPath == files[0].OpusPath)) { log.Warning($"ValidateMusicFileSet(): all files are not from the same original folder"); return(false); } // 2. make sure all files are of the same opustype, i.e. either in a collection or not in a collection, or singles if (!files.All(f => f.OpusType == files[0].OpusType)) { log.Warning($"ValidateMusicFileSet(): all files are not of the same opus type"); return(false); } foreach (var file in files) { if (!db.ValidateTags(file)) { return(false); } } return(true); }