2017-07-27 79 views
0

我正在使用帶有播放列表的AXWMPlib製作媒體播放器應用程序。 我成功能夠做到的是將播放列表項目保存在文本文件中。AxWMPlib:如何從外部文件加載播放列表

下面

是用於保存代碼:我不知道如何讀)存儲在電流(線和電流追加他們

If OpenPlaylist.ShowDialog = Windows.Forms.DialogResult.OK Then 
      Dim readfile As New System.IO.StreamReader(OpenPlaylist.FileName) 
      Dim ob As String = readfile.ReadToEnd() 
      Dim content() As String = OpenPlaylist.FileName.Split(Environment.NewLine) 

     End If 

If SavePlaylist.ShowDialog = Windows.Forms.DialogResult.OK Then 
     Dim writefile As New System.IO.StreamWriter(SavePlaylist.FileName) 
     For i = 0 To lstview.Items.Count - 2 
      writefile.WriteLine(Form1.main.AxWMP1.currentPlaylist.Item(i).sourceURL) 
     Next 
     writefile.Write(Form1.main.AxWMP1.currentPlaylist.Item(Form1.main.AxWMP1.currentPlaylist.count - 1).sourceURL) 
     writefile.Close() 
    End If 

裝載我寫到這裏播放列表。

回答

0

找到了解決辦法:

If Open.ShowDialog = Windows.Forms.DialogResult.OK Then 
       Dim readfile As New System.IO.StreamReader(Open.FileName) 
       Dim ob As String = readfile.ReadToEnd() 
       Dim content() As String = ob.Split(Environment.NewLine) 

       For Each Line As String In content 
        Dim item As IWMPMedia = Form1.AxWMP1.newMedia(Line) 
        Form1.AxWMP1.currentPlaylist.appendItem(item) 
       Next 

      End If