Exemplo n.º 1
0
        /// <summary>
        /// Create files based on the project type
        /// </summary>
        /// <param name="projectDir">Directory of the project</param>
        /// <param name="projectType">Type of the project</param>
        /// <param name="fileType">Type of the file to be created</param>
        private void CreateStartupFiles(string projectDir, ProjectType projectType, FileTypeCreation fileType)
        {
            string projectNamespace = GetProjectNamespace();

            var file = Path.Combine(projectDir, string.Concat(fileType.ToString(), ".cs"));

            if (File.Exists(file))
            {
                File.Move(file, string.Concat(file, ".bak"));
            }
            File.WriteAllText(file, GetStartupFileContent(projectNamespace, projectType, fileType));

            LogChange(string.Format("Created {0}.cs file using {1} template", fileType.ToString(), projectType.ToString()));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Gets a Startup.cs file based on the project type
 /// </summary>
 /// <param name="projectNamespace">The project namespace</param>
 /// <param name="projectType">The project type</param>
 /// <param name="fileType">Type of the file to be retrieved</param>
 /// <returns>The content of the startup file</returns>
 private string GetStartupFileContent(string projectNamespace, ProjectType projectType, FileTypeCreation fileType)
 {
     return(TemplateHelper.GetTemplateFileContent(projectNamespace, projectType, fileType.ToString() + ".cs"));
 }