Exemplo n.º 1
0
 public QueryResult(object value, ConfigPath path)
 {
     _value = value;
     Path   = path;
     if (value == null)
     {
         throw new Exception("Result has no value!");
     }
 }
 public MaybeQueryResult(object value, ConfigPath path)
 {
     if (value == null)
     {
         IsPresent = false;
     }
     else
     {
         IsPresent    = true;
         _queryResult = new QueryResult(value, path);
     }
 }
Exemplo n.º 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());
Exemplo n.º 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);
Exemplo n.º 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);
Exemplo n.º 6
0
 internal ConfigNode(IDictionary <object, object> value, ConfigPath path)
 {
     _root = value ?? throw new ArgumentNullException(nameof(value));
     _path = path;
 }