public void Generate(List <string> additionalFiles) { UI.Log("Generating Java Help", ChmLogLevel.INFO); // Create directory, content files and additional files CreateDestinationDirectory(JavaHelpDirectoryGeneration, additionalFiles); CreateHelpContentFiles(JavaHelpDirectoryGeneration); UI.Log("Generating java help xml files", ChmLogLevel.INFO); GenerateJavaHelpSetFile(); GenerateJavaHelpIndex(); GenerateJavaHelpMapFile(); GenerateJavaHelpTOC(); UI.Log("Building the search index", ChmLogLevel.INFO); CommandLineExecution cmd = new CommandLineExecution(AppSettings.JavaHelpIndexerPath, ".", UI); UI.Log(cmd.ToString(), ChmLogLevel.DEBUG); cmd.Info.WorkingDirectory = JavaHelpDirectoryGeneration; cmd.Execute(); // Build a JAR with the help. //java -jar E:\dev\java\javahelp\javahelp2.0\demos\bin\hsviewer.jar -helpset help.jar string parameters = " cvf \"" + Project.JavaHelpPath + "\" ."; string jarPath = AppSettings.JarPath; UI.Log("Building jar", ChmLogLevel.INFO); cmd = new CommandLineExecution(jarPath, parameters, UI); cmd.Info.WorkingDirectory = JavaHelpDirectoryGeneration; UI.Log(cmd.ToString(), ChmLogLevel.DEBUG); cmd.Execute(); // Remove the temporal directory Directory.Delete(JavaHelpDirectoryGeneration, true); }
/// <summary> /// Compiles the help project file and it's copied to the destination file. /// </summary> private void Compile() { UI.Log("Compiling CHM file", ChmLogLevel.INFO); // The help compiler EXE path: string compilerPath = AppSettings.CompilerPath; if (!File.Exists(compilerPath)) { throw new Exception("Compiler not found at " + compilerPath + ". Help not generated"); } else { string proyecto = "\"" + ChmProjectPath + "\""; // TODO: Use DocumentProcessor.ExecuteCommandLine to make this execution: CommandLineExecution cmd; if (!AppSettings.UseAppLocale) { // Run the raw compiler cmd = new CommandLineExecution(compilerPath, proyecto, UI); } else { // Run the compiler with AppLocale. Need to compile files with a // char encoding distinct to the system codepage. //string parameters = "\"" + compilerPath + "\" " + proyecto + " /L" + Convert.ToString(HelpWorkshopCulture.LCID, 16); string parameters = "\"" + compilerPath + "\" " + proyecto + " /L" + Convert.ToString(HelpWorkshopCulture.TextInfo.LCID, 16); cmd = new CommandLineExecution(AppSettings.AppLocalePath, parameters, UI); } cmd.Execute(); string archivoAyudaOrigen = Path.Combine(Project.HelpProjectDirectory, CHMFILENAME); if (File.Exists(archivoAyudaOrigen)) { // Be sure the destination directory exists string destinationDirectory = Path.GetDirectoryName(Project.HelpFile); if (!Directory.Exists(destinationDirectory)) { Directory.CreateDirectory(destinationDirectory); } // Copy the file from the temporally directory to destination File.Copy(archivoAyudaOrigen, Project.HelpFile, true); } else { throw new Exception("After compiling, the file " + archivoAyudaOrigen + " was not found. Some error happened with the compilation. Try to generate the help project manually"); } } }