//===================================================================== /// <summary> /// This is used to copy the additional content token, image, and /// topic files to the build folder. /// </summary> /// <param name="builder">The build process</param> /// <remarks>This will copy the code snippet file if specified, save /// token information to a shared content file called <b>_Tokens_.xml</b> /// in the build process's working folder, copy the image files to the /// <b>.\media</b> folder in the build process's working folder, save /// the media map to a file called <b>_MediaContent_.xml</b> in the /// build process's working folder, and save the topic files to the /// <b>.\ddueXml</b> folder in the build process's working folder. /// The topic files will have their content wrapped in a /// <c><topic></c> tag if needed and will be named using their /// <see cref="Topic.Id" /> value.</remarks> public void CopyContentFiles(BuildProcess builder) { string folder; bool missingFile = false; builder.ReportProgress("Copying standard token shared content file..."); builder.TransformTemplate("HelpFileBuilderTokens.tokens", builder.TemplateFolder, builder.WorkingFolder); builder.ReportProgress("Checking for other token files..."); foreach(FileItem tokenFile in this.tokenFiles) if(!File.Exists(tokenFile.FullPath)) { missingFile = true; builder.ReportProgress(" Missing token file: {0}", tokenFile.FullPath); } else { builder.ReportProgress(" {0} -> {1}", tokenFile.FullPath, Path.Combine(builder.WorkingFolder, Path.GetFileName(tokenFile.FullPath))); builder.TransformTemplate(Path.GetFileName(tokenFile.FullPath), Path.GetDirectoryName(tokenFile.FullPath), builder.WorkingFolder); } if(missingFile) throw new BuilderException("BE0052", "One or more token files could not be found"); builder.ReportProgress("Checking for code snippets files..."); foreach(FileItem snippetsFile in this.codeSnippetFiles) if(!File.Exists(snippetsFile.FullPath)) { missingFile = true; builder.ReportProgress(" Missing code snippets file: {0}", snippetsFile.FullPath); } else builder.ReportProgress(" Found {0}", snippetsFile.FullPath); if(missingFile) throw new BuilderException("BE0053", "One or more code snippets files could not be found"); // Save the image info to a shared content file and copy the // image files to the working folder. folder = builder.WorkingFolder + "Media"; if(!Directory.Exists(folder)) Directory.CreateDirectory(folder); // Create the build process's help format output folders too if needed builder.EnsureOutputFoldersExist("media"); builder.ReportProgress("Copying images and creating the media map file..."); // Copy all image project items and create the content file imageFiles.SaveAsSharedContent(builder.WorkingFolder + "_MediaContent_.xml", folder, builder); // Copy the topic files folder = builder.WorkingFolder + "ddueXml"; if(!Directory.Exists(folder)) Directory.CreateDirectory(folder); builder.ReportProgress("Generating conceptual topic files"); // Create topic files foreach(TopicCollection tc in topics) { tc.Load(); tc.GenerateConceptualTopics(folder, builder); } }