2017-07-27 4 views
0

Ich mache eine Media Player-Anwendung mit AXWMPlib, die eine Wiedergabeliste hat. was ich erfolgreich tun konnte, war das Speichern der Playlist-Elemente in einer Textdatei.AxWMPlib: So laden Sie Wiedergabeliste aus einer externen Datei

unten ist der Code für das Speichern:

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 

ich weiß nicht, wie die Linien in Strom gespeichert lesen() und fügen Sie sie in Strom:

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 

zum Laden von i bis hier geschrieben Wiedergabeliste.

Antwort

0

eine Lösung gefunden:

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 
Verwandte Themen