public int DeleteTrack(IModelReference trackReference) { int count = 0; int trackId = (int)trackReference.Id; if (Tracks.Remove(trackId)) { count++; var subFingerprintReferences = SubFingerprints .Where(pair => pair.Value.TrackReference.Equals(trackReference)).Select(pair => pair.Key).ToList(); count += subFingerprintReferences.Count; foreach (var subFingerprintReference in subFingerprintReferences) { SubFingerprints.Remove(subFingerprintReference); } foreach (var hashTable in HashTables) { foreach (var hashBins in hashTable) { foreach (var subFingerprintReference in subFingerprintReferences) { if (hashBins.Value.Remove(subFingerprintReference)) { count++; } } } } } return(count); }
public IEnumerable <SubFingerprintData> ReadSubFingerprintByTrackReference(IModelReference trackReference) { return(SubFingerprints.Where(pair => pair.Value.TrackReference.Equals(trackReference)).Select(pair => pair.Value).ToList()); }