0

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

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

4

1 回答 1

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;
    }
于 2013-01-11T11:39:54.013 回答