Exemplo n.º 1
0
        private string GetDocumentFilename(string fullPath)
        {
            PagePath pagePath         = new PagePath(fullPath);
            string   documentFilename = GetDocumentFilename(pagePath.Path, pagePath.Name);

            return(documentFilename);
        }
Exemplo n.º 2
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));
        }
Exemplo n.º 3
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);
            }
        }
Exemplo n.º 4
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);
        }