Пример #1
0
        public void Generate(List <string> additionalFiles)
        {
            UI.Log("Generating web site", ChmLogLevel.INFO);

            // Create directory, and additional files
            CreateDestinationDirectory(Project.WebDirectory, additionalFiles);

            try
            {
                if (Project.FullTextSearch)
                {
                    // Prepare the search index
                    Indexer = new WebIndex();
                    string dbFile       = Path.Combine(Project.WebDirectory, "fullsearchdb.db3");
                    string dirTextFiles = Path.Combine(Project.WebDirectory, "textFiles");
                    Indexer.Connect(dbFile);
                    Indexer.CreateDatabase(System.Windows.Forms.Application.StartupPath + Path.DirectorySeparatorChar + "searchdb.sql", dirTextFiles);
                    Indexer.StoreConfiguration(Project.WebLanguage);
                }

                // Create content help files, and index them if it was needed
                CreateHelpContentFiles(Project.WebDirectory);
            }
            finally
            {
                if (Indexer != null)
                {
                    Indexer.Disconnect();
                }
            }

            // Create text replacements
            Replacements replacements = CreateTextReplacements();

            // Copy template web files replacing text
            replacements.CopyDirectoryReplaced(Project.TemplateDirectory, Project.WebDirectory, MSWord.HTMLEXTENSIONS, AppSettings.UseTidyOverOutput, UI, Decorator.OutputEncoding);

            // Copy full text search files replacing text:
            if (Project.FullTextSearch)
            {
                // Copy full text serch files:
                string dirSearchFiles = System.Windows.Forms.Application.StartupPath + Path.DirectorySeparatorChar + "searchFiles";
                replacements.CopyDirectoryReplaced(dirSearchFiles, Project.WebDirectory, MSWord.ASPXEXTENSIONS, false, UI, Decorator.OutputEncoding);
            }

            if (Project.GenerateSitemap)
            {
                // Generate site map for web indexers (google).
                GeneateSitemap();
            }
        }