FindLocationConfiguration() приватный Метод

private FindLocationConfiguration ( string relativePath, Configuration defaultConfiguration ) : Configuration
relativePath string
defaultConfiguration Configuration
Результат 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());
        }
Пример #7
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;
		}