Exemplo n.º 1
0
        private AttributeOrderRules Populate(string option, AttributeTokenTypeEnum tokenType)
        {
            if (!String.IsNullOrWhiteSpace(option))
            {
                int priority = 1;

                string[] attributeNames = option.Split(',')
                                          .Where(x => !String.IsNullOrWhiteSpace(x))
                                          .Select(x => x.Trim())
                                          .ToArray();

                foreach (string attributeName in attributeNames)
                {
                    _internalDictionary[attributeName] = new AttributeOrderRule
                    {
                        AttributeTokenType = tokenType,
                        Priority           = priority
                    };

                    priority++;
                }
            }

            return(this);
        }
        private AttributeOrderRules Populate(string option, AttributeTokenTypeEnum tokenType)
        {
            if (!String.IsNullOrWhiteSpace(option))
            {
                int priority = 1;

                string[] attributeNames = option.Split(',')
                    .Where(x => !String.IsNullOrWhiteSpace(x))
                    .Select(x => x.Trim())
                    .ToArray();

                foreach (string attributeName in attributeNames)
                {
                    _internalDictionary[attributeName] = new AttributeOrderRule
                                                             {
                                                                 AttributeTokenType = tokenType,
                                                                 Priority = priority
                                                             };

                    priority++;
                }
            }

            return this;
        }
Exemplo n.º 3
0
        public AttributeOrderRule GetRuleFor(string attributeName)
        {
            AttributeOrderRule result;

            if (_internalDictionary.Keys.Contains(attributeName))
            {
                result = _internalDictionary[attributeName];
            }
            else
            {
                AttributeTokenTypeEnum tempAttributeTokenType = attributeName.StartsWith("xmlns") ?
                                                                AttributeTokenTypeEnum.OTHER_NAMESPACE : AttributeTokenTypeEnum.OTHER;

                result = new AttributeOrderRule
                {
                    AttributeTokenType = tempAttributeTokenType,
                    Priority           = 0
                };
            }

            return(result);
        }