コード例 #1
0
 public QueryResult(object value, ConfigPath path)
 {
     _value = value;
     Path   = path;
     if (value == null)
     {
         throw new Exception("Result has no value!");
     }
 }
コード例 #2
0
 public MaybeQueryResult(object value, ConfigPath path)
 {
     if (value == null)
     {
         IsPresent = false;
     }
     else
     {
         IsPresent    = true;
         _queryResult = new QueryResult(value, path);
     }
 }
コード例 #3
0
 /// <summary>
 /// Add another path to the end of the path
 /// </summary>
 public ConfigPath Add(ConfigPath anotherPath) => new ConfigPath(Path.Concat(anotherPath.Path).ToArray());
コード例 #4
0
 /// <summary>
 /// Returns a maybe value specified by the path relative to this node
 /// </summary>
 /// <param name="path"></param>
 public MaybeQueryResult TryQuery(ConfigPath path) => new MaybeQueryResult(_root.TryReadPath(path.Path), path);
コード例 #5
0
 /// <summary>
 /// Returns the value specified by the path relative to this node
 /// </summary>
 /// <param name="path">The relative path to the required value</param>
 /// <returns>The value (of unknown type) if the path is valid</returns>
 /// <exception cref="PathReadingException">If the path is not valid</exception>
 /// <exception cref="LeafNodeException">If the node has ne children</exception>
 public QueryResult Query(ConfigPath path) => new QueryResult(_root.ReadPath(path.Path), path);
コード例 #6
0
 internal ConfigNode(IDictionary <object, object> value, ConfigPath path)
 {
     _root = value ?? throw new ArgumentNullException(nameof(value));
     _path = path;
 }