示例#1
0
        private void SavePlayList(string path)
        {
            MFPlayList playList = new MFPlayList();

            foreach (ListViewItem item in lvwPlayList.Items)
            {
                playList.Files.Add(item.Text);
            }

            playList.CurrentFile = currentFile_;

            try
            {
                using (System.IO.Stream s = new System.IO.FileStream(path,
                    System.IO.FileMode.Create,
                    System.IO.FileAccess.Write))
                {
                    xs_.Serialize(s, playList);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this,
                    "Unable to save Play List file:" + path + ",Error:" + ex.Message,
                    "Save Play List Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }
        }