internal void GenerateCode(TextWriter writer) { writer.WriteLine("namespace " + generalData.Namespace + " {"); writer.WriteLine("public class " + generalData.ClassName + " {"); writer.WriteLine("public sealed class Info: StaticCssInfo {"); writeBuildUrlMethod(writer); writer.WriteLine( "protected override DateTimeOffset getBuildDateAndTime() { return " + AppStatics.GetLiteralDateTimeExpression(DateTimeOffset.UtcNow) + "; }"); writeAppRelativeFilePathProperty(writer); writer.WriteLine("}"); writer.WriteLine("}"); writer.WriteLine("}"); }
void Operation.Execute(Installation genericInstallation, OperationResult operationResult) { IsuStatics.ConfigureIis(true, false); Console.WriteLine("Configured IIS Express."); // This block exists because of https://enduracode.kilnhg.com/Review/K164316. try { IsuStatics.ConfigureIis(false, false); Console.WriteLine("Configured full IIS."); } catch { Console.WriteLine("Did not configure full IIS."); } var installation = genericInstallation as DevelopmentInstallation; DatabaseOps.UpdateDatabaseLogicIfUpdateFileExists( installation.DevelopmentInstallationLogic.Database, installation.ExistingInstallationLogic.DatabaseUpdateFilePath, true); try { copyInEwlFiles(installation); } catch (Exception e) { var message = "Failed to copy {0} files into the installation. Please try the operation again.".FormatWith(EwlStatics.EwlName); if (e is UnauthorizedAccessException || e is IOException) { throw new UserCorrectableException(message, e); } throw new ApplicationException(message, e); } // Generate code. if (installation.DevelopmentInstallationLogic.SystemIsEwl) { generateCodeForProject( installation, AppStatics.CoreProjectName, writer => { writer.WriteLine("using System;"); writer.WriteLine("using System.Globalization;"); writer.WriteLine("using System.Reflection;"); writer.WriteLine("using System.Runtime.InteropServices;"); writer.WriteLine(); writeAssemblyInfo(writer, installation, ""); writer.WriteLine(); writer.WriteLine("namespace EnterpriseWebLibrary {"); writer.WriteLine("partial class EwlStatics {"); CodeGenerationStatics.AddSummaryDocComment(writer, "The date/time at which this version of EWL was built."); writer.WriteLine( "public static readonly DateTimeOffset EwlBuildDateTime = {0};".FormatWith(AppStatics.GetLiteralDateTimeExpression(DateTimeOffset.UtcNow))); writer.WriteLine("}"); writer.WriteLine("}"); }); generateCodeForProject( installation, "Development Utility", writer => { writer.WriteLine("using System.Reflection;"); writer.WriteLine("using System.Runtime.InteropServices;"); writeAssemblyInfo(writer, installation, "Development Utility"); }); } generateLibraryCode(installation); foreach (var webProject in installation.DevelopmentInstallationLogic.DevelopmentConfiguration.webProjects ?? new WebProject[0]) { generateWebConfigAndCodeForWebProject(installation, webProject); } foreach (var service in installation.ExistingInstallationLogic.RuntimeConfiguration.WindowsServices) { generateWindowsServiceCode(installation, service); } foreach (var project in installation.DevelopmentInstallationLogic.DevelopmentConfiguration.ServerSideConsoleProjectsNonNullable) { generateServerSideConsoleProjectCode(installation, project); } if (installation.DevelopmentInstallationLogic.DevelopmentConfiguration.clientSideAppProject != null) { generateCodeForProject( installation, installation.DevelopmentInstallationLogic.DevelopmentConfiguration.clientSideAppProject.name, writer => { writer.WriteLine("using System.Reflection;"); writer.WriteLine("using System.Runtime.InteropServices;"); writeAssemblyInfo(writer, installation, installation.DevelopmentInstallationLogic.DevelopmentConfiguration.clientSideAppProject.name); }); } generateXmlSchemaLogicForCustomInstallationConfigurationXsd(installation); generateXmlSchemaLogicForOtherXsdFiles(installation); if (!installation.DevelopmentInstallationLogic.SystemIsEwl && Directory.Exists(EwlStatics.CombinePaths(installation.GeneralLogic.Path, ".hg"))) { updateMercurialIgnoreFile(installation); } }
internal void GenerateCode(TextWriter writer) { writer.WriteLine("namespace {0} {{".FormatWith(generalData.Namespace)); writer.WriteLine("public sealed partial class {0}: StaticFile {{".FormatWith(generalData.ClassName)); UrlStatics.GenerateUrlClasses( writer, generalData.ClassName, null, Enumerable.Empty <WebItemParameter>().Materialize(), Enumerable.Empty <WebItemParameter>().Materialize(), !inVersionedFolder); writer.WriteLine("private readonly {0} folderSetup;".FormatWith(folderSetupClassName)); if (inVersionedFolder) { writer.WriteLine("public {0}(): base( true ) {{".FormatWith(generalData.ClassName)); } else { writer.WriteLine("public {0}( bool disableVersioning = false ): base( !disableVersioning ) {{".FormatWith(generalData.ClassName)); } writer.WriteLine("folderSetup = new {0}();".FormatWith(folderSetupClassName)); writer.WriteLine("}"); writer.WriteLine("public override EntitySetupBase EsAsBaseType => folderSetup;"); UrlStatics.GenerateGetEncoderMethod( writer, "", Enumerable.Empty <WebItemParameter>().Materialize(), Enumerable.Empty <WebItemParameter>().Materialize(), p => "false", !inVersionedFolder); writer.WriteLine( "protected override DateTimeOffset getBuildDateAndTime() => {0};".FormatWith(AppStatics.GetLiteralDateTimeExpression(DateTimeOffset.UtcNow))); writer.WriteLine("protected override bool isFrameworkFile => {0};".FormatWith(inFramework ? "true" : "false")); writer.WriteLine( "protected override string relativeFilePath => @\"{0}\";".FormatWith( generalData.PathRelativeToProject.Substring( ((inFramework ? EnterpriseWebFramework.StaticFile.FrameworkStaticFilesSourceFolderPath : EnterpriseWebFramework.StaticFile.AppStaticFilesFolderName) + Path.DirectorySeparatorChar).Length))); writer.WriteLine("}"); writer.WriteLine("}"); }