/// <summary>Method demonstrating basic operation of loading BibTex file</summary> /** <example><para>Method demonstrating basic operation of loading BibTex file</para> * <code> // Example 1: Loading BibTex file * BibTexDataFile bib_1 = new BibTexDataFile("Resources\\test\\S0306457309000259.bib"); * // Converting BibTex data into object model dictionary * System.Collections.Generic.Dictionary{string, BibTexEntryModel} model = bib_1.ConvertToModel(log); * // Printing [Author : Title] to a ILogBuilder log builder * foreach (var pair in model) * { * log.log(pair.Value.author.or("Unknown") + ": " + pair.Value.title); * } * </code></example> */ public void Example1_Basic() { // Example 1: Loading BibTex file BibTexDataFile bib_1 = new BibTexDataFile("Resources\\test\\S0306457309000259.bib"); // Converting BibTex data into object model dictionary BibTexCollection <BibTexEntryModel> model = bib_1.ConvertToModel <BibTexEntryModel>(log); // Printing [Author : Title] to a ILogBuilder log builder foreach (var pair in model) { log.log(pair.author.or("Unknown") + ": " + pair.title); } }
/// <summary> /// Converts all <see cref="BibTexEntryBase"/> from the file, into dictionary. In case of repeated <see cref="BibTexEntryModel.EntryKey"/>, only the first is part of returned dictionary. /// </summary> /// <param name="log">The log.</param> /// <returns></returns> public BibTexCollection <T> ConvertToModel <T>(ILogBuilder log = null) where T : BibTexEntryModel, new() { BibTexCollection <T> output = new BibTexCollection <T>(name, UntypedEntries); return(output); }