private void openM3UToolStripMenuItem_Click(object sender, EventArgs e) { openFileDialog1.ShowDialog(); if (openFileDialog1.FileName.Trim().Length < 1 || !File.Exists(openFileDialog1.FileName)) { MessageBox.Show("You must choose a file!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } OperationResult op = new OperationResult(); M3UEditor me = new M3UEditor(); me.SetM3U(openFileDialog1.FileName, new List <string>(), false, ref op); if (!op.Success) { MessageBox.Show(op.GetAllMessages("\n"), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } uftM3U.SetListBox(me.M3USongList, BCHControls.UCFromToEnum.To, true); uftM3U.SetListBox(me.M3USongList, BCHControls.UCFromToEnum.From, true); tbM3UFileName.Text = me.M3UFileName; dddtbM3uPath.ItemText = me.M3UPath; }
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); }
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); }