private void btnBrowse_Click(object sender, EventArgs e)
 {
     if(ofdResetOpen.ShowDialog() == DialogResult.OK)
     {
         String path = ofdResetOpen.FileName;
         String name = Path.GetFileName(path);
         tbxResetSnd.Text = name;
         if (m_resetSnd == null)
             m_resetSnd = new CPlaylistEntry();
         m_resetSnd.Name = name;
         m_resetSnd.Path = path;
     }
 }
 public bool Load(String filepath)
 {
     bool updatePath = false;
     try
     {
         using (StreamReader sr = new StreamReader(filepath))
         {
             Name = sr.ReadLine();
             Path = sr.ReadLine();
             if (Path != filepath)
             {
                 Path = filepath;
                 updatePath = true;
             }
             String rand = sr.ReadLine();
             Random = bool.Parse(rand);
             String volume = sr.ReadLine();
             Volume = double.Parse(volume);
             String line = "";
             String[] parts = { "" };
             while(!sr.EndOfStream)
             {
                 line = sr.ReadLine();
                 parts = line.Split(',');
                 if(parts.Length > 1)
                 {
                     CPlaylistEntry entry = new CPlaylistEntry();
                     entry.Name = parts[0];
                     entry.Path = parts[1];
                     Playlist.Add(entry);
                 }
             }
         }
         if (updatePath)
             Save();
         return true;
     }
     catch (Exception ex)
     {
         String msg = Environment.NewLine + ex.Message;
         if (ex.InnerException != null)
             msg += Environment.NewLine + ex.InnerException.Message;
         MessageBox.Show("Unable to read playlist file " + filepath + ": " + msg, "Unable to Read Playlist");
     }
     return false;
 }
 private void lbxPlaylist_DragDrop(object sender, DragEventArgs e)
 {
     if (cbxPlaylistSelect.SelectedItem == null)
         createPlaylist();
     CPlaylistEntry temp = new CPlaylistEntry();
     temp.Path = e.Data.GetData("System.String", true).ToString();
     temp.Name = Path.GetFileName(temp.Path);
     m_playlist.Playlist.Add(temp);
     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 = true;
 }
 private void load()
 {
     try
     {
         String path = CListFileUtil.GetBasePathFromRegistry();
         if (String.IsNullOrEmpty(path))
         {
             path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
             CListFileUtil.SetBasePathInRegistry(path);
         }
         tbxBaseSoundPath.Text = path;
     }
     catch (Exception ex)
     {
         String msg = "Unable to read base path from Registry....";
         msg += Environment.NewLine + ex.Message;
         if (ex.InnerException != null)
             msg += Environment.NewLine + ex.InnerException.Message;
         MessageBox.Show(msg, "Unable to Read Base Path");
         if (!Directory.Exists(tbxBaseSoundPath.Text))
         {
             tbxBaseSoundPath.Text = CListFileUtil.GetBasePathFromRegistry();
         }
         nudRankPerRnd.Value = 30;
         m_resetSnd = new CPlaylistEntry();
         return;
     }
     String settingsFileName = tbxBaseSoundPath.Text + "\\settings.sf";
     if (File.Exists(settingsFileName))
     {
         try
         {
             using (StreamReader sr = new StreamReader(settingsFileName))
             {
                 nudRankPerRnd.Value = int.Parse(sr.ReadLine());
                 String line = sr.ReadLine();
                 String[] parts = line.Split(',');
                 if (parts.Length > 1)
                 {
                     m_resetSnd = new CPlaylistEntry();
                     m_resetSnd.Name = parts[0];
                     m_resetSnd.Path = parts[1];
                 }
                 tbxResetSnd.Text = m_resetSnd.Path;
             }
         }
         catch (Exception ex)
         {
             String msg = "Unable to load settings....";
             msg += Environment.NewLine + ex.Message;
             if (ex.InnerException != null)
                 msg += Environment.NewLine + ex.InnerException.Message;
             MessageBox.Show(msg, "Unable to Load Settings");
         }
     }
 }
 public FOptions()
 {
     InitializeComponent();
     m_resetSnd = new CPlaylistEntry();
     load();
 }