如何从C#运行doxygen并通过stdin传入配置?

时间:2013-01-09 18:24:31

标签: c# visual-studio-2005 doxygen

Doxygen提供了一种通过stdin传入.doxy文件内容而不是传递文件名的方法,但我不知道如何从C#中传入它。

为简单起见,假设我的doxygen配置文件的内容只是存储在string[] lines中,因此我想执行doxygen.exe并将此内容提供给。

1 个答案:

答案 0 :(得分:0)

我从评论中提到的链接开始自己工作,这有点像:

// Prepare the process to run
    ProcessStartInfo start = new ProcessStartInfo();
    // Enter in the command line arguments, everything you would enter after the executable name itself
    start.Arguments = " -";
    // Enter the executable to run, including the complete path
    start.FileName = "doxygen.exe";
    // Do you want to show a console window?
    start.WindowStyle = ProcessWindowStyle.Normal;
    start.CreateNoWindow = false;
    start.RedirectStandardInput = true;
    start.UseShellExecute = false;

    // Run the external process & wait for it to finish
    using (Process proc = Process.Start(start))
    {
        //doxygenProperties is just a dictionary
        foreach (string key in doxygenProperties.Keys)
            proc.StandardInput.WriteLine(key+" = "+doxygenProperties[key]);
        proc.StandardInput.Close();
        proc.WaitForExit();

        // Retrieve the app's exit code
        int exitCode = proc.ExitCode;
    }