コード例 #1
0
ファイル: DynamicYaml.cs プロジェクト: imgen/YamlDotNet
        private bool TryGetValueByIndex(int index, out object result)
        {
            if (sequenceNode == null)
            {
                return(FailToGetValue(out result));
            }

            if (index >= sequenceNode.Count())
            {
                throw new IndexOutOfRangeException();
            }

            return(YamlDoc.TryMapValue(sequenceNode.ToArray()[index], out result));
        }
コード例 #2
0
ファイル: DynamicYaml.cs プロジェクト: imgen/YamlDotNet
        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);
                }
            }

            if (IsNullableType(type))
            {
                return(SuccessfullyGetValue(out result, new DynamicYaml((YamlNode)null)));
            }
            else
            {
                return(FailToGetValue(out result));
            }
        }
コード例 #3
0
ファイル: DynamicYaml.cs プロジェクト: imgen/YamlDotNet
 public void Reload(string yaml)
 {
     Reload(YamlDoc.LoadFromString(yaml));
 }
コード例 #4
0
ファイル: DynamicYaml.cs プロジェクト: imgen/YamlDotNet
 public void Reload(TextReader reader)
 {
     Reload(YamlDoc.LoadFromTextReader(reader));
 }
コード例 #5
0
ファイル: DynamicYaml.cs プロジェクト: imgen/YamlDotNet
 public DynamicYaml(string yaml)
     : this(YamlDoc.LoadFromString(yaml))
 {
 }
コード例 #6
0
ファイル: DynamicYaml.cs プロジェクト: imgen/YamlDotNet
 public DynamicYaml(TextReader reader)
     : this(YamlDoc.LoadFromTextReader(reader))
 {
 }