Oleg,
I used your example to also create a solution:
VS 2012 Ultimate
I used your example to also create a solution:
Function SendCommand(cmd As String, s As ShellStream) As String
Try
reader = New StreamReader(s)
writer = New StreamWriter(s)
writer.AutoFlush = True
writer.WriteLine(cmd)
While s.Length = 0
Thread.Sleep(500)
End While
Catch ex As Exception
Debug.WriteLine("SendCommand(" & cmd & ") caught exception: " & ex.ToString())
End Try
Return reader.ReadToEnd()
End Function
Function SendCommandW(cmd As String, s As ShellStream) As String
Try
reader = New StreamReader(s)
writer = New StreamWriter(s)
writer.AutoFlush = True
writer.Write(cmd)
While s.Length = 0
Thread.Sleep(500)
End While
Catch ex As Exception
Debug.WriteLine("SendCommandW(" & cmd & ") caught exception: " & ex.ToString())
End Try
Return reader.ReadToEnd()
End Function
Function SendCommandCR(cmd As String, s As ShellStream) As String
Try
reader = New StreamReader(s)
writer = New StreamWriter(s)
writer.AutoFlush = True
writer.Write(cmd & vbCr)
While s.Length = 0
Thread.Sleep(500)
End While
Catch ex As Exception
Debug.WriteLine("SendCommandCR(" & cmd & ") caught exception: " & ex.ToString())
End Try
Return reader.ReadToEnd()
End Function
Function SendCommandLF(cmd As String, s As ShellStream) As String
Try
reader = New StreamReader(s)
writer = New StreamWriter(s)
writer.AutoFlush = True
writer.Write(cmd & vbLf)
While s.Length = 0
Thread.Sleep(500)
End While
Catch ex As Exception
Debug.WriteLine("SendCommandLF(" & cmd & ") caught exception: " & ex.ToString())
End Try
Return reader.ReadToEnd()
End Function
A little respect for the VB.NET folks!VS 2012 Ultimate