Exemplo n.º 1
0
        void HandleTopLevelNode(XPathNavigator nav)
        {
            string section = nav.LocalName;

            if (!section_handlers.ContainsKey(section))
            {
                return;
            }

            HandlerDescription hd = section_handlers [section];

            if (hd == null)
            {
                return;
            }

            IDocumentNodeHandler handler = hd.Handler as IDocumentNodeHandler;
            object storage = hd.Storage;

            if (handler == null || storage == null)
            {
                return;
            }

            if (handler is IStorageConsumer)
            {
                ((IStorageConsumer)handler).SetStorage(storage);
            }

            handler.ReadConfiguration(nav);
            handler.StoreConfiguration();
        }
Exemplo n.º 2
0
        void AddSectionHandler(XPathNavigator nav, List <HandlerDescription> handlers)
        {
            string             section = Helpers.GetRequiredNonEmptyAttribute(nav, "section");
            HandlerDescription hd      = new HandlerDescription(Helpers.GetRequiredNonEmptyAttribute(nav, "type"),
                                                                Helpers.GetRequiredNonEmptyAttribute(nav, "storageType"),
                                                                section);

            if (section_handlers.ContainsKey(section))
            {
                HandlerDescription old = section_handlers [section];
                section_handlers [section] = hd;

                handlers.Remove(old);
                handlers.Add(hd);
            }
            else
            {
                section_handlers.Add(section, hd);
                handlers.Add(hd);
            }
        }