Esempio n. 1
0
        private void tsbOpenPlayList_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "サポートする全てのプレイリスト(*.xml;*.m3u)|*.xml;*.m3u|ファイル(*.xml)|*.xml|M3Uファイル(*.m3u)|*.m3u";
            ofd.Title  = "プレイリストファイルを選択";
            if (frmMain.setting.other.DefaultDataPath != "" && Directory.Exists(frmMain.setting.other.DefaultDataPath) && IsInitialOpenFolder)
            {
                ofd.InitialDirectory = frmMain.setting.other.DefaultDataPath;
            }
            else
            {
                ofd.RestoreDirectory = true;
            }
            ofd.CheckPathExists = true;

            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            IsInitialOpenFolder = false;

            try
            {
                PlayList pl = null;

                if (ofd.FileName.ToLower().LastIndexOf(".m3u") == -1)
                {
                    pl       = PlayList.Load(ofd.FileName);
                    playing  = false;
                    playList = pl;
                    playList.SetDGV(dgvList);
                }
                else
                {
                    pl      = PlayList.LoadM3U(ofd.FileName);
                    playing = false;
                    playList.lstMusic.Clear();
                    foreach (PlayList.music ms in pl.lstMusic)
                    {
                        playList.AddFile(ms.fileName);
                        //AddList(ms.fileName);
                    }
                }

                playIndex    = -1;
                oldPlayIndex = -1;

                Refresh();
            }
            catch (Exception ex)
            {
                log.ForcedWrite(ex);
                MessageBox.Show("ファイルの読み込みに失敗しました。");
            }
        }