Ejemplo n.º 1
0
        public override void ThreadFunc()
        {
            foreach (FileInfo fi in infos)
            {
                OnStatusUpdate(fi.Name);

                TagLib.File tag_file = TagLib.File.Create(fi.FullName);

                File2TagFormatEvaluator eval = new File2TagFormatEvaluator(format, tag_file);
            }

            OnStatusUpdate("Finished");

            // HACK!!
            System.Threading.Thread.Sleep(0);
            //SafeClose();
        }
Ejemplo n.º 2
0
        ///// <summary>
        ///// intialize listview
        ///// </summary>
        ///// <param name="lv"></param>
        //public virtual void Initialize()
        //{
        //    if(lv.SelectedItems.Count > 0)
        //    {
        //        idx = 0;
        //    }

        //    //string[] fmts = new string[Properties.Settings.Default.org_formats.Count];
        //    //Properties.Settings.Default.org_formats.CopyTo( fmts, 0 );
        //    //cmbFormat.Items.AddRange( fmts );
        //    //cmbFormat.SelectedIndex = 0;
        //}

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(cmbFormat.Text))
            {
                MessageBox.Show(
                    "Please eneter a valid format and path.",
                    "Invalid",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Asterisk);
                return;
            }

            ListView.SelectedListViewItemCollection items = lv.SelectedItems;
            int len = items.Count;

            FileInfo[] infos = new FileInfo[len];

            for (int i = 0; i < len; ++i)
            {
                infos[i] = items[i].Tag as FileInfo;
            }

            //Threading.File2TagProgressThread thread = new Threading.File2TagProgressThread(
            //    infos,
            //    cmbFormat.Text );
            //thread.Start();


            foreach (FileInfo fi in infos)
            {
                TagLib.File             tag_file = TagLib.File.Create(fi.FullName);
                File2TagFormatEvaluator eval     = new File2TagFormatEvaluator(cmbFormat.Text, tag_file);
                tag_file.Save();
            }
            view.RefreshView();
            Close();
        }