2013-01-09 29 views
0

Doxygen提供了一種通過stdin傳遞.doxy文件的內容而不是傳遞文件名的方法,但是我不知道如何從C#中完成它。如何從C#運行doxygen並通過stdin傳入配置?

爲了簡單起見,讓我們說,我的doxygen的配置文件的內容簡單地存儲在string[] lines所以我想執行doxygen.exe和飼料可以在這個內容。

+0

的[?如何來寫另一個應用程序的標準輸入(http://stackoverflow.com/q/2613161) –

+0

我的問題涵蓋了比這個問題更可能的問題重複,我認爲。我認爲可能存在一個doxygen特定的部分,如何實際啓動doxygen.exe以期望使用C#從stdin輸入。 –

+0

毫無疑問,這將是啓動Doxygen時需要提供的減號( - )命令行參數。請參閱http://www.star.bnl.gov/public/comp/sofi/doxygen/starting.html。另請參見[從C#啓動應用程序(.EXE)?](http://stackoverflow.com/questions/240171) –

回答

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; 
    } 
相關問題