コード例 #1
0
        private void fileAdd_Click(object sender, EventArgs e)
        {
            List <CommonFileDialogFilter> cfdf = new List <CommonFileDialogFilter>();

            cfdf.Add(new CommonFileDialogFilter("所有文件", "*.*"));
            cfdf.Add(new CommonFileDialogFilter("MP3", ".MP3"));
            cfdf.Add(new CommonFileDialogFilter("WAV", ".WAV"));
            cfdf.Add(new CommonFileDialogFilter("WMA", ".WMA"));
            cfdf.Add(new CommonFileDialogFilter("APE", ".APE"));
            cfdf.Add(new CommonFileDialogFilter("FLAC", ".FLAC"));
            cfdf.Add(new CommonFileDialogFilter("AAC", ".AAC"));
            cfdf.Add(new CommonFileDialogFilter("M4a", ".M4A"));
            cfdf.Add(new CommonFileDialogFilter("MP4", ".MP4"));
            cfdf.Add(new CommonFileDialogFilter("OGG", ".OGG"));
            List <string> files = FileOpenDialog.ShowDialog("Cup Player", false, cfdf);

            if (files != null)
            {
                XmlDocument xmlDoc = InitXml();
                XmlNode     root   = xmlDoc.SelectSingleNode("SongList");
                foreach (string file in files)
                {
                    Song s = new Song(file, CommonProperty.getTitleFromPath(file));
                    ReadInfoFromFile(s);
                    root.AppendChild(CreateElement(xmlDoc, s));
                    PlayController.Songs.Add(s);
                }
                xmlDoc.Save(XmlListPath);
            }
        }
コード例 #2
0
        private void folderAdd_Click(object sender, EventArgs e)
        {
            List <string> result = FileOpenDialog.ShowDialog("Cup Player");

            if (result != null)
            {
                Folder_Open(result[0], FileOpenDialog.isContainSubfolder);
            }
        }
コード例 #3
0
        private void playlistAdd_Click(object sender, EventArgs e)
        {
            List <CommonFileDialogFilter> cfdf = new List <CommonFileDialogFilter>();

            cfdf.Add(new CommonFileDialogFilter("播放列表文件", "*.pldb"));
            List <string> result = FileOpenDialog.ShowDialog("Cup Player", false, cfdf);

            if (result != null)
            {
                LoadSongList(result[0]);
            }
        }