Пример #1
0
        public void RunDoxygen()
        {
            string[] Args = new string[1];
            Args[0] = Config.DocDirectory + "/Doxyfile";

            DoxygenOutput = new DoxyThreadSafeOutput();
            DoxygenOutput.SetStarted();

            Action <int> setcallback = (int returnCode) => OnDoxygenFinished(returnCode);

            DoxyRunner Doxygen = new DoxyRunner(Config.PathtoDoxygen, Args, DoxygenOutput, setcallback);

            Thread DoxygenThread = new Thread(new ThreadStart(Doxygen.RunThreadedDoxy));

            DoxygenThread.Start();
        }
Пример #2
0
 public DoxyRunner(string exepath, string[] args,DoxyThreadSafeOutput safeoutput,Action<int> callback)
 {
     EXE = exepath;
     Args = args;
     SafeOutput = safeoutput;
     onCompleteCallBack = callback;
     WorkingFolder = FileUtil.GetUniqueTempPathInProject();
     System.IO.Directory.CreateDirectory(WorkingFolder);
 }
Пример #3
0
        void GenerateGUI()
        {
            if(DoxyFileExists) {
                //UnityEngine.print(DoxyoutputProgress);
                GUILayout.Space (10);
                if(!DocsGenerated) {
                    UnityEngine.GUI.enabled = false;
                }
                if(GUILayout.Button ("Browse Documentation", GUILayout.Height(40))) {
                    Application.OpenURL("File://"+Config.DocDirectory+"/html/annotated.html");
                }
                UnityEngine.GUI.enabled = true;

                if(DoxygenOutput == null) {
                    if(GUILayout.Button ("Run Doxygen", GUILayout.Height(40))) {
                        DocsGenerated = false;
                        RunDoxygen();
                    }

                    if(DocsGenerated && DoxygenLog != null) {
                        if(GUILayout.Button( "View Doxygen Log",EditorStyles.toolbarDropDown))
                            ViewLog = !ViewLog;
                        if(ViewLog) {
                            scroll = EditorGUILayout.BeginScrollView(scroll, GUILayout.ExpandHeight(true));
                            foreach(string logitem in DoxygenLog) {
                                EditorGUILayout.SelectableLabel(logitem,EditorStyles.miniLabel,GUILayout.ExpandWidth(true));
                            }
                            EditorGUILayout.EndScrollView();
                        }
                    }
                } else {
                    if(DoxygenOutput.isStarted() && !DoxygenOutput.isFinished()) {
                        string currentline = DoxygenOutput.ReadLine();
                        DoxyoutputProgress = DoxyoutputProgress + 0.1f;
                        if(DoxyoutputProgress >= 0.9f) {
                            DoxyoutputProgress = 0.75f;
                        }
                        Rect r = EditorGUILayout.BeginVertical();
                        EditorGUI.ProgressBar(r, DoxyoutputProgress,currentline );
                        GUILayout.Space(40);
                        EditorGUILayout.EndVertical();
                    }
                    if(DoxygenOutput.isFinished()) {
                        if (Event.current.type == EventType.Repaint)
                        {
                            /*
                            If you look at what SetTheme is doing, I know, it seems a little scary to be
                            calling file moving operations from inside a an OnGUI call like this. And
                            maybe it would be a better choice to call SetTheme and update these other vars
                            from inside of the OnDoxygenFinished callback. But since the callback is static
                            that would require a little bit of messy singleton instance checking to make sure
                            the call back was calling into the right functions. I did try to do it that way
                            but for some reason the file operations failed every time. I'm not sure why.
                            This is what I was getting from the debugger:

                            Error in file: C:/BuildAgent/work/842f9551727e852/Runtime/Mono/MonoManager.cpp at line 2212
                            UnityEditor.FileUtil:DeleteFileOrDirectory(String)
                            UnityEditor.FileUtil:ReplaceFile(String, String) (at C:\BuildAgent\work\842f9557127e852\Editor\MonoGenerated\Editor\FileUtil.cs:42)

                            Doing them here seems to work every time and the Repaint event check ensures that they will only be done once.
                            */
                            SetTheme(SelectedTheme);
                            DoxygenLog = DoxygenOutput.ReadFullLog();
                            DoxyoutputProgress = -1.0f;
                            DoxygenOutput = null;
                            DocsGenerated = true;
                            EditorPrefs.SetBool(UnityProjectID+"DocsGenerated",DocsGenerated);
                        }
                    }
                }
            } else {
                GUIStyle ErrorLabel = new GUIStyle(EditorStyles.largeLabel);
                ErrorLabel.alignment = TextAnchor.MiddleCenter;
                GUILayout.Space(20);
                UnityEngine.GUI.contentColor = Color.red;
                GUILayout.Label("You must set the path to your Doxygen install and \nbuild a new Doxyfile before you can generate documentation",ErrorLabel);
            }
        }
Пример #4
0
        public void RunDoxygen()
        {
            string[] Args = new string[1];
            Args[0] = Config.DocDirectory + "/Doxyfile";

              	DoxygenOutput = new DoxyThreadSafeOutput();
              	DoxygenOutput.SetStarted();

              	Action<int> setcallback = (int returnCode) => OnDoxygenFinished(returnCode);

              	DoxyRunner Doxygen = new DoxyRunner(Config.PathtoDoxygen,Args,DoxygenOutput,setcallback);

              	Thread DoxygenThread = new Thread(new ThreadStart(Doxygen.RunThreadedDoxy));
              	DoxygenThread.Start();
        }
Пример #5
0
        void GenerateGUI()
        {
            if (DoxyFileExists)
            {
                //UnityEngine.print(DoxyoutputProgress);
                GUILayout.Space(10);
                if (!DocsGenerated)
                {
                    UnityEngine.GUI.enabled = false;
                }
                if (GUILayout.Button("Browse Documentation", GUILayout.Height(40)))
                {
                    Application.OpenURL("File://" + Config.DocDirectory + "/html/annotated.html");
                }
                UnityEngine.GUI.enabled = true;

                if (DoxygenOutput == null)
                {
                    if (GUILayout.Button("Run Doxygen", GUILayout.Height(40)))
                    {
                        DocsGenerated = false;
                        RunDoxygen();
                    }

                    if (DocsGenerated && DoxygenLog != null)
                    {
                        if (GUILayout.Button("View Doxygen Log", EditorStyles.toolbarDropDown))
                        {
                            ViewLog = !ViewLog;
                        }
                        if (ViewLog)
                        {
                            scroll = EditorGUILayout.BeginScrollView(scroll, GUILayout.ExpandHeight(true));
                            foreach (string logitem in DoxygenLog)
                            {
                                EditorGUILayout.SelectableLabel(logitem, EditorStyles.miniLabel, GUILayout.ExpandWidth(true));
                            }
                            EditorGUILayout.EndScrollView();
                        }
                    }
                }
                else
                {
                    if (DoxygenOutput.isStarted() && !DoxygenOutput.isFinished())
                    {
                        string currentline = DoxygenOutput.ReadLine();
                        DoxyoutputProgress = DoxyoutputProgress + 0.1f;
                        if (DoxyoutputProgress >= 0.9f)
                        {
                            DoxyoutputProgress = 0.75f;
                        }
                        Rect r = EditorGUILayout.BeginVertical();
                        EditorGUI.ProgressBar(r, DoxyoutputProgress, currentline);
                        GUILayout.Space(40);
                        EditorGUILayout.EndVertical();
                    }
                    if (DoxygenOutput.isFinished())
                    {
                        if (Event.current.type == EventType.Repaint)
                        {
                            /*
                             * If you look at what SetTheme is doing, I know, it seems a little scary to be
                             * calling file moving operations from inside a an OnGUI call like this. And
                             * maybe it would be a better choice to call SetTheme and update these other vars
                             * from inside of the OnDoxygenFinished callback. But since the callback is static
                             * that would require a little bit of messy singleton instance checking to make sure
                             * the call back was calling into the right functions. I did try to do it that way
                             * but for some reason the file operations failed every time. I'm not sure why.
                             * This is what I was getting from the debugger:
                             *
                             * Error in file: C:/BuildAgent/work/842f9551727e852/Runtime/Mono/MonoManager.cpp at line 2212
                             * UnityEditor.FileUtil:DeleteFileOrDirectory(String)
                             * UnityEditor.FileUtil:ReplaceFile(String, String) (at C:\BuildAgent\work\842f9557127e852\Editor\MonoGenerated\Editor\FileUtil.cs:42)
                             *
                             * Doing them here seems to work every time and the Repaint event check ensures that they will only be done once.
                             */
                            SetTheme(SelectedTheme);
                            DoxygenLog         = DoxygenOutput.ReadFullLog();
                            DoxyoutputProgress = -1.0f;
                            DoxygenOutput      = null;
                            DocsGenerated      = true;
                            EditorPrefs.SetBool(UnityProjectID + "DocsGenerated", DocsGenerated);
                        }
                    }
                }
            }
            else
            {
                GUIStyle ErrorLabel = new GUIStyle(EditorStyles.largeLabel);
                ErrorLabel.alignment = TextAnchor.MiddleCenter;
                GUILayout.Space(20);
                UnityEngine.GUI.contentColor = Color.red;
                GUILayout.Label("You must set the path to your Doxygen install and \nbuild a new Doxyfile before you can generate documentation", ErrorLabel);
            }
        }