Hi,
My program is access the remote system's command prompt through C# program. I can do it. But problem is alignment of that output.
can any one give idea to align that output ?.
here is my code........... ...........
try
{
SshShell ssh1 = new SshShell(host,u ser,pass);
SshStream ssh = new SshStream(host, user, pass);
Console.WriteLi ne("------Connecting...") ;
ssh1.Connect();
Console.Write(" OK");
Console.WriteLi ne();
//ssh.Prompt ="$";
ssh1.RemoveTerm inalEmulationCh aracters = true;
Console.Write(s sh1.Expect("$") );
//ssh1.Expect("$" );
while (true)
{
Console.Write(" Ent the cmd:");
string command = Console.ReadLin e();
if (command.ToLowe r().Equals("exi t"))
break;
ssh1.WriteLine( command);
string out1 = ssh1.Expect(">" );
out1 = out1.Replace(" ", "\n ");
out1 = "\n" + out1;
Console.WriteLi ne(out1);
//Console.WriteLi ne(ssh1.Expect( ">"));
}
ssh1.Close();
ssh.Close();
Console.WriteLi ne("Connection closed.");
}
My program is access the remote system's command prompt through C# program. I can do it. But problem is alignment of that output.
can any one give idea to align that output ?.
here is my code........... ...........
try
{
SshShell ssh1 = new SshShell(host,u ser,pass);
SshStream ssh = new SshStream(host, user, pass);
Console.WriteLi ne("------Connecting...") ;
ssh1.Connect();
Console.Write(" OK");
Console.WriteLi ne();
//ssh.Prompt ="$";
ssh1.RemoveTerm inalEmulationCh aracters = true;
Console.Write(s sh1.Expect("$") );
//ssh1.Expect("$" );
while (true)
{
Console.Write(" Ent the cmd:");
string command = Console.ReadLin e();
if (command.ToLowe r().Equals("exi t"))
break;
ssh1.WriteLine( command);
string out1 = ssh1.Expect(">" );
out1 = out1.Replace(" ", "\n ");
out1 = "\n" + out1;
Console.WriteLi ne(out1);
//Console.WriteLi ne(ssh1.Expect( ">"));
}
ssh1.Close();
ssh.Close();
Console.WriteLi ne("Connection closed.");
}
Comment