Exemplo n.º 1
0
        public void FilterPlaylistAddFilter()
        {
            var lib = CreateLibrary();

            var fpl = new FilterPlaylist(lib, "fpl 1");

            var filter = new StringFilter("title", "1", true);

            try
            {
                fpl.Filters.Add(filter);
            }
            catch
            {
                Assert.Fail();
            }

            Assert.AreEqual(1, fpl.Filters.Count);
        }
Exemplo n.º 2
0
        public void EditStringFilter(StringFilter filter)
        {
            old = new StringFilter(filter);
            SetStringFilterParams();

            if (filter.Field == "title")
                filterType_combobox.SelectedIndex = 0;
            else if (filter.Field == "artist")
                filterType_combobox.SelectedIndex = 1;
            else if (filter.Field == "album")
                filterType_combobox.SelectedIndex = 2;
            else if (filter.Field == "genre")
                filterType_combobox.SelectedIndex = 3;

            if (filter.Contains)
                filterParams_combobox.SelectedIndex = 0;
            else
                filterParams_combobox.SelectedIndex = 1;

            searchString_textbox.Text = filter.SearchTerm;
        }
Exemplo n.º 3
0
 public StringFilter(StringFilter filter)
     : this(filter.field, filter.searchTerm, filter.Contains)
 {
 }
Exemplo n.º 4
0
 public StringFilter(StringFilter filter)
     : this(filter.field, filter.searchTerm, filter.Contains)
 {
 }
Exemplo n.º 5
0
        protected override void ReadHeader(StreamReader sr)
        {
            base.ReadHeader(sr);

            string filterType;
            while ((filterType = sr.ReadLine()) != null)
            {
                Filter filter = null;

                switch (filterType)
                {
                    case "StringFilter":
                        filter = new StringFilter(sr);
                        break;
                    case "RatingFilter":
                        filter = new RatingFilter(sr);
                        break;
                    case "DateFilter":
                        filter = new DateFilter(sr);
                        break;
                    default:
                        throw new FileLoadException();
                }

                Filters.Add(filter);
            }
        }
Exemplo n.º 6
0
        public void FilterPlaylistApplyGenreFilter()
        {
            var lib = CreateLibrary();

            var fpl = new FilterPlaylist(lib, "fpl 1");

            var filter = new StringFilter("genre", "NoIsE", true);
            fpl.Filters.Add(filter);
            fpl.FilterLibrary();
            Assert.AreEqual(2, fpl.NumSongs);

            filter.Contains = false;
            fpl.FilterLibrary();
            Assert.AreEqual(1, fpl.NumSongs);
        }