///<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 = ""; } } } }
///<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 DocumentationBuilder(); 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.AllASFiles ){ if(File.Exists(filNavn)){ incFiles++; progressBar1.Value = (incFiles/projSettings.AllASFiles.Count)*38+2; progressBar1.Refresh(); 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\r\n"; asDocumentation.SystemSvar = ""; } } }else{ systemSvar += "File not added (no content): "+filNavn+"\r\n\r\n"; asDocumentation.SystemSvar = ""; } } catch(Exception e){ systemSvar +="Exception error in: "+filNavn+"\r\n"+e.ToString()+"\r\n\r\n" ; } if(asDocumentation.SystemSvar!=""){ systemSvar += "Error in "+filNavn+": "+asDocumentation.SystemSvar+"\r\n\r\n"; asDocumentation.SystemSvar = ""; } } } }