Beispiel #1
0
        public MainModel()
        {
            _musicFileLoader = new MusicFileLoader();
            _musicFileSelector = new MusicFileSelector(_musicFileLoader);
            _musicFileFilter = new MusicFileRefiner(_musicFileLoader);

            GalleryManager = new GalleryManager();
            MusicFileCollectionEditor = new MusicFileCollectionEditor();

            _userConfiguration = new UserConfiguration(_musicFileLoader, GalleryManager);

            try
            {
                Logger.Info("Load user configuration");
                _userConfiguration.Load();
            }
            catch (FileNotFoundException)
            {
            }

            ChangeAllFilesSelection(true);
            MusicFileCollectionEditor.Files = _musicFileLoader.Files.Values;
        }
Beispiel #2
0
        public void FilterFiles()
        {
            // Prerequisites
            MusicFile temp = ResetFile(TestPaths.MusicA);
            MusicFile temp2 = ResetFile(TestPaths.MusicB);
            ResetFile(TestPaths.MusicC);

            temp.Album = "Death";
            temp.Cover = new Bitmap(Image.FromFile(TestPaths.CoverA));
            temp.Save();

            temp2.Album = "Angel";
            temp2.Save();

            // Process 1
            var loader = new MusicFileLoader();
            loader.ChangeDirectory(TestPaths.MusicDirectory);

            var filter = new MusicFileRefiner(loader)
            {
                Filter = MusicFileFilter.NoAlbum
            };

            // Test 1
            Assert.IsFalse(filter.Files.ContainsKey(TestPaths.MusicA));
            Assert.IsFalse(filter.Files.ContainsKey(TestPaths.MusicB));
            Assert.IsTrue(filter.Files.ContainsKey(TestPaths.MusicC));

            // Process 2
            filter.Filter = MusicFileFilter.NoCover;

            // Test 2
            Assert.IsFalse(filter.Files.ContainsKey(TestPaths.MusicA));
            Assert.IsTrue(filter.Files.ContainsKey(TestPaths.MusicB));
            Assert.IsTrue(filter.Files.ContainsKey(TestPaths.MusicC));
        }