Esempio n. 1
0
        public void FilterPlaylistApplyDateFilter()
        {
            var lib = CreateLibrary();

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

            var filter = new DateFilter(TimeUnit.Day, 2);
            fpl.Filters.Add(filter);

            fpl.FilterLibrary();
            Assert.AreEqual(1, fpl.NumSongs);

            filter.SetLimit(TimeUnit.Day, 7);
            fpl.FilterLibrary();
            Assert.AreEqual(1, fpl.NumSongs);

            filter.SetLimit(TimeUnit.Day, 13);
            fpl.FilterLibrary();
            Assert.AreEqual(2, fpl.NumSongs);

            filter.SetLimit(TimeUnit.Week, 2);
            fpl.FilterLibrary();
            Assert.AreEqual(2, fpl.NumSongs);

            filter.SetLimit(TimeUnit.Month, 2);
            fpl.FilterLibrary();
            Assert.AreEqual(2, fpl.NumSongs);

            filter.SetLimit(TimeUnit.Month, 4);
            fpl.FilterLibrary();
            Assert.AreEqual(3, fpl.NumSongs);

            filter.SetLimit(TimeUnit.Month, 34);
            fpl.FilterLibrary();
            Assert.AreEqual(3, fpl.NumSongs);
        }
Esempio n. 2
0
 public void EditDateFilter(DateFilter filter)
 {
     filterType_combobox.SelectedIndex = 5;
     old = new DateFilter(filter);
     SetDateFilterParams();
     filterParams_combobox.SelectedIndex = (int)filter.Unit;
     date_box.Value = filter.NumUnits;
 }
Esempio n. 3
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);
            }
        }
Esempio n. 4
0
 public DateFilter(DateFilter filter)
     : this(filter.Unit, filter.NumUnits)
 {
 }
Esempio n. 5
0
 public DateFilter(DateFilter filter)
     : this(filter.Unit, filter.NumUnits)
 {
 }