//класс ComLiner
public class ComLiner
{
private Process p;
public ComLiner(string pname) {
p=new Process();
p.StartInfo.FileName=pname;
p.StartInfo.UseShellExecute=false;
p.StartInfo.RedirectStandardOutput=true;
p.StartInfo.RedirectStandardInput=true;
p.StartInfo.CreateNoWindow=true;
}
//Функция Go
public string Go (string In) {
p.Start();
p.StandardInput.WriteLine(In);
p.StandardInput.Close();
string result = p.StandardOutput.ReadToend();
p.WaitForExit();
return result.Length==0?" ":
result.Substring(0,result.Length-2);
}
}
//Использование
private ComLiner cl;
public Form1() {
InitializeComponent();
cl=new ComLiner("Reverse.exe");
}
........
private void textBox1_TextChanged(object
sender, System.EventArgs e) {
textBox2.Text=cl.Go (textBox1.Text) //в первый текстбокс мы //вставляем 1-2-3-4-5 во
//втором получаем 5-4-3-2-1
}
Сейчас этот форум просматривают: Yandex-бот и гости: 3