示例#1
0
 private void CopyInfoFromTree()
 {
     this["name"]           = _treeNode.Name;
     this["menuname"]       = CommonXml.GetAttributeValue(_treeNode, "menuname");
     this["pageidentifier"] = CommonXml.GetXPath(_treeNode);
     this["status"]         = CommonXml.GetAttributeValue(_treeNode, "status");
 }
示例#2
0
        private string GetDocumentFilename(XmlNode treeNode)
        {
            string path             = CommonXml.GetXPath(treeNode);
            string documentFilename = GetDocumentFilename(path);

            return(documentFilename);
        }
示例#3
0
        private void DeleteFile(XmlNode pageNode)
        {
            string   path     = CommonXml.GetXPath(pageNode);
            PagePath pagePath = new PagePath(path);

            Common.DeleteFile(GetDocumentFilename(pagePath.Path, pagePath.Name));
            Common.DeleteDirectory(GetDocumentContainerDirectory(pagePath.Path, pagePath.Name));
        }
示例#4
0
        /// <summary>
        /// Rebuilds this instance.
        /// </summary>
        private void Rebuild()
        {
            XmlNodeList xmlNodeList = TreeDocument.SelectNodes("//*[@pageidentifier and not(@pageidentifier = '')]");

            if (xmlNodeList != null)
            {
                foreach (XmlNode pageNode in xmlNodeList)
                {
                    string path = CommonXml.GetXPath(pageNode);
                    Page   page = GetPage(path);
                    page["pageidentifier"] = path;

                    SavePage(page, false);
                    CommonXml.SetAttributeValue(pageNode, "pageidentifier", path);
                }
            }
        }
示例#5
0
        private void RenameFile(Page page, string renameTo)
        {
            string   path     = CommonXml.GetXPath(page.TreeNode);
            PagePath pagePath = new PagePath(path);

            // Rename file
            string oldFilename = GetDocumentFilename(pagePath.Path, pagePath.Name);
            string newFilename = GetDocumentFilename(pagePath.Path, renameTo);

            File.Move(oldFilename, newFilename);

            // Rename directory
            string oldDirectory = GetDocumentContainerDirectory(pagePath.Path, pagePath.Name);

            if (Directory.Exists(oldDirectory))
            {
                string newDirectory = GetDocumentContainerDirectory(pagePath.Path, renameTo);
                Directory.Move(oldDirectory, newDirectory);
            }
        }
示例#6
0
        /// <summary>
        /// Gets the page.
        /// </summary>
        /// <param name="pageNode">The page node.</param>
        /// <returns></returns>
        private Page GetPage(XmlNode pageNode)
        {
            Page page = null;

            if (pageNode != null)
            {
                string path = CommonXml.GetXPath(pageNode);

                string fileName = Path.Combine(_contentRoot, string.Format(_contentFilenameFormat, path));
                if (!File.Exists(fileName))
                {
                    PagePath pagePath = new PagePath(path);
                    CreateFile(pagePath.Path, pagePath.Name, CommonXml.GetAttributeValue(pageNode, "menuname"));
                }

                XmlDocument document = new XmlDocument();
                document.Load(fileName);

                page = new Page(document.SelectSingleNode("//page"), GetPageNode(path), this);
            }

            return(page);
        }