Esempio n. 1
0
 private void _assignCategories_Click(object sender, EventArgs e)
 {
     if (_fileListView.SelectedItems.Count != 0)
     {
         using (CategoryViewer editcatbox = new CategoryViewer())
         {
             editcatbox.editingcats = false;
             if (editcatbox.ShowDialog() == System.Windows.Forms.DialogResult.Yes)
             {
                 Whizzyfile sfile = selectedPL.whizzyfilelist.Find(item => item.Filepath == _fileListView.SelectedItems[0].SubItems[1].Text);
                 foreach (Category g in sfile.FileGenres)
                 {
                     if (sfile.FileGenres.Any(item => item.catname == g.catname))
                     {
                         Category dfile = new Category();
                         dfile = sfile.FileGenres.Find(item => item.catname == g.catname);
                         editcatbox.retlist.Remove(dfile);
                     }
                 }
                 sfile.FileGenres.AddRange(editcatbox.retlist);
             }
         }
         funcs.populateListView(_fileListView, selectedPL);
     }
     else
     {
         MessageBox.Show("Please select a file to assign Categories to");
     }
 }
Esempio n. 2
0
 private void _commentEdit_Click(object sender, EventArgs e)
 {
     if (_fileListView.SelectedItems.Count != 0)
     {
         Whizzyfile sfile = selectedPL.whizzyfilelist.Find(item => item.Filepath == _fileListView.SelectedItems[0].SubItems[1].Text);
         using (DialogBox dialogbox = new DialogBox())
         {
             dialogbox.boxTitle  = "Edit Comment";
             dialogbox.labelText = "Add or edit your comment here";
             if (sfile.Filecomment != null)
             {
                 dialogbox.textboxdata = null;
                 dialogbox.textboxdata = sfile.Filecomment;
             }
             if (dialogbox.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 if (!isSessionPL)
                 {
                     sfile.Filecomment = dialogbox.textboxdata;
                     datafuncs.savePlaylist(selectedPL, selectedPL.playlistname);
                     _fileListView.Items.Clear();
                     funcs.populateListView(_fileListView, selectedPL);
                 }
             }
         }
     }
     else
     {
         MessageBox.Show("Please select a file edit",
                         "Select file");
     }
 }
Esempio n. 3
0
        private void _cPlaylistButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Multiselect = true;
            List <Whizzyfile> listinscope = new List <Whizzyfile>();

            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                int numFiles = openFileDialog.FileNames.Length;

                for (int i = 0; i < numFiles; i++)
                {
                    Whizzyfile whizzyfile = new Whizzyfile();
                    if (!listinscope.Any(item => item.Filepath == openFileDialog.FileNames[i]))
                    {
                        whizzyfile.Filepath = openFileDialog.FileNames[i];
                        whizzyfile.Filename = openFileDialog.SafeFileNames[i];
                        whizzyfile.fileID   = listinscope.Count == 0 ? whizzyfile.fileID = i : whizzyfile.fileID = listinscope.Count;
                        whizzyfile.Filetype = Path.GetExtension(openFileDialog.FileNames[i]);
                        //whizzyfile.Filecomment = openFileDialog.FileNames[i];

                        listinscope.Add(whizzyfile);
                    }
                }
                //AddFilesToNewList(wfileList);


                foreach (Whizzyfile file in listinscope)
                {
                    if (_playlistListBox.Items.Count == 0)
                    {
                        _playlistListBox.Items.Add(file.Filename);
                        string[] row = { file.Filepath, Path.GetExtension(file.Filepath), "" };
                        _fileListView.Items.Add(file.Filename).SubItems.AddRange(row);
                    }
                    else
                    {
                        List <string> namecheck = new List <string>();
                        for (int i = 0; i < _playlistListBox.Items.Count; i++)
                        {
                            namecheck.Add(_playlistListBox.Items[i].ToString());
                        }

                        if (namecheck.Any(item => item[0].ToString() != file.Filename))
                        {
                            if (_playlistListBox.Items.Contains(file.Filename))
                            {
                                _playlistListBox.Items.Add(file.Filename);
                                string[] row = { file.Filepath, Path.GetExtension(file.Filepath), "" };
                                _fileListView.Items.Add(file.Filename).SubItems.AddRange(row);
                            }
                        }
                    }
                }
            }
            spl.whizzyfiles = AddListToPlaylist("session", AddFilesToNewList(listinscope));
        }
Esempio n. 4
0
        private void _assignImage_Click(object sender, EventArgs e)
        {
            if (_fileListView.SelectedItems.Count != 0)
            {
                OpenFileDialog openFileDialog = new OpenFileDialog();
                openFileDialog.Title  = "Please select image to add.";
                openFileDialog.Filter = "Media files |*.jpg; *.jpeg; *.png; *.svg; *.bmp;";

                if (_fileListView.SelectedItems.Count == 1)
                {
                    Whizzyfile sfile = selectedPL.whizzyfilelist.Find(item => item.Filepath == _fileListView.SelectedItems[0].SubItems[1].Text);

                    if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        int numFiles = openFileDialog.FileNames.Length;

                        for (int i = 0; i < numFiles; i++)
                        {
                            sfile.imagepath = openFileDialog.FileName;
                        }

                        datafuncs.savePlaylist(selectedPL, selectedPL.playlistname);
                        _fileListView.Items.Clear();
                        funcs.populateListView(_fileListView, selectedPL);
                    }
                }
                else
                {
                    List <Whizzyfile> selectlist = new List <Whizzyfile>();
                    foreach (Whizzyfile f in selectedPL)
                    {
                        for (int i = 0; i < _fileListView.SelectedItems.Count; i++)
                        {
                            if (f.Filepath == _fileListView.SelectedItems[i].SubItems[1].Text)
                            {
                                f.imagepath = openFileDialog.FileName;
                            }
                        }
                    }
                    datafuncs.savePlaylist(selectedPL, selectedPL.playlistname);
                    _fileListView.Items.Clear();
                    funcs.populateListView(_fileListView, selectedPL);
                }
            }
            else
            {
                MessageBox.Show("Please select a file edit",
                                "Select file");
            }
        }
Esempio n. 5
0
        private void _removeImg_Click(object sender, EventArgs e)
        {
            if (_fileListView.SelectedItems.Count != 0)
            {
                if (_fileListView.SelectedItems.Count == 1)
                {
                    Whizzyfile sfile = selectedPL.whizzyfilelist.Find(item => item.Filepath == _fileListView.SelectedItems[0].SubItems[1].Text);

                    sfile.imagepath = "";
                    datafuncs.savePlaylist(selectedPL, selectedPL.playlistname);
                    _fileListView.Items.Clear();
                    funcs.populateListView(_fileListView, selectedPL);
                }
                else
                {
                    List <Whizzyfile> selectlist = new List <Whizzyfile>();
                    foreach (Whizzyfile f in selectedPL)
                    {
                        for (int i = 0; i < _fileListView.SelectedItems.Count; i++)
                        {
                            if (f.Filepath == _fileListView.SelectedItems[i].SubItems[1].Text)
                            {
                                f.imagepath = "";
                            }
                        }
                    }
                    datafuncs.savePlaylist(selectedPL, selectedPL.playlistname);
                    _fileListView.Items.Clear();
                    funcs.populateListView(_fileListView, selectedPL);
                }
            }
            else
            {
                MessageBox.Show("Please select a file edit",
                                "Select file");
            }
        }
Esempio n. 6
0
        private void _cMediaButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Multiselect = true;
            openFileDialog.Title       = "Please select media to add.";
            openFileDialog.Filter      = "Media files |*.aac; *.mp3; *.mp4; *.wav; *.wma; *.avi; *.flac;";

            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                int numFiles = openFileDialog.FileNames.Length;

                for (int i = 0; i < numFiles; i++)
                {
                    Whizzyfile  whizzyfile = new Whizzyfile();
                    TagLib.File file       = TagLib.File.Create(openFileDialog.FileNames[i]);
                    if (spl.whizzyfilelist != null)
                    {
                        if (spl != null && !spl.whizzyfilelist.Any(item => item.Filepath == openFileDialog.FileNames[i]))
                        {
                            whizzyfile.Filepath    = openFileDialog.FileNames[i];
                            whizzyfile.Filename    = openFileDialog.SafeFileNames[i];
                            whizzyfile.Filetype    = Path.GetExtension(openFileDialog.FileNames[i]);
                            whizzyfile.Filecomment = file.Tag.Comment;

                            listinscope.Add(whizzyfile);
                        }
                    }
                    else
                    {
                        whizzyfile.Filepath    = openFileDialog.FileNames[i];
                        whizzyfile.Filename    = openFileDialog.SafeFileNames[i];
                        whizzyfile.Filetype    = Path.GetExtension(openFileDialog.FileNames[i]);
                        whizzyfile.Filecomment = file.Tag.Comment;

                        listinscope.Add(whizzyfile);
                    }
                }

                foreach (Whizzyfile file in listinscope)
                {
                    string listcategories = "";
                    if (file.Filecomment == null)
                    {
                        file.Filecomment = " ";
                    }
                    if (file.FileGenres != null)
                    {
                        int count = 1;
                        foreach (Category c in file.FileGenres)
                        {
                            listcategories += count < file.FileGenres.Count ? c.catname + ", " : c.catname;
                            count++;
                        }
                    }
                    if (_fileListView.Items.Count == 0)
                    {
                        string[] row = { file.Filepath, Path.GetExtension(file.Filepath), file.Filecomment, listcategories, file.imagepath };
                        _fileListView.Items.Add(file.Filename).SubItems.AddRange(row);
                    }
                    else
                    {
                        if (!_fileListView.Items.ToString().Contains(file.Filename))
                        {
                            string[] row = { file.Filepath, Path.GetExtension(file.Filepath), file.Filecomment, listcategories, file.imagepath };
                            _fileListView.Items.Add(file.Filename).SubItems.AddRange(row);
                        }
                    }
                }

                if (isSessionPL)
                {
                    if (spl.whizzyfilelist == null)
                    {
                        spl.playlistname   = "New Playlist";
                        spl.whizzyfilelist = listinscope;
                        spl.playlistcount  = listinscope.Count;
                        _playlistListView.Items.Add(spl.playlistname);
                    }
                    else
                    {
                        spl = funcs.addListToExistingPlaylist(spl, listinscope);
                    }
                }
                else
                {
                    selectedPL = funcs.addListToExistingPlaylist(selectedPL, listinscope);
                }
            }
        }