Example #1
0
        /// <summary>
        /// Checks if the node has the "multiple" attribute, and if so, initializes a dictionary entry for its grouper if one does not yet exist
        /// </summary>
        /// <param name="node">The xml node that describes the current entry</param>
        /// <param name="multiples">The dictionary holding the multiples groupers for the current section</param>
        /// <param name="parent">The parent of the current entry</param>
        /// <returns><paramref name="parent"/> if the "multiple" attribute was not found, and the grouper otherwise</returns>
        private SectionEntry HandleMultiples(XmlNode node, ref Dictionary <string, EntryGrouper> multiples, SectionEntry parent)
        {
            XmlAttribute multAtt = node.Attributes["multiple"];

            if (multAtt == null)
            {
                return(parent);
            }
            else
            {
                EntryGrouper grouper = null;

                if (multiples == null)
                {
                    multiples = new Dictionary <string, EntryGrouper>();
                }
                if (!multiples.TryGetValue(multAtt.Value, out grouper))
                {//grouper initialization
                    grouper = new EntryGrouper();
                    grouper.InternalName = null;
                    grouper.FriendlyName = node.Attributes["grouper-name"].Value;

                    XmlAttribute series = node.ParentNode.Attributes["series"];
                    if (series != null)
                    {
                        grouper.SeriesFormatting = SectionEntry.ParseSeriesType(series.Value);
                        parent.SeriesFormatting  = grouper.SeriesFormatting;
                    }

                    multiples[multAtt.Value] = grouper;
                    parent.Entries.Add(grouper);
                    grouper.Parent = parent;
                }
                return(grouper);
            }
        }