Ejemplo n.º 1
0
        public static void DoAnalytics(Lifetime lifetime)
        {
            var solutionStateTracker = SolutionStateTracker.Instance;

            /*
             * solutionStateTracker?.SolutionName.Change.Advise_HasNew(lifetime, () =>
             * {
             * });
             */

            try
            {
                PenradCppFiles.Clear();
                PenradHeaderFiles.Clear();
                CppFileMap.Clear();
                HeaderFileMap.Clear();
                CppResultsManager.Self.Clear();

                var solution = solutionStateTracker?.Solution;
                if (solution == null)
                {
                    return;
                }

                List <IProject> projects = solution.GetProjectsByName("penrad").ToList();

                if (projects.Count == 1)
                {
                    PenradProject = projects.First();

                    MapProjectFiles();
                    ParsePenradDialogs();

                    CppResultsManager.Self.WriteResults();
                    WidgetTypeFinder.WriteAnalytics();

                    //CppParseTreeNodeFactory.Self.DumpTreeSchema();
                    //CodeGenerator.Self.GenerateCode();
                }
            }
            catch (Exception ex)
            {
                LogManager.Self.Log($"Excpetion {ex.Message}");
            }
        }
Ejemplo n.º 2
0
        private static void MapProjectFiles()
        {
            List <IProjectFile> projectFiles = PenradProject.GetAllProjectFiles().ToList();

            foreach (IProjectFile projectFile in projectFiles)
            {
                string ext = Path.GetExtension(projectFile.Name).ToLower();

                switch (ext)
                {
                case ".cpp":
                    CppFileMap.Add(projectFile.Name.ToLower(), projectFile);
                    break;

                case ".h":
                    HeaderFileMap.Add(projectFile.Name.ToLower(), projectFile);
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        private static void ProcessCppFile(CppHeaderContext cppHeaderContext, string fileName, string dialogClassName)
        {
            if (CppFileMap.ContainsKey(fileName.ToLower()))
            {
                IProjectFile projectFile = CppFileMap[fileName.ToLower()];

                CppCodeContext cppCodeContext = new CppCodeContext(fileName, dialogClassName);

                cppCodeContext.CppHeaderContext = cppHeaderContext;
                cppHeaderContext.CppCodeContext = cppCodeContext;
                cppCodeContext.WidgetTypeFinder = new WidgetTypeFinder(cppCodeContext, cppHeaderContext);

                CurrentFileContext = cppCodeContext;

                cppCodeContext.ProjectFile = projectFile;

                cppCodeContext.Init();

                CurrentFileContext = cppCodeContext;

                AnalyzeCodeContext(cppCodeContext);

                cppCodeContext.WriteSavedNodes();

                cppCodeContext.ProcessResults();

                cppCodeContext.Finalize();

                cppCodeContext.SaveClassInfo();

                cppCodeContext.WidgetTypeFinder.DoAnalytics();
            }
            else
            {
                LogManager.Self.Log($"Missing Cpp File in map: {fileName}");
            }
        }