Exemple #1
0
        private static bool BuildHTMLFromTextWork(MetaDoc xmlTextWork)
        {
            bool bRet = false;

            Globals.m_Logger.Info(string.Format("Converting {0} to html", xmlTextWork.GetFileName()));
            HTMLWriter htmlWriter = new HTMLWriter(xmlTextWork);

            if (!htmlWriter.Save())
            {
                Globals.m_Logger.Error(string.Format("Unable to save {0}!", htmlWriter.GetOutFileName()));
            }
            else
            {
                Globals.m_Logger.Info(string.Format("{0} generated", htmlWriter.GetOutFileName()));
                bRet = true;
            }
            bRet &= htmlWriter.ValidateHTML();
            return(bRet);
        }
        public static bool SynchDocuments(Ftp ftpClient, List <MetaDoc> textWorks)
        {
            Globals.m_Logger.Info(string.Format("Publishing documents..."));
            for (int iTw = 0; iTw < textWorks.Count; iTw++)
            {
                MetaDoc txtWK = textWorks[iTw];
                if (!txtWK.IsShowInGlobalIndex())
                {
                    continue;
                }

                string htmlFilePath = Utils.ChangePathExtension(Globals.IndexFolder() + txtWK.GetFileName(), Globals.HTML_EXT);

                string fileName = Path.GetFileName(htmlFilePath);

                if (txtWK.GetHashes().Count > 1)
                {
                    // 1 because here 0 is the current one
                    ftpClient.rename(Globals.FTPRemoteFolder() + "/" + fileName, txtWK.GetHashes()[1].GetHash() + Globals.HTML_EXT);
                }
                // TODO, move to revisions...
                ftpClient.upload(Globals.FTPRemoteFolder() + "/" + fileName, htmlFilePath);
                Globals.m_Logger.Info(string.Format("{0} added to remote ftp folder {1}", htmlFilePath, Globals.FTPRemoteFolder()));
            }
            return(true);
        }
Exemple #3
0
 public string GetOutFileName()
 {
     return(String.Format("{0}{1}", Path.GetFileNameWithoutExtension(m_TextWork.GetFileName()), Globals.HTML_EXT));
 }