Esempio n. 1
0
        public ContoursElevationRuleMap Parse(Stream inputStream)
        {
            WikiParser.SetWikiContentSource(inputStream);

            rules           = new ContoursElevationRuleMap();
            templateCounter = 0;
            string currentMainSection = null;

            while (true)
            {
                WikiContentType wikiContentType;

                wikiContentType = WikiParser.Next();

                if (wikiContentType == WikiContentType.Eof)
                {
                    break;
                }

                if (wikiContentType == WikiContentType.Section || wikiContentType == WikiContentType.Text)
                {
                    WikiSection section = WikiParser.Context.LowestSection;
                    if (section == null)
                    {
                        continue;
                    }

                    if (wikiContentType == WikiContentType.Section)
                    {
                        if (section.SectionLevel == 1)
                        {
                            currentMainSection = section.SectionName;
                        }
                    }
                    else if (wikiContentType == WikiContentType.Text)
                    {
                        continue;
                    }

                    if (currentMainSection == null)
                    {
                        continue;
                    }

                    switch (currentMainSection.ToLowerInvariant())
                    {
                    case "contours rendering rules":
                    {
                        SkipToTableAndParseIt(ParseRule);
                        break;
                    }
                    }
                }
            }

            return(rules);
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WikiRulesParser"/> class.
        /// </summary>
        /// <param name="inputStream">The input stream from which the rendering rules will be parsed..</param>
        public WikiRulesParser(
            Stream inputStream,
            TypesRegistry typesRegistry,
            CharactersConversionDictionary charactersConversionDictionary,
            ISerializersRegistry serializersRegistry)
        {
            this.typesRegistry = typesRegistry;
            this.charactersConversionDictionary = charactersConversionDictionary;
            this.serializersRegistry            = serializersRegistry;

            WikiParser.SetWikiContentSource(inputStream);
        }