Пример #1
0
        public IkadnBaseObject Parse(IkadnReader reader)
        {
            string contextName = IkonParser.ReadIdentifier(reader);
            var    entries     = new Dictionary <string, IText>();

            while (reader.PeekNextNonwhite() != ClosingChar)
            {
                var id = IkonParser.ReadIdentifier(reader).ToUpperInvariant();

                if (!entries.ContainsKey(id))
                {
                    entries.Add(id, reader.ReadObject().To <IText>());
                }
                else
                {
                    AppData.ErrorReporter.Get.Report(new ArgumentException("Duplicate localization entry, id: " + id + " in context: " + contextName));
                }
            }

            reader.Read();

            return(new Context(contextName, entries));
        }
Пример #2
0
        public IkadnBaseObject Parse(IkadnParser parser)
        {
            string contextName = IkonParser.ReadIdentifier(parser.Reader);
            var    entries     = new Dictionary <string, IText>();

            while (parser.Reader.PeekNextNonwhite() != ClosingChar)
            {
                var id = IkonParser.ReadIdentifier(parser.Reader).ToLower();

                if (!entries.ContainsKey(id))
                {
                    entries.Add(id, parser.ParseNext().To <IText>());
                }
                else
                {
                    System.Diagnostics.Trace.WriteLine("Duplicate localization entry, id: " + id + " in context: " + contextName);
                }
            }

            parser.Reader.Read();

            return(new Context(contextName, entries));
        }