02-02-23, 06:51 PM
(01-02-23, 06:30 PM)HASNI14 كتب : السلام عليكم يا ريت مساعدة من فضلكم .
انشأت برنامج و وضعة له LISTVIEW
اريد عند وضع رابط موقع على TEXBOX يفتح روابط موجودة في موقع M3U على LISTVIEW
و عليكم السلام
تفضل
كود :
Imports System.Net
Imports System.Reflection
Imports System
Public Class Form1
Private Function read_m3u() As String
Dim Encoding As New Text.UTF8Encoding
Dim Bytes As Byte() = Encoding.GetBytes("")
Dim AJ As Net.HttpWebRequest = DirectCast(Net.WebRequest.Create("http://62.171.175.99:25461/get.php?username=6H8p5AOYS9&password=GNFkHrKCOp&type=m3u"), Net.HttpWebRequest)
With AJ
.Method = "GET"
.Proxy = Nothing
.UserAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36"
.ContentLength = Bytes.Length
End With
Dim Response As Net.HttpWebResponse = DirectCast(AJ.GetResponse, Net.HttpWebResponse)
Dim reader As New IO.StreamReader(Response.GetResponseStream) : Dim m3u As String = reader.ReadToEnd : reader.Dispose() : reader.Close() : Response.Dispose() : Response.Close()
Return m3u
End Function
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim list As New List(Of ListViewItem)
Dim Lines As String() = read_m3u.Split(Global.Microsoft.VisualBasic.ChrW(10))
Dim row(1) As String
For Each line As String In Lines
If line.Trim.StartsWith("#EXTINF") Then
row(0) = line.Split(",")(1)
ElseIf line.Trim.StartsWith("http://") Then
row(1) = line.Trim
list.Add(New ListViewItem(row))
End If
Next
ListView1.Items.AddRange(list.ToArray)
End Sub
End Class