1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
Private StrData As New StringBuilder
Dim out As String() = Nothing
Private Sub Analyse()
Dim AnalyserVideo As New Process With {
.StartInfo = New ProcessStartInfo With {
.FileName = "Tools\youtube-dl.exe",
.Arguments = " -F " & TextBox_URL.Text,
.UseShellExecute = False,
.CreateNoWindow = True,
.RedirectStandardOutput = True,
.RedirectStandardInput = True,
.RedirectStandardError = True
},
.EnableRaisingEvents = True
}
AnalyserVideo.Start()
AddHandler AnalyserVideo.OutputDataReceived, Sub(processSender As Object, lineOut As DataReceivedEventArgs)
StrData.AppendLine(lineOut.Data & Environment.NewLine)
End Sub
AnalyserVideo.BeginOutputReadLine()
AddHandler AnalyserVideo.ErrorDataReceived, Sub(processSender As Object, lineOut As DataReceivedEventArgs)
StrData.AppendLine(lineOut.Data & Environment.NewLine)
End Sub
AnalyserVideo.BeginErrorReadLine()
Using Sortie_Input = AnalyserVideo.StandardInput()
While True
Threading.Thread.Sleep(500)
If StrData.ToString.Contains("resolution note") Then
out = StrData.ToString.Split(",")
ComboBox_Format.Items.AddRange(New String() {out(2)})
Dim count = ComboBox_Format.Items.Count
ComboBox_Format.SelectedIndex = count - 1
Exit While
End If
End While
MessageBox.Show("fini de créer la liste!", "Lecture", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Using
AnalyserVideo.WaitForExit()
AnalyserVideo.Dispose()
End Sub |
Partager