예제 #1
0
        private void addImageToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FRMImage addimage = new FRMImage();

            ListView.SelectedListViewItemCollection filename = this.musicListStore.SelectedItems;
            var trackxml = new XMLutils(appPath + "\\trackxml.xml");

            addimage.Artist = filename[0].SubItems[4].Text;
            addimage.Album  = filename[0].SubItems[5].Text;

            if (addimage.ShowDialog(this) == DialogResult.OK)
            {
                foreach (ListViewItem item in filename)
                {
                    string fname   = item.SubItems[1].Text + "\\" + item.SubItems[0].Text;
                    var    id3v2   = new ID3v2Tag(fname);
                    var    mytrack = new Track();
                    mytrack.Filename = fname;
                    mytrack.Artist   = id3v2.Artist;
                    mytrack.Title    = id3v2.Title;
                    mytrack.Album    = id3v2.Album;
                    mytrack.Genre    = id3v2.Genre;
                    mytrack.Trackno  = id3v2.TrackNumber.ToString();
                    mytrack.Year     = id3v2.Year;
                    if (addimage.Getimage() != null)
                    {
                        mytrack.coverimage = addimage.Getimage();
                    }
                    Miscutils.Savev2tag(mytrack);
                    //ReloadlistviewV2(fname);
                }
            }
        }
예제 #2
0
        private void BTNsavetag_Click(object sender, EventArgs e)
        {
            var    mytrackv1 = new Track();
            var    mytrackv2 = new Track();
            string fname     = "";

            ListView.SelectedListViewItemCollection filename = this.musicListStore.SelectedItems;

            foreach (ListViewItem item in filename)
            {
                fname = (item.SubItems[1].Text + "\\" + item.SubItems[0].Text);

                {
                    var mytrack = new Track();
                    mytrack = Getkeepv1(fname);
                    Miscutils.Savev1tag(mytrack);
                    ReloadlistviewV1(item);
                }
                // result = MessageBox.Show(string.Format("Save ID3v2 tag from '{0}'?", Path.GetFileName(TXTfilename.Text)), "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                // if (result == DialogResult.Yes)
                {
                    var mytrack = new Track();
                    mytrack = Getkeepv2(fname);
                    Miscutils.Savev2tag(mytrack);
                    ReloadlistviewV2(item);
                }
            }
        }
예제 #3
0
        private void tagFromFilenameToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var tagfilewin = new FRMtagfile();

            ListView.SelectedListViewItemCollection filename = this.musicListStore.SelectedItems;

            foreach (ListViewItem item in filename)
            {
                tagfilewin.Addtrack(item.SubItems[1].Text + "\\" + item.SubItems[0].Text);
            }
            if (tagfilewin.ShowDialog(this) == DialogResult.OK)
            {
                for (int x = 0; x <= tagfilewin.Gettrack_Count() - 1; x++)
                {
                    var mytrack = new Track(tagfilewin.getartist(x), tagfilewin.gettitle(x), tagfilewin.getalbum(x), tagfilewin.getyear(x), tagfilewin.gettracknumber(x), tagfilewin.getgenre(x), tagfilewin.getfilename(x), "V1/V2");
                    Miscutils.Savev1tag(mytrack);
                    Miscutils.Savev2tag(mytrack);
                    // Miscutils.Updaterecord(tagfilewin.getfilename(x), tagfilewin.getalbum(x), tagfilewin.getartist(x), tagfilewin.getgenre(x), tagfilewin.gettitle(x), tagfilewin.gettracknumber(x), tagfilewin.getyear(x));
                }
            }
            foreach (ListViewItem item in filename)
            {
                ReloadlistviewV1(item);
            }
        }
예제 #4
0
        private void BTNdeletetag_Click(object sender, EventArgs e)
        {
            if (musicListStore.SelectedItems.Count > 0)
            {
                ListView.SelectedListViewItemCollection filename = this.musicListStore.SelectedItems;

                string       temp   = "";
                DialogResult result = MessageBox.Show("Delete ID3v1 tags", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    foreach (ListViewItem item in filename)
                    {
                        temp = item.SubItems[1].Text + "\\" + item.SubItems[0].Text;
                        Miscutils.removeID3v1(temp);
                        ReloadlistviewV1(item);
                    }
                }
                result = MessageBox.Show("Delete ID3v2 tags", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    foreach (ListViewItem item in filename)
                    {
                        temp = item.SubItems[1].Text + "\\" + item.SubItems[0].Text;
                        Miscutils.removeID3v2(temp);
                        ReloadlistviewV2(item);
                    }
                }
            }
        }
예제 #5
0
        private void Add_folder(string foldername)
        {
            var bworker = new BackgroundWorker();

            if (File.Exists(appPath + "\\trackxml.xml"))
            {
                File.Delete(appPath + "\\trackxml.xml");
            }
            myopenfilename                     = foldername;
            bworker.DoWork                    += new DoWorkEventHandler(openfolder);
            bworker.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(CompressionFinished);
            bworker.WorkerReportsProgress      = true;
            bworker.WorkerSupportsCancellation = true;
            Miscutils.SetDoubleBuffering(musicListStore, true);
            bworker.RunWorkerAsync();
            toolStripProgressBar.Value = 0;
        }
예제 #6
0
파일: FRMrename.cs 프로젝트: nowen3/Ntag
        private string Getnewtrack(string fname)
        {
            string ntn     = COMBrename.Text;
            Track  mytrack = new Track("", "", "", "", "", "", "", "");
            string extn    = Path.GetExtension(fname);

            if (ID3v1Tag.DoesTagExist(fname))
            {
                mytrack = Miscutils.Getv1tags(fname);
            }
            else if (ID3v2Tag.DoesTagExist(fname))
            {
                mytrack = Miscutils.Getv2tags(fname);
            }
            if (ntn.Contains("%TRACKNUMBER%"))
            {
                ntn = ntn.Replace("%TRACKNUMBER%", Miscutils.PaddedNumber(mytrack.Trackno));
            }

            if (ntn.Contains("%ARTIST%"))
            {
                ntn = ntn.Replace("%ARTIST%", mytrack.Artist);
            }

            if (ntn.Contains("%ALBUM%"))
            {
                ntn = ntn.Replace("%ALBUM%", mytrack.Album);
            }
            if (ntn.Contains("%TITLE%"))
            {
                ntn = ntn.Replace("%TITLE%", mytrack.Title);
            }
            if (ntn.Contains("%FILENAME%"))
            {
                ntn = ntn.Replace("%FILENAME%", Path.GetFileNameWithoutExtension(fname));
            }
            ntn = Miscutils.stripchar(ntn);
            if (TXTrepbefore.Text != "")
            {
                ntn = ntn.Replace(TXTrepbefore.Text, TXTrepafter.Text);
            }
            return(ntn + extn);
        }
예제 #7
0
        private void BTNcopy_Click(object sender, EventArgs e)
        {
            if (musicListStore.SelectedItems.Count > 0)
            {
                var    copywin = new FRMcopy();
                string temp    = "";
                ListView.SelectedListViewItemCollection filename = this.musicListStore.SelectedItems;
                copywin.GetGenre = musicListStore.SelectedItems[0].SubItems[8].Text;
                if (copywin.ShowDialog(this) == DialogResult.OK)
                {
                    if (copywin.CopyV1)
                    {
                        foreach (ListViewItem item in filename)
                        {
                            temp = item.SubItems[1].Text + "\\" + item.SubItems[0].Text;
                            if (File.Exists(temp) & ID3v1Tag.DoesTagExist(temp))
                            {
                                var id3 = new ID3v1Tag(temp);
                                Miscutils.Savev2tag(new Track(id3.Artist, id3.Title, id3.Album, id3.Year, id3.TrackNumber.ToString(), GenreHelper.GenreByIndex[id3.GenreIndex], temp, "V1/V2"));
                                ReloadlistviewV2(item);
                            }
                        }
                    }

                    if (copywin.CopyV2)
                    {
                        foreach (ListViewItem item in filename)
                        {
                            temp = item.SubItems[1].Text + "\\" + item.SubItems[0].Text;
                            if (File.Exists(temp) & ID3v2Tag.DoesTagExist(temp))
                            {
                                var    id3 = new ID3v2Tag(temp);
                                string gen = copywin.GetGenre;
                                Miscutils.Savev1tag(new Track(id3.Artist, id3.Title, id3.Album, id3.Year, id3.TrackNumber.ToString(), gen, temp, "V1/V2"));
                                ReloadlistviewV1(item);
                            }
                        }
                    }
                }
            }//end musicstore setected
        }
예제 #8
0
        private void LSVsearch_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (LSVsearch.SelectedItems.Count > 0)
            {
                BindingList <Track> trackList = new BindingList <Track>();
                FRMretag            retagwin  = new FRMretag();
                ListView.SelectedListViewItemCollection filename = this.musicListStore.SelectedItems;
                Bitmap cimage;
                int    i = 1;

                ListViewItem lvItem = LSVsearch.SelectedItems[0];
                string       asin   = lvItem.SubItems[0].Text;
                retagwin.Artist = lvItem.SubItems[1].Text;
                retagwin.Album  = lvItem.SubItems[2].Text;
                trackList       = sitem.getgnutracks(asin);
                retagwin.Year   = trackList[0].Year;
                retagwin.Genre  = trackList[0].Genre;

                for (int y = 0; y <= trackList.Count - 1; y++)
                {
                    retagwin.Addnewtrack(trackList[y].Trackno, trackList[y].Title);
                }

                foreach (ListViewItem item in filename)
                {
                    retagwin.Addtrack(item.SubItems[1].Text + "\\" + item.SubItems[0].Text, item.SubItems[3].Text);
                    i++;
                }
                if (retagwin.ShowDialog(this) == DialogResult.OK)
                {
                    string[] tn = new string[2];

                    for (int x = 0; x <= retagwin.gettrack_count() - 1; x++)
                    {
                        if (x <= retagwin.getnewtrack_count() - 1)
                        {
                            tn = retagwin.getnewtrackname(x);
                            int tnum = Convert.ToInt16(tn[0]);
                            if (retagwin.isimage())
                            {
                                cimage = retagwin.Getimage();
                                var mytrack = new Track(retagwin.Artist, tn[1], retagwin.Album, retagwin.Year, tn[0], retagwin.Genre, retagwin.gettrackname(x), "V1//V2", cimage);
                                Miscutils.Savev1tag(mytrack);
                                Miscutils.Savev2tag(mytrack);
                            }
                            else
                            {
                                var mytrack = new Track(retagwin.Artist, tn[1], retagwin.Album, retagwin.Year, tn[0], retagwin.Genre, retagwin.gettrackname(x), "V1//V2");
                                Miscutils.Savev1tag(mytrack);
                                Miscutils.Savev2tag(mytrack);
                            }

                            // Miscutils.Updaterecord(retagwin.gettrackname(x), retagwin.Album, retagwin.Artist, retagwin.Genre, tn[1], tnum.ToString(), retagwin.Year);
                        }
                    }

                    foreach (ListViewItem item in filename)
                    {
                        ReloadlistviewV1(item);
                        //
                    }
                }
            }
        }