Пример #1
0
        /// <summary>
        /// The predicate function to test a given song for a match.
        /// </summary>
        /// <param name="song">The song to test.</param>
        /// <returns><c>true</c> when the song matches the 
        /// given keyword and/or source/copyright strings and <c>false</c> otherwise.</returns>
        public bool Matches(SongData song)
        {
            // TODO: The keyword search should be able to search in source and copyright directly.
            //		 Furthermore the full text search should search for multiple independent words (ignoring their order)
            //		 and only search for an exact match if the phrase is quoted like "search phrase".
            //       This change also needs to be done in the PHP MediaServer implementation.

            if (IsEmpty)
            {
                return true;
            }

            if (!String.IsNullOrEmpty(Source))
            {
                if (!song.Sources.ContainsIgnoreCase(Source))
                {
                    return false;
                }
            }

            if (!String.IsNullOrEmpty(Copyright))
            {
                if (!song.Copyright.ContainsIgnoreCase(Copyright))
                {
                    return false;
                }
            }

            if (!String.IsNullOrEmpty(Keyword))
            {
                if (!(song.SearchTitle.ContainsIgnoreCase(NormalizedKeyword) || (SearchInText && song.SearchText.ContainsIgnoreCase(NormalizedKeyword))))
                {
                    return false;
                }
            }

            return true;
        }
Пример #2
0
 public SongDataObject(SongData data)
 {
     this.data = data;
 }
Пример #3
0
		private void AddToPortfolio(SongData data)
		{
			Controller.AddToPortfolio(data.Uri);
			this.Topmost = true;
			Controller.FocusMainWindow(false);
			this.Topmost = false;
			this.Focus();
		}