Exemplo n.º 1
0
		private bool TryGetValueByYamlKeyAndType(YamlScalarNode yamlKey, Type type, out object result)
		{
			if (mappingNode.Children.ContainsKey(yamlKey))
			{
				var value = mappingNode.Children[yamlKey];
				if (YamlDoc.TryMapValue(value, out result))
				{
					return true;
				}
			}
			
			return FailToGetValue(out result);
		}
Exemplo n.º 2
0
		public void Reload(YamlNode node)
		{
			yamlNode = node;
			mappingNode = yamlNode as YamlMappingNode;
			sequenceNode = yamlNode as YamlSequenceNode;
			scalarNode = yamlNode as YamlScalarNode;
			children = null;
		}
Exemplo n.º 3
0
 /// <summary>
 /// Called after this object finishes visiting a <see cref="YamlScalarNode"/>.
 /// </summary>
 /// <param name="scalar">
 /// The <see cref="YamlScalarNode"/> that has been visited.
 /// </param>
 protected virtual void Visited(YamlScalarNode scalar)
 {
     // Do nothing.
 }
Exemplo n.º 4
0
		private bool TryGetValueByKeyAndType(string key, Type type, out object result)
		{
			if (mappingNode == null)
			{
				return FailToGetValue(out result);
			}

			// try and get an exact match to the key first
			if (TryGetValueByYamlKeyAndType(key, type, out result))
			{
				return true;
			}

			// otherwise try and match the key with a different cased first character
			var yamlKey = new YamlScalarNode(key.InverseFirstCapital());
			if (TryGetValueByYamlKeyAndType(yamlKey, type, out result))
			{
				return true;
			}

			return IsNullableType(type) ? SuccessfullyGetValue(new DynamicYaml((YamlNode)null), out result) : FailToGetValue(out result);
		}
Exemplo n.º 5
0
 void IYamlVisitor.Visit(YamlScalarNode scalar)
 {
     Visit(scalar);
     Visited(scalar);
 }
Exemplo n.º 6
0
 protected override void Visit(YamlScalarNode scalar)
 {
     VisitNode(scalar);
 }
Exemplo n.º 7
0
			protected override void Visit(YamlScalarNode scalar)
			{
				VisitNode(scalar);
			}
Exemplo n.º 8
0
		/// <summary>
		/// Called after this object finishes visiting a <see cref="YamlScalarNode"/>.
		/// </summary>
		/// <param name="scalar">
		/// The <see cref="YamlScalarNode"/> that has been visited.
		/// </param>
		protected virtual void Visited (YamlScalarNode scalar)
		{
			// Do nothing.
		}
Exemplo n.º 9
0
		void IYamlVisitor.Visit (YamlScalarNode scalar)
		{
			Visit(scalar);
			Visited(scalar);
		}