示例#1
0
        private void btn_parse_doxygen_Click(object sender, EventArgs e)
        {
            btn_parse_doxygen.Enabled = false;
            ClearLog();
            string rootdir = Directory.GetCurrentDirectory();

            try
            {
                DirectoryInfo Target = new DirectoryInfo(rootdir + "\\doxygen");
                if (Target.Exists)
                {
                    MyLogger.Log("Directory " + Target.FullName + " exists, deleting." + Environment.NewLine);
                    Directory.Delete(Target.FullName, true);
                }
                DirectoryInfo DoxygenOutput = new DirectoryInfo(rootdir + "\\doc");
                if (DoxygenOutput.Exists)
                {
                    MyLogger.Log("Directory " + DoxygenOutput.FullName + " exists, deleting." + Environment.NewLine);
                    Directory.Delete(DoxygenOutput.FullName, true);
                }
                DirectoryInfo[] DI = new DirectoryInfo(rootdir).GetDirectories("*.*", SearchOption.AllDirectories);
                MyLogger.Log("Creating Target Directory " + Target.FullName + "." + Environment.NewLine);
                Target.Create();
                foreach (DirectoryInfo D1 in DI)
                {
                    if (false == D1.Name.Contains("svn") &&
                        false == D1.Name.Contains("doxygen") &&
                        false == D1.Name.Contains("doc"))
                    {
                        DoxygenBuilder builder = new DoxygenBuilder(D1, Target);
                        builder.ParseScriptFiles();
                    }
                }
            }
            catch (DirectoryNotFoundException dEX)
            {
                MyLogger.Alert("Directory Not Found " + dEX.Message + Environment.NewLine);
            }
            catch (Exception ex)
            {
                MyLogger.Alert(ex.Message + Environment.NewLine);
            }
            try
            {
                if (DialogResult.OK == MessageBox.Show("Do you want to clear output before generation of doxygen?", "Clear Log", MessageBoxButtons.OKCancel))
                {
                    ClearLog();
                }
                Process proc = new Process
                {
                    StartInfo = new ProcessStartInfo
                    {
                        FileName               = "generate doxygen.bat",
                        Arguments              = "",
                        UseShellExecute        = false,
                        RedirectStandardOutput = true,
                        RedirectStandardError  = true,
                        CreateNoWindow         = true
                    }
                };
                proc.OutputDataReceived += new DataReceivedEventHandler(MyLogger.WriteOutput);
                proc.ErrorDataReceived  += new DataReceivedEventHandler(MyLogger.WriteError);
                proc.Start();
                proc.BeginErrorReadLine();
                proc.BeginOutputReadLine();
                proc.WaitForExit();
            }
            catch (Exception ex)
            {
                MyLogger.Alert(ex.Message + Environment.NewLine);
            }
            btn_parse_doxygen.Enabled = true;
        }
示例#2
0
 private void btn_parse_doxygen_Click(object sender, EventArgs e)
 {
     btn_parse_doxygen.Enabled = false;
     ClearLog();
     string rootdir = Directory.GetCurrentDirectory();
     try
     {
         DirectoryInfo Target = new DirectoryInfo(rootdir + "\\doxygen");
         if (Target.Exists)
         {
             MyLogger.Log("Directory " + Target.FullName + " exists, deleting." + Environment.NewLine);
             Directory.Delete(Target.FullName, true);
         }
         DirectoryInfo DoxygenOutput = new DirectoryInfo(rootdir + "\\doc");
         if (DoxygenOutput.Exists)
         {
             MyLogger.Log("Directory " + DoxygenOutput.FullName + " exists, deleting." + Environment.NewLine);
             Directory.Delete(DoxygenOutput.FullName, true);
         }
         DirectoryInfo[] DI = new DirectoryInfo(rootdir).GetDirectories("*.*", SearchOption.AllDirectories);
         MyLogger.Log("Creating Target Directory " + Target.FullName + "." + Environment.NewLine);
         Target.Create();
         foreach (DirectoryInfo D1 in DI)
         {
             if( false == D1.Name.Contains("svn") &&
                 false == D1.Name.Contains("doxygen") &&
                 false == D1.Name.Contains("doc") )
             {
                 DoxygenBuilder builder = new DoxygenBuilder(D1, Target);
                 builder.ParseScriptFiles();
             }
         }
     }
     catch (DirectoryNotFoundException dEX)
     {
         MyLogger.Alert("Directory Not Found " + dEX.Message + Environment.NewLine);
     }
     catch (Exception ex)
     {
         MyLogger.Alert(ex.Message + Environment.NewLine);
     }
     try
     {
         if (DialogResult.OK == MessageBox.Show("Do you want to clear output before generation of doxygen?", "Clear Log", MessageBoxButtons.OKCancel)) {
             ClearLog();
         }
         Process proc = new Process
         {
             StartInfo = new ProcessStartInfo
             {
                 FileName = "generate doxygen.bat",
                 Arguments = "",
                 UseShellExecute = false,
                 RedirectStandardOutput = true,
                 RedirectStandardError = true,
                 CreateNoWindow = true
             }
         };
         proc.OutputDataReceived += new DataReceivedEventHandler(MyLogger.WriteOutput);
         proc.ErrorDataReceived += new DataReceivedEventHandler(MyLogger.WriteError);
         proc.Start();
         proc.BeginErrorReadLine();
         proc.BeginOutputReadLine();
         proc.WaitForExit();
     }
     catch (Exception ex)
     {
         MyLogger.Alert(ex.Message + Environment.NewLine);
     }
     btn_parse_doxygen.Enabled = true;
 }