private void btnClear_Click(object sender, EventArgs e) { if (m_playlist == null) m_playlist = new CPlaylist(); m_playlist.Playlist.Clear(); lbxPlaylist.Items.Clear(); }
public static void CreatePlaylist(ref CPlaylist list, ref ComboBox cbx, ref ListBox lbx, String name, String path) { list = new CPlaylist(); list.Name = name; list.Path = path + "\\" + name; lbx.Items.Clear(); cbx.Items.Add(list); cbx.Sorted = false; cbx.Sorted = true; cbx.Invalidate(); cbx.Refresh(); for (int i = 0; i < cbx.Items.Count; ++i) { if (cbx.Items[i].ToString() == list.Name) { cbx.SelectedIndex = i; break; } } }
private void cbxPlaylistSelect_SelectedIndexChanged(object sender, EventArgs e) { if (m_doNotSelect) return; if(m_dirty) { DialogResult result = MessageBox.Show("Do you wish to save changes to " + m_playlist.Name + "?", "Save Changes?", MessageBoxButtons.YesNoCancel); if (result == System.Windows.Forms.DialogResult.Cancel) return; if (result == System.Windows.Forms.DialogResult.Yes) m_playlist.Save(); } String playlistPath = CListFileUtil.GetBasePathFromRegistry();; playlistPath += "\\Playlists\\" + cbxPlaylistSelect.Text; if (cbxPlaylistSelect.SelectedIndex >= 0) m_playlist = (CPlaylist)cbxPlaylistSelect.SelectedItem; if(m_playlist != null) { lbxPlaylist.Items.Clear(); foreach (CPlaylistEntry entry in m_playlist.Playlist) lbxPlaylist.Items.Add(entry); lbxPlaylist.Sorted = false; lbxPlaylist.Sorted = true; lbxPlaylist.Invalidate(); lbxPlaylist.Refresh(); } m_dirty = false; }
private void FPlaylistEditor_VisibleChanged(object sender, EventArgs e) { if (!Visible) return; String startPath = CListFileUtil.GetBasePathFromRegistry(); startPath += "\\Audio"; tbxFolder.Text = startPath; String playlistPath = CListFileUtil.GetBasePathFromRegistry();; playlistPath += "\\Playlists\\"; String[] files = Directory.GetFiles(playlistPath, "*.playlist"); cbxPlaylistSelect.Items.Clear(); foreach (String file in files) { CPlaylist list = new CPlaylist(); list.Load(file); cbxPlaylistSelect.Items.Add(list); } if (cbxPlaylistSelect.Items.Count > 0) cbxPlaylistSelect.SelectedIndex = 0; }
public static bool RemapPlaylistBasePath(ref CPlaylist list, string optionsBasePath) { // all playlists and all audio files will reside at the provided base path in // <optionsBasePath>/Audio and <optionsBasePath>/Playlists respectively bool updated = false; List<CPlaylistEntry> removeList = new List<CPlaylistEntry>(); string temp = list.Path; if (!temp.Contains(optionsBasePath)) updated = true; int index = temp.LastIndexOf("Playlist"); list.Path = optionsBasePath + "\\" + temp.Substring(index); foreach(CPlaylistEntry entry in list.Playlist) { temp = entry.Path; if (!temp.Contains(optionsBasePath)) { updated = true; index = temp.LastIndexOf("Audio"); entry.Path = optionsBasePath + "\\" + temp.Substring(index); if (!File.Exists(entry.Path)) removeList.Add(entry); } } foreach (CPlaylistEntry entry in removeList) list.Playlist.Remove(entry); return updated; }
private void showPlaylistEditor() { if (m_playlistEditor == null) m_playlistEditor = new FPlaylistEditor(); m_playlistEditor.ShowDialog(); String playlistPath = CListFileUtil.GetBasePathFromRegistry();; if (playlistPath.Contains("\\bin\\Debug") || playlistPath.Contains("\\bin\\Release")) { playlistPath = playlistPath.Replace("\\bin\\Debug", ""); playlistPath = playlistPath.Replace("\\bin\\Release", ""); } playlistPath += "\\Playlists\\"; String[] files = Directory.GetFiles(playlistPath, "*.playlist"); lbxPlaylistSelect.Items.Clear(); foreach (String file in files) { CPlaylist list = new CPlaylist(); list.Load(file); lbxPlaylistSelect.Items.Add(list); } }
private void loadPlaylists() { String basePath = CListFileUtil.GetBasePathFromRegistry(); String[] files = Directory.GetFiles(basePath + "\\Playlists", "*.playlist"); lbxPlaylistSelect.Items.Clear(); foreach (String file in files) { CPlaylist list = new CPlaylist(); list.Load(file); if(CListFileUtil.RemapPlaylistBasePath(ref list, basePath)) list.Save(); lbxPlaylistSelect.Items.Add(list); } files = Directory.GetFiles(basePath + "\\Playlists", "*.roundlist"); lbxRoundSelect.Items.Clear(); foreach (String file in files) { CPlaylist list = new CPlaylist(); list.Load(file); if (CListFileUtil.RemapPlaylistBasePath(ref list, basePath)) list.Save(); lbxRoundSelect.Items.Add(list); } files = Directory.GetFiles(basePath + "\\Playlists", "*.ranklist"); lbxRankSelect.Items.Clear(); foreach (String file in files) { CPlaylist list = new CPlaylist(); list.Load(file); if (CListFileUtil.RemapPlaylistBasePath(ref list, basePath)) list.Save(); lbxRankSelect.Items.Add(list); } }
private void lbxRoundSelect_SelectedIndexChanged(object sender, EventArgs e) { if (lbxRoundSelect.SelectedIndex < 0) return; m_roundlist = (CPlaylist)lbxRoundSelect.SelectedItem; tbrFXVol.Value = (Int32)(m_roundlist.Volume * 50); }
private void lbxPlaylistSelect_SelectedIndexChanged(object sender, EventArgs e) { if (lbxPlaylistSelect.SelectedIndex < 0) return; if (m_playlist == null) { m_playlist = (CPlaylist)lbxPlaylistSelect.SelectedItem; tbrVolume.Value = (Int32)(m_playlist.Volume * 50); m_playlist.Play(); } else { m_playlist.Stop(); m_playlist = (CPlaylist)lbxPlaylistSelect.SelectedItem; tbrVolume.Value = (Int32)(m_playlist.Volume * 50); m_playlist.Play(); } }