FindLocationConfiguration() private method

private FindLocationConfiguration ( string relativePath, Configuration defaultConfiguration ) : Configuration
relativePath string
defaultConfiguration Configuration
return Configuration
示例#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());
        }
示例#2
0
        static bool LookUpLocation(string relativePath, ref _Configuration defaultConfiguration)
        {
            if (String.IsNullOrEmpty(relativePath))
            {
                return(false);
            }

            _Configuration cnew = defaultConfiguration.FindLocationConfiguration(relativePath, defaultConfiguration);

            if (cnew == defaultConfiguration)
            {
                return(false);
            }

            defaultConfiguration = cnew;
            return(true);
        }
示例#3
0
		internal Configuration (InternalConfigurationSystem system, string locationSubPath)
		{
			hasFile = true;
			this.system = system;

			system.InitForConfiguration (ref locationSubPath, out configPath, out locationConfigPath);
			
			Configuration parent = null;
			
			if (locationSubPath != null) {
				parent = new Configuration (system, locationSubPath);
				if (locationConfigPath != null)
					parent = parent.FindLocationConfiguration (locationConfigPath, parent);
			}
			
			Init (system, configPath, parent);
		}
示例#4
0
        internal Configuration(InternalConfigurationSystem system, string locationSubPath)
        {
            hasFile     = true;
            this.system = system;

            system.InitForConfiguration(ref locationSubPath, out configPath, out locationConfigPath);

            Configuration parent = null;

            if (locationSubPath != null)
            {
                parent = new Configuration(system, locationSubPath);
                if (locationConfigPath != null)
                {
                    parent = parent.FindLocationConfiguration(locationConfigPath, parent);
                }
            }

            Init(system, configPath, parent);
        }
        public Configuration OpenConfiguration()
        {
            if (configuration == null)
            {
                if (!parentResolved)
                {
                    Configuration parentFile = parent.GetParentWithFile();
                    if (parentFile != null)
                    {
                        string parentRelativePath = parent.ConfigHost.GetConfigPathFromLocationSubPath(parent.LocationConfigPath, path);
                        parent = parentFile.FindLocationConfiguration(parentRelativePath, parent);
                    }
                }

                configuration = new Configuration(parent, path);
                using (XmlTextReader tr = new ConfigXmlTextReader(new StringReader(xmlContent), path))
                    configuration.ReadData(tr, allowOverride);

                xmlContent = null;
            }
            return(configuration);
        }
示例#6
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());
        }
		static bool LookUpLocation (string relativePath, ref _Configuration defaultConfiguration)
		{
			if (String.IsNullOrEmpty (relativePath))
				return false;

			_Configuration cnew = defaultConfiguration.FindLocationConfiguration (relativePath, defaultConfiguration);
			if (cnew == defaultConfiguration)
				return false;

			defaultConfiguration = cnew;
			return true;
		}