Exemplo n.º 1
0
        /**
         * @param element
         * @param specUrl
         */
        public ModulePrefs(XmlElement element, Uri inbase)
        {
            this._base = inbase;
            attributes = new Dictionary <String, String>();
            XmlNamedNodeMap attributeNodes = element.Attributes;

            for (int i = 0; i < attributeNodes.Count; i++)
            {
                XmlNode node = attributeNodes.Item(i);
                attributes.Add(node.Name, node.Value);
            }

            if (getTitle() == null)
            {
                throw new SpecParserException("ModulePrefs@title is required.");
            }

            categories = new List <string>()
            {
                getAttribute(ATTR_CATEGORY, ""), getAttribute(ATTR_CATEGORY2, "")
            };

            // Child elements
            PreloadVisitor preloadVisitor = new PreloadVisitor(_base);
            FeatureVisitor featureVisitor = new FeatureVisitor(_base);
            OAuthVisitor   oauthVisitor   = new OAuthVisitor(_base);
            IconVisitor    iconVisitor    = new IconVisitor(_base);
            LocaleVisitor  localeVisitor  = new LocaleVisitor(_base);
            LinkVisitor    linkVisitor    = new LinkVisitor(_base);

            Dictionary <String, ElementVisitor> visitors = new Dictionary <String, ElementVisitor>();

            visitors.Add("Preload", preloadVisitor);
            visitors.Add("Optional", featureVisitor);
            visitors.Add("Require", featureVisitor);
            visitors.Add("OAuth", oauthVisitor);
            visitors.Add("Icon", iconVisitor);
            visitors.Add("Locale", localeVisitor);
            visitors.Add("Link", linkVisitor);

            walk(element, visitors);

            preloads = preloadVisitor.preloaded;
            features = featureVisitor.features;
            icons    = iconVisitor.icons;
            locales  = localeVisitor.localeMap;
            links    = linkVisitor.linkMap;
            oauth    = oauthVisitor.oauthSpec;
        }
Exemplo n.º 2
0
        /**
         * @param element
         * @param specUrl
         */
        public ModulePrefs(XmlElement element, Uri inbase)
        {
            this._base = inbase;
            attributes = new Dictionary<String, String>();
            XmlNamedNodeMap attributeNodes = element.Attributes;
            for (int i = 0; i < attributeNodes.Count; i++)
            {
                XmlNode node = attributeNodes.Item(i);
                attributes.Add(node.Name, node.Value);
            }

            if (getTitle() == null)
            {
                throw new SpecParserException("ModulePrefs@title is required.");
            }

            categories = new List<string>() { getAttribute(ATTR_CATEGORY, ""), getAttribute(ATTR_CATEGORY2, "") };

            // Child elements
            PreloadVisitor preloadVisitor = new PreloadVisitor(_base);
            FeatureVisitor featureVisitor = new FeatureVisitor(_base);
            OAuthVisitor oauthVisitor = new OAuthVisitor(_base);
            IconVisitor iconVisitor = new IconVisitor(_base);
            LocaleVisitor localeVisitor = new LocaleVisitor(_base);
            LinkVisitor linkVisitor = new LinkVisitor(_base);

            Dictionary<String, ElementVisitor> visitors = new Dictionary<String, ElementVisitor>();
            visitors.Add("Preload", preloadVisitor);
            visitors.Add("Optional", featureVisitor);
            visitors.Add("Require", featureVisitor);
            visitors.Add("OAuth", oauthVisitor);
            visitors.Add("Icon", iconVisitor);
            visitors.Add("Locale", localeVisitor);
            visitors.Add("Link", linkVisitor);

            walk(element, visitors);

            preloads = preloadVisitor.preloaded;
            features = featureVisitor.features;
            icons = iconVisitor.icons;
            locales = localeVisitor.localeMap;
            links = linkVisitor.linkMap;
            oauth = oauthVisitor.oauthSpec;
        }