I am making a WPF application of a media player from scratch. I have added a listbox where I can switch from one song to the next. I want to save this list as an m3u playlist and I want to be able to read m3u file too. I am using mediaelement. How do I do this?

有帮助吗?

解决方案

every line in a m3u list represents a mp3 file

var mru = yourFileList.OfType<YourFileListType>().Select(f => f.TheFileName);
// .Net 4.0
File.WriteAllLines("YourM3uFile.m3u", mru);
// .Net 3.5
File.WriteAllLines("YourM3uFile.m3u", mru.ToArray());

hope that helps

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top