Esempio n. 1
0
        public void UpdateTypesFullpath()
        {
            //<type fullPath="#String" context="com.adnuvo.util.FlashVars">String</type>

            DataTypeUtil allDataTypes = DataTypeUtil.Instance;

            XmlNodeList allTypes = documentationXml.DocumentElement.SelectNodes("//type");

            foreach (XmlElement node in allTypes)
            {
                string typeContext = node.GetAttribute("context");
                string typeName    = node.InnerText;
                node.SetAttribute("fullPath", allDataTypes.GetFullPath(typeName, typeContext.Split(',')));
                node.RemoveAttribute("context");
            }

            XmlNodeList allPackageName = documentationXml.DocumentElement.SelectNodes("//packageName");

            foreach (XmlElement node in allPackageName)
            {
                string packageName = node.InnerText;
                node.SetAttribute("fullPath", allDataTypes.GetFullPath(packageName));
            }
        }
Esempio n. 2
0
        ///<summary>
        /// Make the list of as files
        ///</summary
        private void BuildDocumentationXml()
        {
            DataTypeUtil   allDataTypes = DataTypeUtil.Instance;
            XmlDeclaration dec          = allDocXml.CreateXmlDeclaration("1.0", null, null);

            allDocXml.AppendChild(dec);

            XmlElement contentNode = allDocXml.CreateElement("docElements");

            allDocXml.AppendChild(contentNode);

            XmlElement pathNode = allDocXml.CreateElement("basePath");

            pathNode.InnerText = "file:/" + xmlPath.Text.Replace("\\", "/") + "/";
            contentNode.AppendChild(pathNode);

            XmlElement newNode1 = allDocXml.CreateElement("introHeader");

            newNode1.InnerText = introHeader.Text;
            contentNode.AppendChild(newNode1);


            XmlElement newNode2 = allDocXml.CreateElement("introText");

            contentNode.AppendChild(newNode2);
            XmlCDataSection CData = allDocXml.CreateCDataSection(introText.Text.Replace("\r\n", "<br/>\r\n"));

            newNode2.AppendChild(CData);

            XmlElement createdNode = allDocXml.CreateElement("created");

            createdNode.InnerText = String.Format("{0:d/M yyyy}", DateTime.Now);
            contentNode.AppendChild(createdNode);


            XmlElement languageNode = allDocXml.CreateElement("language");

            switch ((CodeLanguage)projSettings.Language)
            {
            case CodeLanguage.Actionscript:
                asDocumentation        = new ASDocumentationBuilder();
                languageNode.InnerText = "AS";
                break;

            case CodeLanguage.Javascript:
                asDocumentation        = new JSDocumentationBuilder();
                languageNode.InnerText = "JS";
                break;
            }
            contentNode.AppendChild(languageNode);



            //loop trough all files
            int incFiles = 0;

            foreach (string filNavn in projSettings.AllFiles)
            {
                if (File.Exists(filNavn))
                {
                    incFiles++;
                    updateProgress((incFiles / projSettings.AllFiles.Count) * 38 + 2);
                    DateTime modifiedTime = File.GetLastWriteTime(filNavn);

                    XmlNodeList classXml = asDocumentation.AddFile(File.ReadAllLines(filNavn, Encoding.Default), modifiedTime, filNavn);

                    try
                    {
                        if (classXml.Count > 0)
                        {
                            foreach (XmlNode classNode in classXml)
                            {
                                if (classNode.InnerXml != "")
                                {
                                    allDataTypes.AddDataType(classNode.SelectSingleNode("name").InnerText, classNode.SelectSingleNode("package").InnerText, null);//,classNode.SelectSingleNode("fid").InnerText

                                    contentNode.AppendChild(allDocXml.ImportNode(classNode, true));
                                }
                                else
                                {
                                    systemSvar += "Empty class in: " + filNavn + "\r\n";
                                }
                            }
                        }
                        else
                        {
                            systemSvar += "File not added (no content): " + filNavn + "\r\n\r\n";
                        }
                    }
                    catch (Exception e)
                    {
                        systemSvar += "Exception error in: " + filNavn + "\r\n" + e.ToString() + "\r\n\r\n";
                    }

                    if (asDocumentation.SystemSvar != "")
                    {
                        systemSvar += "Error in " + filNavn + ":\r\n" + asDocumentation.SystemSvar + "\r\n\r\n";
                        asDocumentation.SystemSvar = "";
                    }
                }
            }
        }