Source/NFX/Environment/ConfigNode.cs
/// <summary>
/// Navigates the path and return the appropriate section node. Example '!/nfx/logger/destination'
/// </summary>
/// <param name="path">If path starts from '!' then exception will be thrown if such a section node does not exist;
///  Use '/' as leading char for root,
///  '..' for step up. Multiple paths may be coalesced using '|' or ';'
/// </param>
Navigates the path and return the appropriate section node. Example '!/nfx/logger/destination'
Navigates the path and return the appropriate section node . Example ' ! / nfx / logger / destination '
public ConfigSectionNode NavigateSection(string path)
        {
          if (string.IsNullOrWhiteSpace(path))
           throw new ArgumentException(StringConsts.ARGUMENT_ERROR + "ConfigSectionNode.Navigate(path)", "path");
          try
          {
            var segments = path.Split(';', '|');
            for(var i=0; i<segments.Length; i++)
            {
                bool required;
                var node = (doNavigate(segments[i], out required) as ConfigSectionNode) ?? m_Configuration.m_EmptySectionNode;
                if (required && !node.Exists)
                 throw new ConfigException(string.Format(StringConsts.CONFIGURATION_NAVIGATION_SECTION_REQUIRED_ERROR, path));
                if (node.Exists) return node;
            }
            return m_Configuration.EmptySection;
          }
          catch(Exception error)
          {
            if (error is ConfigException)
             throw error;
            else
             throw new ConfigException(StringConsts.CONFIGURATION_NAVIGATION_BAD_PATH_ERROR + path ?? StringConsts.NULL_STRING);
          }
        }
public ConfigSectionNode NavigateSection ( string path ) { if ( string . IsNullOrWhiteSpace ( path ) ) throw new ArgumentException ( StringConsts . ARGUMENT_ERROR + " " , " " ) ; try { var segments = path . Split ( ' ' , ' ' ) ; for ( var i = 0 ; i < segments . Length ; i ++ ) { bool required ; var node = ( doNavigate ( segments [ i ] , out required ) as ConfigSectionNode ) ?? m_Configuration . m_EmptySectionNode ; if ( required && ! node . Exists ) throw new ConfigException ( string . Format ( StringConsts . CONFIGURATION_NAVIGATION_SECTION_REQUIRED_ERROR , path ) ) ; if ( node . Exists ) return node ; } return m_Configuration . EmptySection ; } catch ( Exception error ) { if ( error is ConfigException ) throw error ; else throw new ConfigException ( StringConsts . CONFIGURATION_NAVIGATION_BAD_PATH_ERROR + path ?? StringConsts . NULL_STRING ) ; } }
Navigates the path and return the appropriate section node.
Navigates the path and return the appropriate section node .
path
string
If path starts from '!' then exception will be thrown if such a section node does not exist;
Use '/' as leading char for root,
'..' for step up. Multiple paths may be coalesced using '|' or ';'
If path starts from ' ! ' then exception will be thrown if such a section node does not exist ; Use ' / ' as leading char for root ' .. ' for step up . Multiple paths may be coalesced using ' | ' or ' ; '