示例#1
0
        internal void UpdateFolder()
        {
            List <MusicFile> files = new List <MusicFile>();

            foreach (ListViewItem item in viewGroup.Items)
            {
                MusicFile mf = window.FindMusicFile(item);
                window.importedFiles.Remove(mf);
                files.Add(mf);
            }

            files = MusicFolder.RegroupFiles(files, window.musicDirectory, folder);

            window.importedFiles.AddRange(files.ToArray());

            window.Invoke((MethodInvoker) delegate
            {
                for (int i = 0; i < viewGroup.Items.Count; i++)
                {
                    ListViewItem item     = viewGroup.Items[i];
                    MusicFile file        = files[i];
                    item.SubItems[0].Text = MusicFolder.GetFolderName(file.Folder);
                }

                window.musicFileList.Refresh();
                for (int i = 0; i < window.musicFileList.Columns.Count; i++)
                {
                    window.musicFileList.AutoResizeColumn(i, i != 0 ? ColumnHeaderAutoResizeStyle.HeaderSize : ColumnHeaderAutoResizeStyle.ColumnContent);
                }
            });
        }
示例#2
0
        internal void UpdateParent()
        {
            List <MusicFile> files = new List <MusicFile>();

            foreach (ListViewItem item in viewGroup.Items)
            {
                MusicFile mf = window.FindMusicFile(item);
                window.importedFiles.Remove(mf);
                files.Add(mf);
            }

            files = MusicFolder.AlterParent(files, overrideParent, AlternateParentFolder, AlternateAlbumFolder != null, AlternateAlbumFolder);

            window.importedFiles.AddRange(files.ToArray());

            window.Invoke((MethodInvoker) delegate
            {
                if (files.Count > 0)
                {
                    viewGroup.Header = files[0].HasParent() ? "'" + files[0].GetParent() + "' / '" + files[0].CreateFolderName() + "'" : files[0].CreateFolderName();
                }


                window.musicFileList.Refresh();

                /*for (int i = 0; i < window.musicFileList.Columns.Count; i++)
                 * {
                 *  window.musicFileList.AutoResizeColumn(i, i != 0 ? ColumnHeaderAutoResizeStyle.HeaderSize : ColumnHeaderAutoResizeStyle.ColumnContent);
                 * }*/
            });
        }
示例#3
0
        private void OnClickMenuAlbum(object sender, EventArgs e)
        {
            MusicFile file = FindMusicFile(musicFileList.FocusedItem);

            if (file != null && file.Folder != MusicFolder.Folders.ALBUM)
            {
                SwitchItemGroup(musicFileList.FocusedItem.Group, MusicFolder.Folders.ALBUM);
            }
        }
示例#4
0
        private void OnClickMenuSoundtrack(object sender, EventArgs e)
        {
            MusicFile file = FindMusicFile(musicFileList.FocusedItem);

            if (file != null && file.Folder != MusicFolder.Folders.FILMMUSIK)
            {
                SwitchItemGroup(musicFileList.FocusedItem.Group, MusicFolder.Folders.FILMMUSIK);
            }
        }
示例#5
0
        private void OnClickMenuPodcast(object sender, EventArgs e)
        {
            //Console.WriteLine("Yey "+ musicFileList.FocusedItem.SubItems[0].Text);
            MusicFile file = FindMusicFile(musicFileList.FocusedItem);

            if (file != null && file.Folder != MusicFolder.Folders.PODCASTS)
            {
                SwitchItemGroup(musicFileList.FocusedItem.Group, MusicFolder.Folders.PODCASTS);
            }
        }
示例#6
0
        public EditNameDialog(MainWindow mainWindow, MusicFile musicFile)
        {
            InitializeComponent();
            this.mainWindow = mainWindow;
            currentFile     = musicFile;

            checkOverrideParent.Checked = currentFile.AlternateParentFolder != null;
            parentFolderText.Text       = currentFile.GetParent();
            parentFolderText.ReadOnly   = !checkOverrideParent.Checked;

            checkOverrideAlbum.Checked = currentFile.AlternateAlbumFolder != null;
            albumFolderText.Text       = currentFile.CreateFolderName();
            albumFolderText.ReadOnly   = !checkOverrideAlbum.Checked;
        }
示例#7
0
        /// <summary>
        /// Resorts the given music files into the new folder within the music collection given by mainFolder
        /// </summary>
        /// <param name="oldFiles">Files to be resorted</param>
        /// <param name="mainFolder">Root folder of the music collection</param>
        /// <param name="newFolder">New folder the files should now be in</param>
        /// <returns>A list of resorted files</returns>
        public static List <MusicFile> RegroupFiles(List <MusicFile> oldFiles, string mainFolder, Folders newFolder)
        {
            List <MusicFile> newList = new List <MusicFile>();

            if (oldFiles.Count != 0)
            {
                MusicFile first     = oldFiles[0];
                string    newParent = CheckParentFolder(first.Artist, first.HasVariousArtists, first.Album, newFolder, mainFolder);

                foreach (MusicFile file in oldFiles)
                {
                    file.AlbumParentFolder = newParent;
                    file.Folder            = newFolder;
                    newList.Add(file);
                }
            }

            return(newList);
        }
示例#8
0
 public void OnOverrideFolders(MusicFile currentFile, bool overrideParent, string parentText, bool overrideAlbum, string albumText)
 {
     new Thread(new UpdateWorker(musicFileList.FocusedItem.Group, currentFile.Folder, overrideParent, parentText, overrideAlbum ? albumText : null, this).UpdateParent).Start();
 }
示例#9
0
 /// <summary>
 /// Returns whether this file should be sorted into podcasts instead of albums
 /// </summary>
 /// <param name="file">File to be checked</param>
 /// <returns>True: Should be a podcast, False: Not a podcast</returns>
 private static bool CheckForPodcast(MusicFile file)
 {
     return(file.Genre != null && (file.Genre.Contains("Podcast") || file.Genre.Contains("Audiobook") || file.Genre.Contains("Speech")));
 }
示例#10
0
 /// <summary>
 /// Returns whether this file should be sorted into soundtracks instead of albums
 /// </summary>
 /// <param name="file">File to be checked</param>
 /// <returns>True: Should be a soundtrack, False: Not a soundtrack</returns>
 private static bool CheckForSoundtrack(MusicFile file)
 {
     return(file.Genre != null && (file.Genre.Contains("Soundtrack") || file.Genre.Contains("Showtune") || file.Genre.Contains("Musical")));
 }