Example #1
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);
                        //
                    }
                }
            }
        }
Example #2
0
File: Form1.cs Project: nowen3/Ntag
        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);
                        //
                    }
                }
            }
        }