Dato che ora l'ho cancellato, lo riscrivo a memoria:
codice:
Private W As IO.StreamWriter
Private Sub bgConvert_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bgConvert.DoWork
Dim Info As ConvertInfo = e.Argument
Dim Lame As String = Application.StartupPath & "\lame.exe"
Dim P As Process
Dim Index As Int32 = 0
bgConvert.ReportProgress(0, Info.Files.Count)
For Each File As String In Info.Files
P = New Process
P.StartInfo.FileName = Lame
P.StartInfo.Arguments = Info.Arguments & String.Format("{0}{1}{0} {0}{2}{0}", Chr(34), File, Info.Folder & "\" & IO.Path.GetFileNameWithoutExtension(File) & ".mp3")
P.StartInfo.UseShellExecute = False
P.StartInfo.RedirectStandardOutput = True
P.StartInfo.CreateNoWindow = True
W = New IO.StreamWriter("output.txt")
AddHandler P.DataReceived, AddressOf Process_DataReceived
P.Start()
P.BeginOutputReadLine()
P.WaitForExit()
RemoveHandler P.DataReceived, AddressOf Process_DataReceived
W.Close()
Index += 1
bgConvert.ReportProgress(Index, Info.Files.Count)
Next
End Sub
Private Sub Process_DataReceived(ByVal sender As Object, ByVal e As DataReceivedEventArgs)
W.WriteLine(e.Data)
End Sub
Grossomodo era questo.