Closed Arielegend closed 9 months ago
Hello all I'm trying to build a webApp to communicate my server that is running Autodoc. At server side I have cloned, initialized and indexed some repos.
I wish to build a portal to have a dialog with my server, using SshNet.
I have many issues, and cant see why I'm failing.
Any help?
this is my code I have been trying.
public void NavigateToFolder(string folder) { try { ShellStream stream = _client.CreateShellStream("commands", 0, 0, 0, 0, 1024); sendCommand("cd autodoc-poc/<My-Repo>", stream); sendCommand("doc q", stream); } catch (SshException sshException) { } } public StringBuilder sendCommand(string customCMD, ShellStream stream) { StringBuilder answer; var reader = new StreamReader(stream); var writer = new StreamWriter(stream); writer.AutoFlush = true; WriteStream(customCMD, writer, stream); answer = ReadStream(reader); return answer; } private void WriteStream(string cmd, StreamWriter writer, ShellStream stream) { writer.WriteLine(cmd); while (stream.Length == 0) { Thread.Sleep(500); } } private StringBuilder ReadStream(StreamReader reader) { StringBuilder result = new StringBuilder(); string line; while ((line = reader.ReadLine()) != null) { result.AppendLine(line); } return result; }
Hello all I'm trying to build a webApp to communicate my server that is running Autodoc. At server side I have cloned, initialized and indexed some repos.
I wish to build a portal to have a dialog with my server, using SshNet.
I have many issues, and cant see why I'm failing.
Any help?
this is my code I have been trying.