Exemple #1
0
        public void Initialize(CopterConfig config)
        {
            RegisterDependencies(config);

            RunStartupTasks();
            //if (!config.IgnoreStartupTasks)
            //{
            //    RunStartupTasks();
            //}
        }
Exemple #2
0
 protected abstract void RegisterDependencies(CopterConfig config);
Exemple #3
0
        public object Create(object parent, object configContext, XmlNode section)
        {
            CopterConfig config = new CopterConfig();

            var startupNode = section.SelectSingleNode("Startup");

            if (startupNode != null && startupNode.Attributes != null)
            {
                var attribute = startupNode.Attributes["IgnoreStartupTasks"];
                if (attribute != null)
                {
                    config.IgnoreStartupTasks = Convert.ToBoolean(attribute.Value);
                }
            }

            var redisCachingNode = section.SelectSingleNode("RedisCaching");

            if (redisCachingNode != null && redisCachingNode.Attributes != null)
            {
                var enabledAttribute = redisCachingNode.Attributes["Enabled"];
                if (enabledAttribute != null)
                {
                    config.RedisCachingEnabled = Convert.ToBoolean(enabledAttribute.Value);
                }

                var connectionStringAttribute = redisCachingNode.Attributes["ConnectionString"];
                if (connectionStringAttribute != null)
                {
                    config.RedisCachingConnectionString = connectionStringAttribute.Value;
                }
            }

            var userAgentStringsNode = section.SelectSingleNode("UserAgentStrings");

            if (userAgentStringsNode != null && userAgentStringsNode.Attributes != null)
            {
                var attribute = userAgentStringsNode.Attributes["databasePath"];
                if (attribute != null)
                {
                    config.UserAgentStringsPath = attribute.Value;
                }
            }

            var supportPreviousVersionsNode = section.SelectSingleNode("SupportPreviousVersions");

            if (supportPreviousVersionsNode != null && supportPreviousVersionsNode.Attributes != null)
            {
                var attribute = supportPreviousVersionsNode.Attributes["Enabled"];
                if (attribute != null)
                {
                    config.SupportPreviousVersions = Convert.ToBoolean(attribute.Value);
                }
            }

            var webFarmsNode = section.SelectSingleNode("WebFarms");

            if (webFarmsNode != null && webFarmsNode.Attributes != null)
            {
                var multipleInstancesEnabledAttribute = webFarmsNode.Attributes["MultipleInstancesEnabled"];
                if (multipleInstancesEnabledAttribute != null)
                {
                    config.MultipleInstancesEnabled = Convert.ToBoolean(multipleInstancesEnabledAttribute.Value);
                }

                var runOnAzureWebsitesAttribute = webFarmsNode.Attributes["RunOnAzureWebsites"];
                if (runOnAzureWebsitesAttribute != null)
                {
                    config.RunOnAzureWebsites = Convert.ToBoolean(runOnAzureWebsitesAttribute.Value);
                }
            }

            var azureBlobStorageNode = section.SelectSingleNode("AzureBlobStorage");

            if (azureBlobStorageNode != null && azureBlobStorageNode.Attributes != null)
            {
                var azureConnectionStringAttribute = azureBlobStorageNode.Attributes["ConnectionString"];
                if (azureConnectionStringAttribute != null)
                {
                    config.AzureBlobStorageConnectionString = azureConnectionStringAttribute.Value;
                }

                var azureContainerNameAttribute = azureBlobStorageNode.Attributes["ContainerName"];
                if (azureContainerNameAttribute != null)
                {
                    config.AzureBlobStorageContainerName = azureContainerNameAttribute.Value;
                }

                var azureEndPointAttribute = azureBlobStorageNode.Attributes["EndPoint"];
                if (azureEndPointAttribute != null)
                {
                    config.AzureBlobStorageEndPoint = azureEndPointAttribute.Value;
                }
            }

            var installationNode = section.SelectSingleNode("Installation");

            if (installationNode != null && installationNode.Attributes != null)
            {
                var disableSampleDataDuringInstallationAttribute = installationNode.Attributes["DisableSampleDataDuringInstallation"];
                if (disableSampleDataDuringInstallationAttribute != null)
                {
                    config.DisableSampleDataDuringInstallation = Convert.ToBoolean(disableSampleDataDuringInstallationAttribute.Value);
                }

                var useFastInstallationServiceAttribute = installationNode.Attributes["UseFastInstallationService"];
                if (useFastInstallationServiceAttribute != null)
                {
                    config.UseFastInstallationService = Convert.ToBoolean(useFastInstallationServiceAttribute.Value);
                }

                var pluginsIgnoredDuringInstallationAttribute = installationNode.Attributes["PluginsIgnoredDuringInstallation"];
                if (pluginsIgnoredDuringInstallationAttribute != null)
                {
                    config.PluginsIgnoredDuringInstallation = pluginsIgnoredDuringInstallationAttribute.Value;
                }
            }

            return(config);
        }