Exemplo n.º 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);
                }
            }
        }
Exemplo n.º 2
0
        private void renameFileFromTagsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FRMrename renamewin = new FRMrename();

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

            foreach (ListViewItem item in filename)
            {
                renamewin.Addtrack(item.SubItems[1].Text, item.SubItems[0].Text);
            }
            if (renamewin.ShowDialog(this) == DialogResult.OK)
            {
                for (int x = 0; x <= renamewin.Gettrack_Count_Before() - 1; x++)
                {
                    if (x <= renamewin.Gettrack_Count_After() - 1)
                    {
                        if (File.Exists(renamewin.Getoldtrackname(x)) & !File.Exists(renamewin.Getnewtrackname(x)))
                        {
                            File.Move(renamewin.Getoldtrackname(x), renamewin.Getnewtrackname(x));
                            trackxml.Updatefilename(renamewin.Getoldtrackname(x), renamewin.Getnewtrackname(x));
                            //Miscutils.UpdateFname(renamewin.Getoldtrackname(x), renamewin.Getnewtrackname(x)); //update xml
                            Reloadfilenames(renamewin.Getoldtrackname(x), renamewin.Getnewtrackname(x));
                        }
                        else
                        {
                            MessageBox.Show("File Error " + renamewin.Getoldtrackname(x));
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void openfolder(object sender, DoWorkEventArgs e)
        {
            var scandirectory = new ScanDir(myopenfilename);

            scandirectory.OnListFiles    += Onaddtolistview;
            scandirectory.UpdateProgress += UpdateProgress;
            scandirectory.Run_Scan();
            var trackxml = new XMLutils(appPath + "\\trackxml.xml");

            trackxml.Addrecord(scandirectory.tracks);

            //poptreeview(scandirectory.tracks);
        }
Exemplo n.º 4
0
 public static Boolean removeID3v1(string fname)
 {
     Boolean success = false;
     var trackxml = new XMLutils(appPath + "\\trackxml.xml");
     if (!String.IsNullOrEmpty(fname) && File.Exists(fname))
     {
         success = ID3v1Tag.RemoveTag(fname);
     }
     if (success)
     {
         trackxml.Updaterecord(fname);
     }
     return (success);
 }
Exemplo n.º 5
0
        private void BTNlocalsearch_Click(object sender, EventArgs e)
        {
            var trackxml = new XMLutils(appPath + "\\trackxml.xml");

            switch (COMsearch.Text)
            {
            case "No Tag":
                poptreeview(trackxml.SeachRecords("No Tag", "Tagtype"));
                break;

            case "V1 Tags Only":
                poptreeview(trackxml.SeachRecords("V1/", "Tagtype"));
                break;

            case "V2 Tags Only":
                poptreeview(trackxml.SeachRecords("/V2", "Tagtype"));
                break;

            case "V1/V2 Tags":
                poptreeview(trackxml.SeachRecords("V1/V2", "Tagtype"));
                break;

            case "":
                poptreeview(trackxml.GetAllRecords());
                break;

            default:
            {
                string si = COMsearch.Text.Substring(COMsearch.Text.IndexOf("=") + 1);
                if (COMsearch.Text.StartsWith("Artist ="))
                {
                    poptreeview(trackxml.SeachRecords(si, "Artist"));
                }
                if (COMsearch.Text.StartsWith("Album ="))
                {
                    poptreeview(trackxml.SeachRecords(si, "Album"));
                }
                if (COMsearch.Text.StartsWith("Title ="))
                {
                    poptreeview(trackxml.SeachRecords(si, "Title"));
                }
                else
                {
                    poptreeview(trackxml.SeachRecordsall(si));
                }
                break;
            }
            }
        }
Exemplo n.º 6
0
        public static Boolean removeID3v1(string fname)
        {
            Boolean success  = false;
            var     trackxml = new XMLutils(appPath + "\\trackxml.xml");

            if (!String.IsNullOrEmpty(fname) && File.Exists(fname))
            {
                success = ID3v1Tag.RemoveTag(fname);
            }
            if (success)
            {
                trackxml.Updaterecord(fname);
            }
            return(success);
        }
Exemplo n.º 7
0
 public static Boolean Savev1tag(Track mytrack)
 {
     if (!File.Exists(mytrack.Filename))
     {
         MessageBox.Show("File Does not exist " + mytrack.Filename);
         return(false);
     }
     try
     {
         var trackxml = new XMLutils(appPath + "\\trackxml.xml");
         removeID3v1(mytrack.Filename);
         var id3 = new ID3v1Tag(mytrack.Filename);
         if (!String.IsNullOrEmpty(mytrack.Filename) && File.Exists(mytrack.Filename))
         {
             id3.Album  = mytrack.Album;
             id3.Artist = mytrack.Artist;
             id3.Title  = mytrack.Title;
             if (mytrack.Trackno.Contains("/"))
             {
                 id3.TrackNumber = Convert.ToInt16(mytrack.Trackno.Substring(0, mytrack.Trackno.IndexOf("/")));
             }
             else
             {
                 id3.TrackNumber = Convert.ToInt16(mytrack.Trackno);
             }
             id3.Year       = mytrack.Year;
             id3.GenreIndex = GenreHelper.GetGenreIndex(mytrack.Genre);
             // id3.Comment = comment;
             id3.Save(mytrack.Filename);
             trackxml.ModifyRecord(mytrack);
         }
         if (ID3v1Tag.DoesTagExist(mytrack.Filename))
         {
             trackxml.Updaterecord(mytrack.Filename);
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(false);
     }
 }
Exemplo n.º 8
0
        public static Boolean Savev2tag(Track mytrack)
        {
            if (!File.Exists(mytrack.Filename))
            {
                MessageBox.Show("File Does not exist " + mytrack.Filename);
                return(false);
            }
            var trackxml = new XMLutils(appPath + "\\trackxml.xml");

            removeID3v2(mytrack.Filename);
            var id3 = new ID3v2Tag(mytrack.Filename);

            if (!String.IsNullOrEmpty(mytrack.Filename) && File.Exists(mytrack.Filename))
            {
                id3.Album       = mytrack.Album;
                id3.Artist      = mytrack.Artist;
                id3.Title       = mytrack.Title;
                id3.TrackNumber = mytrack.Trackno;
                id3.Year        = mytrack.Year;
                id3.Genre       = mytrack.Genre;

                if (mytrack.coverimage != null)
                {
                    id3.PictureList.Clear();
                    IAttachedPicture picture = id3.PictureList.AddNew();

                    picture.PictureData = ConvertBitMapToByteArray(mytrack.coverimage);
                    picture.PictureType = PictureType.CoverFront;
                }
                id3.Save(mytrack.Filename);
                trackxml.ModifyRecord(mytrack);
            }
            if (ID3v2Tag.DoesTagExist(mytrack.Filename))
            {
                trackxml.Updaterecord(mytrack.Filename);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 9
0
        public static Boolean removeID3v2(string fname)
        {
            Boolean success  = false;
            var     trackxml = new XMLutils(appPath + "\\trackxml.xml");

            if (!String.IsNullOrEmpty(fname) && File.Exists(fname))
            {
                var id3 = new ID3v2Tag(fname);
                if (id3.PictureList.Count > 0)
                {
                    id3.PictureList.Clear();
                }
                success = ID3v2Tag.RemoveTag(fname);
            }
            if (success)
            {
                trackxml.Updaterecord(fname);
            }
            return(success);
        }
Exemplo n.º 10
0
        private void BTNsqlist_Click(object sender, EventArgs e)
        {
            TreeNode node, nodetemp;
            TreeNode mynode;
            var      cats      = new List <string>();
            var      tras      = new BindingList <Track>();
            var      alb       = new List <string>();
            var      trackList = new BindingList <Track>();

            if (File.Exists(appPath + "\\trackxml.xml"))
            {
                try
                {
                    var trackxml = new XMLutils(appPath + "\\trackxml.xml");
                    treeView.Nodes.Clear();
                    cats = trackxml.Getcatagorys("Artist");
                    foreach (string art in cats)
                    {
                        node = treeView.Nodes.Add(art);
                        alb  = trackxml.Getalbums(art);
                        foreach (string myalbum in alb)
                        {
                            mynode = node.Nodes.Add(myalbum);
                            tras   = trackxml.Gettracks(myalbum, art);

                            for (int i = 0; i <= tras.Count - 1; i++)
                            {
                                nodetemp             = mynode.Nodes.Add(tras[i].Title);
                                mynode.ToolTipText   = Path.GetDirectoryName(tras[i].Filename);
                                nodetemp.ToolTipText = tras[i].Filename;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("error in database " + ex.Message);
                }
            }// close file.exists
        }
Exemplo n.º 11
0
 public static Boolean Savev1tag(Track mytrack)
 {
     if (!File.Exists(mytrack.Filename))
     {
         MessageBox.Show("File Does not exist " + mytrack.Filename);
         return false;
     }
     try
     {
         var trackxml = new XMLutils(appPath + "\\trackxml.xml");
         removeID3v1(mytrack.Filename);
         var id3 = new ID3v1Tag(mytrack.Filename);
         if (!String.IsNullOrEmpty(mytrack.Filename) && File.Exists(mytrack.Filename))
         {
             id3.Album = mytrack.Album;
             id3.Artist = mytrack.Artist;
             id3.Title = mytrack.Title;
             if (mytrack.Trackno.Contains("/"))
             {
                 id3.TrackNumber = Convert.ToInt16(mytrack.Trackno.Substring(0, mytrack.Trackno.IndexOf("/")));
             }
             else id3.TrackNumber = Convert.ToInt16(mytrack.Trackno);
             id3.Year = mytrack.Year;
             id3.GenreIndex = GenreHelper.GetGenreIndex(mytrack.Genre);
             // id3.Comment = comment;
             id3.Save(mytrack.Filename);
             trackxml.ModifyRecord(mytrack);
         }
         if (ID3v1Tag.DoesTagExist(mytrack.Filename))
         {
             trackxml.Updaterecord(mytrack.Filename);
             return (true);
         }
         else return (false);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return false;
     }
 }
Exemplo n.º 12
0
 public static Boolean removeID3v2(string fname)
 {
     Boolean success = false;
     var trackxml = new XMLutils(appPath + "\\trackxml.xml");
     if (!String.IsNullOrEmpty(fname) && File.Exists(fname))
     {
         var id3 = new ID3v2Tag(fname);
         if (id3.PictureList.Count > 0)
         {
             id3.PictureList.Clear();
         }
             success = ID3v2Tag.RemoveTag(fname);
     }
     if (success)
     {
         trackxml.Updaterecord(fname);
     }
     return (success);
 }
Exemplo n.º 13
0
Arquivo: Form1.cs Projeto: nowen3/Ntag
        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);

                }

            }
        }
Exemplo n.º 14
0
Arquivo: Form1.cs Projeto: nowen3/Ntag
        private void BTNlocalsearch_Click(object sender, EventArgs e)
        {
            var trackxml = new XMLutils(appPath + "\\trackxml.xml");

            switch (COMsearch.Text)
            {
                case "No Tag":
                    poptreeview(trackxml.SeachRecords("No Tag", "Tagtype"));
                    break;

                case "V1 Tags Only":
                    poptreeview(trackxml.SeachRecords("V1/", "Tagtype"));
                    break;

                case "V2 Tags Only":
                    poptreeview(trackxml.SeachRecords("/V2", "Tagtype"));
                    break;

                case "V1/V2 Tags":
                    poptreeview(trackxml.SeachRecords("V1/V2", "Tagtype"));
                    break;

                case "":
                    poptreeview(trackxml.GetAllRecords());
                    break;

                default:
                    {
                        string si = COMsearch.Text.Substring(COMsearch.Text.IndexOf("=") + 1);
                        if (COMsearch.Text.StartsWith("Artist =")) { poptreeview(trackxml.SeachRecords(si, "Artist")); }
                        if (COMsearch.Text.StartsWith("Album =")) { poptreeview(trackxml.SeachRecords(si, "Album")); }
                        if (COMsearch.Text.StartsWith("Title =")) { poptreeview(trackxml.SeachRecords(si, "Title")); }
                        else { poptreeview(trackxml.SeachRecordsall(si )) ;}
                        break;
                    }
            }
        }
Exemplo n.º 15
0
Arquivo: Form1.cs Projeto: nowen3/Ntag
        private void BTNsqlist_Click(object sender, EventArgs e)
        {
            TreeNode node, nodetemp;
            TreeNode mynode;
            var cats = new List<string>();
            var tras = new BindingList<Track>();
            var alb = new List<string>();
            var trackList = new BindingList<Track>();

            if (File.Exists(appPath + "\\trackxml.xml"))
            {
                try
                {
                    var trackxml = new XMLutils(appPath + "\\trackxml.xml");
                    treeView.Nodes.Clear();
                    cats = trackxml.Getcatagorys("Artist");
                    foreach (string art in cats)
                    {
                        node = treeView.Nodes.Add(art);
                        alb = trackxml.Getalbums(art);
                        foreach (string myalbum in alb)
                        {
                            mynode = node.Nodes.Add(myalbum);
                            tras = trackxml.Gettracks(myalbum, art);

                            for (int i = 0; i <= tras.Count - 1; i++)
                            {
                                nodetemp = mynode.Nodes.Add(tras[i].Title);
                                mynode.ToolTipText = Path.GetDirectoryName(tras[i].Filename);
                                nodetemp.ToolTipText = tras[i].Filename;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("error in database " + ex.Message);
                }
            }// close file.exists
        }
Exemplo n.º 16
0
Arquivo: Form1.cs Projeto: nowen3/Ntag
 private void openDatabaseToolStripMenuItem_Click(object sender, EventArgs e)
 {
     var trackxml = new XMLutils(appPath + "\\trackxml.xml");
     poptreeview(trackxml.GetAllRecords());
 }
Exemplo n.º 17
0
        private void openDatabaseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var trackxml = new XMLutils(appPath + "\\trackxml.xml");

            poptreeview(trackxml.GetAllRecords());
        }
Exemplo n.º 18
0
        public static Boolean Savev2tag(Track mytrack)
        {
            if (!File.Exists(mytrack.Filename))
            {
                MessageBox.Show("File Does not exist " + mytrack.Filename);
                return false;
            }
            var trackxml = new XMLutils(appPath + "\\trackxml.xml");
            removeID3v2(mytrack.Filename);
            var id3 = new ID3v2Tag(mytrack.Filename);
            if (!String.IsNullOrEmpty(mytrack.Filename) && File.Exists(mytrack.Filename))
            {
                id3.Album = mytrack.Album;
                id3.Artist = mytrack.Artist;
                id3.Title = mytrack.Title;
                id3.TrackNumber = mytrack.Trackno;
                id3.Year = mytrack.Year;
                id3.Genre = mytrack.Genre;

                if (mytrack.coverimage !=null)
                {
                    id3.PictureList.Clear();
                    IAttachedPicture picture = id3.PictureList.AddNew();

                    picture.PictureData = ConvertBitMapToByteArray(mytrack.coverimage);
                    picture.PictureType = PictureType.CoverFront;

                }
                id3.Save(mytrack.Filename);
                trackxml.ModifyRecord(mytrack);
            }
            if (ID3v2Tag.DoesTagExist(mytrack.Filename))
            {
                trackxml.Updaterecord(mytrack.Filename);
                return (true);
            }
            else return (false);
        }
Exemplo n.º 19
0
Arquivo: Form1.cs Projeto: nowen3/Ntag
        private void renameFileFromTagsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FRMrename renamewin = new FRMrename();
            ListView.SelectedListViewItemCollection filename = this.musicListStore.SelectedItems;
            var trackxml = new XMLutils(appPath + "\\trackxml.xml");

            foreach (ListViewItem item in filename)
            {
                renamewin.Addtrack(item.SubItems[1].Text, item.SubItems[0].Text);
            }
            if (renamewin.ShowDialog(this) == DialogResult.OK)
            {
                for (int x = 0; x <= renamewin.Gettrack_Count_Before() - 1; x++)
                {
                    if (x <= renamewin.Gettrack_Count_After() - 1)
                    {
                        if (File.Exists(renamewin.Getoldtrackname(x)) & !File.Exists(renamewin.Getnewtrackname(x)))
                        {
                            File.Move(renamewin.Getoldtrackname(x), renamewin.Getnewtrackname(x));
                            trackxml.Updatefilename(renamewin.Getoldtrackname(x), renamewin.Getnewtrackname(x));
                            //Miscutils.UpdateFname(renamewin.Getoldtrackname(x), renamewin.Getnewtrackname(x)); //update xml
                            Reloadfilenames(renamewin.Getoldtrackname(x), renamewin.Getnewtrackname(x));
                        }
                        else
                        {
                            MessageBox.Show("File Error " + renamewin.Getoldtrackname(x));
                        }
                    }
                }
            }
        }
Exemplo n.º 20
0
Arquivo: Form1.cs Projeto: nowen3/Ntag
        private void openfolder(object sender, DoWorkEventArgs e)
        {
            var scandirectory = new ScanDir(myopenfilename);
            scandirectory.OnListFiles += Onaddtolistview;
            scandirectory.UpdateProgress += UpdateProgress;
            scandirectory.Run_Scan();
            var trackxml = new XMLutils(appPath + "\\trackxml.xml");
            trackxml.Addrecord(scandirectory.tracks);

            //poptreeview(scandirectory.tracks);
        }