Beispiel #1
0
        private void OutputAllClasses(CodeFileData codeData, string templateContent)
        {
            foreach (ClassData cData in codeData.classes)
            {
                string content = templateContent.Replace(LAST_MODIFIED, codeData.lastModifiedTime);
                //get all class references add to list and pass on to the functions
                List <string> usedClasses = new List <string>();
                List <string> usedEnums   = new List <string>();

                foreach (string cName in ProjectInfo.classUseDictionary[cData])
                {
                    usedClasses.Add(cName);
                }
                foreach (string eName in ProjectInfo.enumUseDictionary[cData])
                {
                    usedEnums.Add(eName);
                }

                content = SetDependencies(codeData, content);
                content = SetTodos(codeData, content);
                content = SetClassContent(cData, content, usedClasses, usedEnums);

                File.WriteAllText(fileLocation + "\\" + cData.ClassName + "_Class_Doc.html", content);
            }
        }
Beispiel #2
0
        private string SetTodos(CodeFileData codeData, string content)
        {
            string todos = "<ol>";

            foreach (string todo in codeData.todos)
            {
                todos += "<li>" + todo + "</li>";
            }
            todos  += "</ol>";
            content = content.Replace(TODOS, todos);
            return(content);
        }
Beispiel #3
0
        private string SetDependencies(CodeFileData codeData, string content)
        {
            string depends = "<ol>";

            foreach (string dep in codeData.dependencies)
            {
                depends += "<li>" + dep + "</li>";
            }
            depends += "</ol>";
            content  = content.Replace(DEPENDENCIES, depends);
            return(content);
        }
Beispiel #4
0
        public OutputWebPage(string templateLocation, string outputFolderLocation, CodeFileData codeData, string hexId, string hexDat)
        {
            string classTemplateLoc     = "Res/Templates/Class Templates/" + templateLocation;
            string enumTemplateLoc      = "Res/Templates/Enum Templates/" + templateLocation;
            string interfaceTemplateLoc = "Res/Templates/Interface Templates/" + templateLocation;

            this.templateLocation = templateLocation;
            this.fileLocation     = outputFolderLocation;
            this.codeData         = codeData;

            this.hexId  = hexId;
            this.hexDat = hexDat;

            classtemplateContent     = File.ReadAllText(classTemplateLoc);
            enumTemplateContent      = File.ReadAllText(enumTemplateLoc);
            interfaceTemplateContent = File.ReadAllText(interfaceTemplateLoc);
        }
Beispiel #5
0
        private void OutputAllEnums(CodeFileData codeData, string templateContent)
        {
            foreach (EnumData eData in codeData.enums)
            {
                string content = templateContent.Replace(ENUM_NAME, eData.EnumName);
                content = content.Replace(LAST_MODIFIED, codeData.lastModifiedTime);
                content = content.Replace(NAMESPACE, eData.Namespace);
                string eValues = "<ul>";
                foreach (string eVal in eData.EnumValues)
                {
                    eValues += "<li>" + eVal + "</li>";
                }
                eValues += "</ul>";
                content  = content.Replace(ENUMS, eValues);

                File.WriteAllText(fileLocation + "\\" + eData.EnumName + "_Enum_Doc.html", content);
            }
        }
Beispiel #6
0
        private void OutputAllInterfaces(CodeFileData codeData, string templateContent)
        {
            foreach (InterfaceData iData in codeData.interfaces)
            {
                string content = templateContent.Replace(INTERFACE_NAME, iData.InterfaceName);
                content = content.Replace(LAST_MODIFIED, codeData.lastModifiedTime);
                content = content.Replace(NAMESPACE, iData.Namespace);
                string iValues = "<ul>";
                foreach (FunctionData fVal in iData.Functions)
                {
                    iValues += $"<li><font color = \"{hexDat}\">{fVal.ReturnType}</font>  <font color = \"{hexId}\">{fVal.FunctionName}</font> {fVal.GetHtmlParameterString(hexId, hexDat)}</li>";
                }
                iValues += "</ul>";
                content  = content.Replace(INTERFACE_FUNCS, iValues);

                File.WriteAllText(fileLocation + "\\" + iData.InterfaceName + "_Interface_Doc.html", content);
            }
        }
        public static void Summarize(List <string> codeFileLocations, string outputFolder, BackgroundWorker bgw, string hexIdentifier, string hexDataType, string templateName)
        {
            int count = 0;
            List <CodeFileData> cfds = new List <CodeFileData>();

            foreach (string codeLoc in codeFileLocations)
            {
                CodeFileData cfd = new CodeFileData(codeLoc);
                cfds.Add(cfd);
                bgw.ReportProgress((int)(((float)count++ / codeFileLocations.Count) * 75f));
            }
            ProjectInfo.Analyze(cfds);
            bgw.ReportProgress(85);

            List <string> classes    = new List <string>();
            List <string> enums      = new List <string>();
            List <string> interfaces = new List <string>();

            foreach (CodeFileData cf in cfds)
            {
                foreach (ClassData cd in cf.classes)
                {
                    classes.Add(cd.ClassName);
                }
                foreach (EnumData ed in cf.enums)
                {
                    enums.Add(ed.EnumName);
                }
                foreach (InterfaceData ifs in cf.interfaces)
                {
                    interfaces.Add(ifs.InterfaceName);
                }
                OutputWebPage ow = new OutputWebPage(templateName + ".html", outputFolder, cf, hexIdentifier, hexDataType);
                ow.GenerateHtmlContent();
            }
            GenerateIndexPage(outputFolder, classes, enums, interfaces);

            bgw.ReportProgress(100);
        }