Esempio n. 1
0
            protected override BuildTagProvider GetProvider(string category, string tagName)
            {
                // Give priority to the default registered providers...
                BuildTagProvider provider = base.GetProvider(category, tagName);

                if (provider != null)
                {
                    return(provider);
                }

                IList <BuildTagProvider> providers = _providers[category];

                if (providers != null && providers.Count != 0)
                {
                    for (int i = 0; i < providers.Count; i++)
                    {
                        BuildTagProvider tagProvider = providers[i];
                        if (tagProvider.IsSupported(tagName))
                        {
                            provider = tagProvider;
                            break;
                        }
                    }
                }

                return(provider);
            }
Esempio n. 2
0
        protected virtual BuildTagProvider GetProvider(string category, string tagName)
        {
            if (String.IsNullOrEmpty(category) || String.IsNullOrEmpty(tagName))
            {
                return(null);
            }

            BuildTagProvider         provider  = null;
            IList <BuildTagProvider> providers = _userProviders[category];

            if (providers != null && providers.Count != 0)
            {
                for (int i = 0; i < providers.Count; i++)
                {
                    BuildTagProvider tagProvider = providers[i];
                    if (tagProvider.IsSupported(tagName))
                    {
                        provider = tagProvider;
                        break;
                    }
                }
            }

            return(provider);
        }
Esempio n. 3
0
            private string GetReplacement(string tagName, string category, string numberText,
                                          string formatText, string functionName, BuildTagProvider provider)
            {
                string replacement = null;

                if (provider != null && String.Equals(provider.Category, category) &&
                    provider.IsSupported(tagName))
                {
                    replacement = provider.GetText(tagName, numberText, formatText);
                }
                else
                {
                    BuildTagProvider tagProvider = this.GetProvider(category, tagName);
                    if (tagProvider != null)
                    {
                        replacement = tagProvider.GetText(tagName, numberText, formatText);
                    }
                    else
                    {
                        // We have the default processing...
                        replacement = this.GetReplacement(tagName, numberText, formatText);
                    }
                }

                if (!String.IsNullOrEmpty(replacement) && !String.IsNullOrEmpty(functionName))
                {
                    Func <string, string> function = this.GetFunction(functionName);

                    if (function != null)
                    {
                        replacement = function(replacement);
                    }
                }

                return(replacement);
            }