Пример #1
0
        //step 8
        private bool CreateChm()
        {
            Log.LogMessage("Creating html help chm file.");

            //make directories
            if (!Directory.Exists(ChmDirectory))
                Directory.CreateDirectory(OutputDirectory);

            foreach (string d in outputDirectories)
            {
                string path = Path.Combine(ChmDirectory, d);
                if (!Directory.Exists(path))
                    Directory.CreateDirectory(path);
            }

            // copy outputs
            string root = OutputDirectory;

            foreach (string o in outputDirectories)
            {
                if (o == "html")
                    continue; //skip html

                string s = Path.Combine(root, o);
                if (!Directory.Exists(s))
                    continue;

                string d = Path.Combine(ChmDirectory, o);
            
                CopyDirectoryItems(s, d);
            }

            Log.LogMessage("Compiling html help project '{0}'.", ChmName);
            // run chm builder
            ChmBuilder chm = new ChmBuilder();
            CopyBuildEngine(chm);

            chm.HtmlDirectory = Path.Combine(OutputDirectory, "html");
            chm.TocFile = new TaskItem(TocFile);
            chm.OutputDirectory = ChmDirectory;
            chm.ProjectName = ChmName;
            chm.LanguageId = LanguageId ?? "1033";

            if (!chm.Execute())
                return false;

            DBCSFix fix = new DBCSFix();
            CopyBuildEngine(fix);

            fix.LanguageId = LanguageId ?? "1033";
            fix.ChmDirectory = ChmDirectory;
            if (!fix.Execute())
                return false;

            //compile
            ChmCompiler compiler = new ChmCompiler();
            CopyBuildEngine(compiler);

            compiler.ProjectFile = new TaskItem(
                Path.Combine(ChmDirectory, ChmName + ".hhp"));

            return compiler.Execute();
        }
Пример #2
0
        //step 8
        private bool CreateChm()
        {
            Log.LogMessage("Creating html help chm file.");

            //make directories
            if (!Directory.Exists(ChmDirectory))
            {
                Directory.CreateDirectory(OutputDirectory);
            }

            foreach (string d in outputDirectories)
            {
                string path = Path.Combine(ChmDirectory, d);
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
            }

            // copy outputs
            string root = OutputDirectory;

            foreach (string o in outputDirectories)
            {
                if (o == "html")
                {
                    continue; //skip html
                }
                string s = Path.Combine(root, o);
                if (!Directory.Exists(s))
                {
                    continue;
                }

                string d = Path.Combine(ChmDirectory, o);

                CopyDirectoryItems(s, d);
            }

            Log.LogMessage("Compiling html help project '{0}'.", ChmName);
            // run chm builder
            ChmBuilder chm = new ChmBuilder();

            CopyBuildEngine(chm);

            chm.HtmlDirectory   = Path.Combine(OutputDirectory, "html");
            chm.TocFile         = new TaskItem(TocFile);
            chm.OutputDirectory = ChmDirectory;
            chm.ProjectName     = ChmName;
            chm.LanguageId      = LanguageId ?? "1033";

            if (!chm.Execute())
            {
                return(false);
            }

            DBCSFix fix = new DBCSFix();

            CopyBuildEngine(fix);

            fix.LanguageId   = LanguageId ?? "1033";
            fix.ChmDirectory = ChmDirectory;
            if (!fix.Execute())
            {
                return(false);
            }

            //compile
            ChmCompiler compiler = new ChmCompiler();

            CopyBuildEngine(compiler);

            compiler.ProjectFile = new TaskItem(
                Path.Combine(ChmDirectory, ChmName + ".hhp"));

            return(compiler.Execute());
        }