/// <summary>
        /// Creates a new installation configuration.
        /// </summary>
        public InstallationConfiguration(bool machineIsStandbyServer, string installationPath, bool isDevelopmentInstallation)
        {
            this.installationPath = installationPath;

            // The EWL configuration folder is not inside any particular app's folder the way that Web.config and app.config are. This is for two reasons. First, EWL
            // configuration is system-wide (technically installation-wide) and not app-specific like Web.config and app.config. Second, it could be disastrous to
            // have EWL configuration files inside a web app's folder since then these files, which often contain database passwords and other sensitive information,
            // could potentially be served up to users.
            configurationFolderPath =
                StandardLibraryMethods.CombinePaths(
                    InstallationFileStatics.GetGeneralFilesFolderPath(installationPath, isDevelopmentInstallation),
                    ConfigurationFolderName);


            // Do not perform schema validation for non-development installations because the schema files may not be available. For development installations, also
            // do not perform schema validation since the schema files may not match this version of the library. This can happen, for example, when you are trying to
            // run a system using an unreleased version of the library that contains schema changes.

            // system general configuration
            var systemGeneralConfigurationFilePath = StandardLibraryMethods.CombinePaths(ConfigurationFolderPath, "General.xml");

            systemGeneralConfiguration = XmlOps.DeserializeFromFile <SystemGeneralConfiguration>(systemGeneralConfigurationFilePath, false);

            // system development configuration
            if (isDevelopmentInstallation)
            {
                systemDevelopmentConfiguration =
                    XmlOps.DeserializeFromFile <SystemDevelopment.SystemDevelopmentConfiguration>(
                        StandardLibraryMethods.CombinePaths(configurationFolderPath, SystemDevelopmentConfigurationFileName),
                        false);
            }

            var installationConfigurationFolderPath = isDevelopmentInstallation
                                                                          ? StandardLibraryMethods.CombinePaths(
                ConfigurationFolderPath,
                InstallationConfigurationFolderName,
                InstallationsFolderName,
                DevelopmentInstallationFolderName)
                                                                          : StandardLibraryMethods.CombinePaths(ConfigurationFolderPath, InstallationConfigurationFolderName);

            // installation standard configuration
            var installationStandardConfigurationFilePath = StandardLibraryMethods.CombinePaths(
                installationConfigurationFolderPath,
                InstallationStandardConfigurationFileName);

            installationStandardConfiguration = XmlOps.DeserializeFromFile <InstallationStandardConfiguration>(installationStandardConfigurationFilePath, false);


            var systemWebApplicationElements = systemGeneralConfiguration.WebApplications ?? new SystemGeneralConfigurationApplication[0];

            webApplications                       = from systemElement in systemWebApplicationElements
                                         let name = systemElement.Name
                                                    let supportsSecureConnections = systemElement.SupportsSecureConnections
                                                                                    select
                                                                                    isDevelopmentInstallation
                                                          ? new WebApplication(
                name,
                supportsSecureConnections,
                installationPath,
                SystemShortName,
                systemWebApplicationElements.Skip(1).Any(),
                systemDevelopmentConfiguration.webProjects.Single(i => i.name == name))
                                                          : InstallationType == InstallationType.Live
                                                                    ? new WebApplication(
                name,
                supportsSecureConnections,
                machineIsStandbyServer,
                LiveInstallationConfiguration.WebApplications.Single(i => i.Name == name))
                                                                    : new WebApplication(
                name,
                supportsSecureConnections,
                IntermediateInstallationConfiguration.WebApplications.Single(i => i.Name == name));

            webApplications = webApplications.ToArray();

            // installation custom configuration
            installationCustomConfigurationFilePath = StandardLibraryMethods.CombinePaths(installationConfigurationFolderPath, "Custom.xml");
        }
        /// <summary>
        /// Creates a new installation configuration.
        /// </summary>
        public InstallationConfiguration( bool machineIsStandbyServer, string installationPath, bool isDevelopmentInstallation )
        {
            this.installationPath = installationPath;

            // The EWL configuration folder is not inside any particular app's folder the way that Web.config and app.config are. This is for two reasons. First, EWL
            // configuration is system-wide (technically installation-wide) and not app-specific like Web.config and app.config. Second, it could be disastrous to
            // have EWL configuration files inside a web app's folder since then these files, which often contain database passwords and other sensitive information,
            // could potentially be served up to users.
            configurationFolderPath = EwlStatics.CombinePaths(
                InstallationFileStatics.GetGeneralFilesFolderPath( installationPath, isDevelopmentInstallation ),
                ConfigurationFolderName );

            // Do not perform schema validation for non-development installations because the schema files may not be available. For development installations, also
            // do not perform schema validation since the schema files may not match this version of the library. This can happen, for example, when you are trying to
            // run a system using an unreleased version of the library that contains schema changes.

            // system general configuration
            var systemGeneralConfigurationFilePath = EwlStatics.CombinePaths( ConfigurationFolderPath, "General.xml" );
            systemGeneralConfiguration = XmlOps.DeserializeFromFile<SystemGeneralConfiguration>( systemGeneralConfigurationFilePath, false );

            // system development configuration
            if( isDevelopmentInstallation ) {
                systemDevelopmentConfiguration =
                    XmlOps.DeserializeFromFile<SystemDevelopment.SystemDevelopmentConfiguration>(
                        EwlStatics.CombinePaths( configurationFolderPath, SystemDevelopmentConfigurationFileName ),
                        false );
            }

            var installationConfigurationFolderPath = isDevelopmentInstallation
                                                          ? EwlStatics.CombinePaths(
                                                              ConfigurationFolderPath,
                                                              InstallationConfigurationFolderName,
                                                              InstallationsFolderName,
                                                              DevelopmentInstallationFolderName )
                                                          : EwlStatics.CombinePaths( ConfigurationFolderPath, InstallationConfigurationFolderName );

            // installation standard configuration
            var installationStandardConfigurationFilePath = EwlStatics.CombinePaths( installationConfigurationFolderPath, InstallationStandardConfigurationFileName );
            installationStandardConfiguration = XmlOps.DeserializeFromFile<InstallationStandardConfiguration>( installationStandardConfigurationFilePath, false );

            var systemWebApplicationElements = systemGeneralConfiguration.WebApplications ?? new SystemGeneralConfigurationApplication[ 0 ];
            webApplications = from systemElement in systemWebApplicationElements
                              let name = systemElement.Name
                              let supportsSecureConnections = systemElement.SupportsSecureConnections
                              select
                                  isDevelopmentInstallation
                                      ? new WebApplication(
                                            name,
                                            installationPath,
                                            supportsSecureConnections,
                                            SystemShortName,
                                            systemWebApplicationElements.Skip( 1 ).Any(),
                                            systemDevelopmentConfiguration.webProjects.Single( i => i.name == name ) )
                                      : InstallationType == InstallationType.Live
                                            ? new WebApplication(
                                                  name,
                                                  installationPath,
                                                  supportsSecureConnections,
                                                  machineIsStandbyServer,
                                                  LiveInstallationConfiguration.WebApplications.Single( i => i.Name == name ) )
                                            : new WebApplication(
                                                  name,
                                                  installationPath,
                                                  supportsSecureConnections,
                                                  IntermediateInstallationConfiguration.WebApplications.Single( i => i.Name == name ) );
            webApplications = webApplications.ToArray();

            // installation custom configuration
            installationCustomConfigurationFilePath = EwlStatics.CombinePaths( installationConfigurationFolderPath, "Custom.xml" );
        }