public bool selectMatch(MatchEntry _matchEntry) { if (_matchEntry != null) { // Match selected from popup menu => use it Key = _matchEntry.Key; TrackType = _matchEntry.TrackType; return(Matched); } return(false); }
public void CheckBestMatch() { if (!Matched) { var matches = from match in m_TitleMatches.OrderByDescending(m => m.MatchFactor) where match.MatchOnFolder || (match.MatchOnTitle && (match.MatchOnArtist || match.MatchOnFileName)) select match; MatchEntry matchEntry = matches.FirstOrDefault(); if (matchEntry != null) { // Single exact match found => use it Key = matchEntry.Key; TrackType = matchEntry.TrackType; } } }
public bool AddMatch(MatchEntry _matchEntry) { if (_matchEntry != null) { if (_matchEntry.MatchOnFolder || _matchEntry.Title.Contains(Title)) { _matchEntry.MatchOnTitle = _matchEntry.Title.Equals(this.Title, StringComparison.OrdinalIgnoreCase); _matchEntry.MatchOnArtist = _matchEntry.IsArtistMatch(this.Artist); _matchEntry.MatchOnFileName = _matchEntry.FileName.Equals(this.FileNameOnly, StringComparison.OrdinalIgnoreCase); MatchEntry existMatch = m_TitleMatches.FirstOrDefault(match => match.Key.Equals(_matchEntry.Key, StringComparison.OrdinalIgnoreCase)); if (existMatch != null) { if (_matchEntry.MatchOnFolder) { existMatch.MatchOnFolder = true; } else { existMatch.MatchOnTitle = _matchEntry.MatchOnTitle; existMatch.MatchOnArtist = _matchEntry.MatchOnArtist; existMatch.MatchOnFileName = _matchEntry.MatchOnFileName; } } else { m_TitleMatches.Add(_matchEntry); } if (!Matched && _matchEntry.MatchOnFolder) { Key = _matchEntry.Key; TrackType = _matchEntry.TrackType; } return(true); } } return(false); }