Ejemplo n.º 1
0
 /// <summary>
 /// Load a collection with the contents of a MicroYaml document
 /// </summary>
 /// <param name="reader">A <see cref="TextReader"/> loaded with a MicroYaml document.</param>
 /// <param name="options">YamlReaderOptions to use when parsing. Null for default.</param>
 /// <param name="map">The collection into which the contents will be loaded.</param>
 /// <returns>The number of key-value pairs loaded into the document.</returns>
 static public int Load(TextReader reader, YamlReaderOptions options, ICollection <KeyValuePair <string, string> > map)
 {
     using (var r = new MicroYamlReader(reader, options))
     {
         return(r.CopyTo(map));
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Load a collection with the contents of a MicroYaml document
 /// </summary>
 /// <param name="stream">A <see cref="Stream"/> loaded with a MicroYaml document.</param>
 /// <param name="options">YamlReaderOptions to use when parsing. Null for default.</param>
 /// <param name="map">The collection into which the contents will be loaded.</param>
 /// <returns>The number of key-value pairs loaded into the document.</returns>
 static public int Load(Stream stream, YamlReaderOptions options, ICollection <KeyValuePair <string, string> > map)
 {
     if (options == null)
     {
         options = new YamlReaderOptions();
     }
     else
     {
         options = options.Clone();
     }
     using (var reader = new StreamReader(stream, Encoding.UTF8, true, 4096, !options.CloseInput))
     {
         options.CloseInput = false;
         using (var r = new MicroYamlReader(reader, options))
         {
             return(r.CopyTo(map));
         }
     }
 }