Esempio n. 1
0
        internal Configuration FindLocationConfiguration(string relativePath, Configuration defaultConfiguration)
        {
            Configuration parentConfig = defaultConfiguration;

            if (!String.IsNullOrEmpty(LocationConfigPath))
            {
                Configuration parentFile = GetParentWithFile();
                if (parentFile != null)
                {
                    string parentRelativePath = system.Host.GetConfigPathFromLocationSubPath(configPath, relativePath);
                    parentConfig = parentFile.FindLocationConfiguration(parentRelativePath, defaultConfiguration);
                }
            }

            string relConfigPath = configPath.Substring(1) + "/";

            if (relativePath.StartsWith(relConfigPath, StringComparison.Ordinal))
            {
                relativePath = relativePath.Substring(relConfigPath.Length);
            }

            ConfigurationLocation loc = Locations.FindBest(relativePath);

            if (loc == null)
            {
                return(parentConfig);
            }

            loc.SetParentConfiguration(parentConfig);
            return(loc.OpenConfiguration());
        }
Esempio n. 2
0
        internal Configuration FindLocationConfiguration(string relativePath, Configuration defaultConfiguration)
        {
            ConfigurationLocation loc = Locations.Find(relativePath);

            Configuration parentConfig = defaultConfiguration;

            if (LocationConfigPath != null)
            {
                Configuration parentFile = GetParentWithFile();
                if (parentFile != null)
                {
                    string parentRelativePath = system.Host.GetConfigPathFromLocationSubPath(LocationConfigPath, relativePath);
                    parentConfig = parentFile.FindLocationConfiguration(parentRelativePath, defaultConfiguration);
                }
            }

            if (loc == null)
            {
                return(parentConfig);
            }

            loc.SetParentConfiguration(parentConfig);
            return(loc.OpenConfiguration());
        }