private void saveM3uToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!pnlM3UPlayList.Visible)
            {
                return;
            }

            string msg = string.Empty;

            if (tbM3UDir.Text.Length < 0)
            {
                msg = "You must have a valid M3U path selected! \n";
            }

            if (tbM3UFileName.Text.Length < 0 || tbM3UFileName.Text.IndexOfAny(Path.GetInvalidFileNameChars()) != -1)
            {
                msg += "You must have a valid file name! \n File name cannot cantain any of these characters:" +
                       Path.GetInvalidFileNameChars().ToString();
            }

            if (msg.Length < 0)
            {
                MessageBox.Show("Error!", msg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            OperationResult op = new OperationResult();
            M3UEditor       me = new M3UEditor();

            string fileName = Path.Combine(tbM3UDir.Text, tbM3UFileName.Text);

            me.SetM3U(fileName, uftM3U.GetStrList(BCHControls.UCFromToEnum.To), true, ref op);

            if (!op.Success)
            {
                MessageBox.Show("Error!", op.GetAllMessages("\n"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }



            me.CreateM3U(ref op);

            if (!op.Success)
            {
                MessageBox.Show("Error!", op.GetAllMessages("\n"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            MessageBox.Show("Complete!", "M3U File Created.", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Beispiel #2
0
        private void saveM3uToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!pnlM3UPlayList.Visible)
            {
                return;
            }

            string msg = string.Empty;

            if (dddtbM3uPath.ItemText.Length < 0)
            {
                msg = "You must have a valid M3U path selected! \n";
            }

            if (tbM3UFileName.Text.Length < 0 || tbM3UFileName.Text.IndexOfAny(Path.GetInvalidFileNameChars()) != -1)
            {
                msg += "You must have a valid file name! \n File name cannot cantain any of these characters:" +
                       Path.GetInvalidFileNameChars().ToString();
            }

            if (ckbDoArchosFormat.Checked && string.IsNullOrEmpty(dddtbMusicDir.ItemText))
            {
                msg += "You must have an Archos Directory";
            }

            if (msg.Length < 0)
            {
                MessageBox.Show(msg, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            OperationResult op = new OperationResult();
            M3UEditor       me = new M3UEditor();

            string fileName = Path.Combine(dddtbM3uPath.ItemText, tbM3UFileName.Text);

            me.SetM3U(fileName, uftM3U.GetStrList(BCHControls.UCFromToEnum.To), true, ref op);

            if (!op.Success)
            {
                MessageBox.Show(op.GetAllMessages("\n"), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (rbDoArchosM3UFormat.Checked || rbPlainM3U.Checked)
            {
                if (rbDoArchosM3UFormat.Checked)
                {
                    ConvertToArchosFormat(ref me, ref op);
                    if (!op.Success)
                    {
                        MessageBox.Show(op.GetAllMessages("\n"), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }

                me.CreateM3U(ref op);
            }
            else
            {
                SaveMediaPlayerFormat(fileName, ref me, ref op);
            }



            MessageBox.Show("M3U File Created.", "Complete!", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }