3

我正在通过启动一个Process这样的文件来处理一个 Tex 文件:

process p1 = new Process();
p1.StartInfo.FileName = "C:\\texlive\\2012\\bin\\win32\\pdflatex.exe";
p1.StartInfo.Arguments = FileName;
p1.consuleProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p1.consuleProcess.StartInfo.CreateNoWindow = true;
p1.consuleProcess.StartInfo.RedirectStandardOutput = true;
p1.consuleProcess.StartInfo.UseShellExecute = false;
p1.consuleProcess.StartInfo.RedirectStandardInput = true;
p1.Start();
p1.consuleProcess.BeginOutputReadLine();
p1.consuleProcess.OutputDataReceived += new DataReceivedEventHandler(p1_OutputDataReceived);

TextBox我通过处理OutputDataReceived事件在 a 中显示输出字符串。

如果 Tex 文件中有错误,则应在StandardInput中写入一行。我认为没有事件可以告诉我,进程何时等待输入;所以我想,我可以检查OutputDataReceived事件来查看条件:e.Data == "?" 是真的。但是,问题是StandardInput需要一个输入,就在使用e.Data=="?"触发OutputDataReceived 事件之前。

那么,我可以做些什么来查看进程何时等待输入?

谢谢。

4

1 回答 1

0

不确定这是否是您的意思,但您是否在追求类似的东西

p1.WaitForInputIdle(NumberofMilisecondstoWait)

更新:

也许是这样的

  public void test()
        {
            p1.OutputDataReceived += new DataReceivedEventHandler(p1_OutputDataReceived);
        }

        void p1_OutputDataReceived(object sender, DataReceivedEventArgs e)
        {
            throw new NotImplementedException();
        }
于 2013-02-14T16:35:27.070 回答