/// <summary>
        /// Cleans up the root folders
        /// </summary>
        public void CleanUp()
        {
            List <NonLibraryFile> filenames = new List <NonLibraryFile>();

            foreach (RootFolder rootFolder in VideoRootFolders)
            {
                foreach (IntelligentString filename in rootFolder.CleanUp(Options.RootFolderFileExceptions.ToArray(), Options.RootFolderDirectoryExceptions.ToArray()))
                {
                    filenames.Add(NonLibraryFile.FromFilename(rootFolder, filename));
                }
            }

            foreach (RootFolder rootFolder in SongRootFolders)
            {
                foreach (IntelligentString filename in rootFolder.CleanUp(Options.RootFolderFileExceptions.ToArray(), Options.RootFolderDirectoryExceptions.ToArray()))
                {
                    filenames.Add(NonLibraryFile.FromFilename(rootFolder, filename));
                }
            }

            if (filenames.Count > 0)
            {
                NonLibraryFilesDialog nlfd = new NonLibraryFilesDialog(filenames.ToArray(), Options);
                nlfd.Owner = Application.Current.MainWindow;
                nlfd.ShowDialog();
            }
        }
        private void btnDeleteNonLibraryFile_Click(object sender, RoutedEventArgs e)
        {
            //get the file that was selected
            Button         btnDeleteNonLibraryFile = sender as Button;
            NonLibraryFile nlf = btnDeleteNonLibraryFile.DataContext as NonLibraryFile;

            //delete file
            FileInfo fi = new FileInfo(nlf.FullName.Value);

            fi.Delete();

            //clean up folder again
            RootFolder.CleanUp(fi.Directory.FullName, new List <String>(), Options.RootFolderFileExceptions.ToArray(), Options.RootFolderDirectoryExceptions.ToArray(), nlf.IsInRootFolder);

            //remove file from data grid
            ItemsSource.Remove(nlf);

            if (ItemsSource.Count == 0)
            {
                DialogResult = true;
            }
        }
        private void btnAddRootFolderFileException_Click(object sender, RoutedEventArgs e)
        {
            Button         btnAddRootFolderFileException = sender as Button;
            NonLibraryFile nlf = btnAddRootFolderFileException.DataContext as NonLibraryFile;

            Options.RootFolderFileExceptions.Add(nlf.Name.Value);
            Options.Save();

            NonLibraryFile[] matches = ItemsSource.Where(p => p.Name == nlf.Name).ToArray();

            foreach (NonLibraryFile nonLibraryFile in matches)
            {
                FileInfo fi = new FileInfo(nonLibraryFile.FullName.Value);

                RootFolder.CleanUp(fi.Directory.FullName, new List <String>(), Options.RootFolderFileExceptions.ToArray(), Options.RootFolderDirectoryExceptions.ToArray(), nonLibraryFile.IsInRootFolder);
                ItemsSource.Remove(nonLibraryFile);
            }

            if (ItemsSource.Count == 0)
            {
                DialogResult = true;
            }
        }