Пример #1
0
        public static async Task <object> ParseAsync(IParseManager parseManager)
        {
            var zoomId     = string.Empty;
            var fontSize   = 16;
            var attributes = new NameValueCollection();

            foreach (var name in parseManager.ContextInfo.Attributes.AllKeys)
            {
                var value = parseManager.ContextInfo.Attributes[name];

                if (StringUtils.EqualsIgnoreCase(name, ZoomId))
                {
                    zoomId = value;
                }
                else if (StringUtils.EqualsIgnoreCase(name, FontSize))
                {
                    fontSize = TranslateUtils.ToInt(value, 16);
                }
                else
                {
                    TranslateUtils.AddAttributeIfNotExists(attributes, name, value);
                }
            }

            return(await ParseAsync(parseManager, attributes, zoomId, fontSize));
        }
Пример #2
0
        public static async Task <object> ParseAsync(IParseManager parseManager)
        {
            var type       = TypeNextContent;
            var emptyText  = string.Empty;
            var tipText    = string.Empty;
            var wordNum    = 0;
            var isKeyboard = false;
            var attributes = new NameValueCollection();

            foreach (var name in parseManager.ContextInfo.Attributes.AllKeys)
            {
                var value = parseManager.ContextInfo.Attributes[name];

                if (StringUtils.EqualsIgnoreCase(name, Type))
                {
                    type = value;
                }
                else if (StringUtils.EqualsIgnoreCase(name, EmptyText))
                {
                    emptyText = value;
                }
                else if (StringUtils.EqualsIgnoreCase(name, TipText))
                {
                    tipText = value;
                }
                else if (StringUtils.EqualsIgnoreCase(name, WordNum))
                {
                    wordNum = TranslateUtils.ToInt(value);
                }
                else if (StringUtils.EqualsIgnoreCase(name, IsKeyboard))
                {
                    isKeyboard = TranslateUtils.ToBool(value);
                }
                else
                {
                    TranslateUtils.AddAttributeIfNotExists(attributes, name, value);
                }
            }

            return(parseManager.ContextInfo.IsStlEntity
                ? await ParseEntitiesAsync(type, parseManager)
                : await ParseImplAsync(parseManager, attributes, type, emptyText, tipText, wordNum, isKeyboard));
        }
Пример #3
0
        public static async Task <object> ParseAsync(IParseManager parseManager)
        {
            var titleId    = string.Empty;
            var bodyId     = string.Empty;
            var logoId     = string.Empty;
            var locationId = string.Empty;
            var attributes = new NameValueCollection();

            foreach (var name in parseManager.ContextInfo.Attributes.AllKeys)
            {
                var value = parseManager.ContextInfo.Attributes[name];

                if (StringUtils.EqualsIgnoreCase(name, TitleId))
                {
                    titleId = value;
                }
                else if (StringUtils.EqualsIgnoreCase(name, BodyId))
                {
                    bodyId = value;
                }
                else if (StringUtils.EqualsIgnoreCase(name, LogoId))
                {
                    logoId = value;
                }
                else if (StringUtils.EqualsIgnoreCase(name, LocationId))
                {
                    locationId = value;
                }
                else
                {
                    TranslateUtils.AddAttributeIfNotExists(attributes, name, value);
                }
            }

            return(await ParseImplAsync(parseManager, attributes, titleId, bodyId, logoId, locationId));
        }