ServiceClientGenerator.GeneratorDriver.WriteFile C# (CSharp) Method

WriteFile() static private method

static private WriteFile ( string baseOutputDir, string subNamespace, string filename, string content, bool trimWhitespace = true, bool replaceTabs = true ) : bool
baseOutputDir string
subNamespace string
filename string
content string
trimWhitespace bool
replaceTabs bool
return bool
        internal static bool WriteFile(string baseOutputDir,
                                       string subNamespace,
                                       string filename,
                                       string content,
                                       bool trimWhitespace = true,
                                       bool replaceTabs = true)
        {
            string outputFilePath;
            return WriteFile(baseOutputDir, subNamespace, filename, content, trimWhitespace, replaceTabs, out outputFilePath);
        }

Same methods

GeneratorDriver::WriteFile ( string baseOutputDir, string subNamespace, string filename, string content, bool trimWhitespace, bool replaceTabs, string &outputFilePath ) : bool

Usage Example

        /// <summary>
        /// Invokes the T4 generator to emit a platform-specific project file.
        /// </summary>
        /// <param name="projectFileConfiguration"></param>
        /// <param name="session"></param>
        /// <param name="serviceFilesRoot"></param>
        /// <param name="projectFilename"></param>
        private void GenerateProjectFile(ProjectFileConfiguration projectFileConfiguration,
                                         ProjectConfigurationData projectConfiguration,
                                         IDictionary <string, object> session,
                                         string serviceFilesRoot,
                                         string projectFilename)
        {
            var    projectName      = Path.GetFileNameWithoutExtension(projectFilename);
            string generatedContent = null;

            try
            {
                var projectTemplateType = Type.GetType(
                    "ServiceClientGenerator.Generators.ProjectFiles." +
                    projectFileConfiguration.Template);
                dynamic generator = Activator.CreateInstance(projectTemplateType);
                generator.Session = session;
                generatedContent  = generator.TransformText();
            }
            catch (Exception)
            {
                throw new ArgumentException("Project template name "
                                            + projectFileConfiguration.Template + " is not recognized");
            }

            GeneratorDriver.WriteFile(serviceFilesRoot, string.Empty, projectFilename, generatedContent);
            projectConfiguration.ConfigurationPlatforms = projectFileConfiguration.Configurations;
        }
All Usage Examples Of ServiceClientGenerator.GeneratorDriver::WriteFile