示例#1
0
        /// <summary>
        /// Get enconding rules
        /// </summary>
        /// <param name="theVersion"></param>
        /// <param name="theEncoding"></param>
        /// <returns></returns>
        public IEncodingRule[] getEncodingRules(string theVersion, string theEncoding)
        {
            IEncodingRule[] result = new IEncodingRule[0];
            if (originalContext != null)
            {
                result = originalContext.getEncodingRules(theVersion, theEncoding);
            }

            foreach (ISpecificEncodingRule rule in encodingRules)
            {
                // Add the rule if it applies
                bool flag1 = rule.GetVersions().Contains("*") || rule.GetVersions().Contains(theVersion);
                bool flag2 = rule.GetEncodings().Contains("*") || rule.GetEncodings().Contains(theEncoding);
                if (flag1 && flag2)
                {
                    List <IEncodingRule> rules = new List <IEncodingRule>(result);
                    rules.Add(rule);
                    result = rules.ToArray();
                }
            }

            return(result);
        }
示例#2
0
        /// <summary>
        /// Get enconding rules
        /// </summary>
        /// <param name="theVersion"></param>
        /// <param name="theEncoding"></param>
        /// <returns></returns>
        public IEncodingRule[] getEncodingRules(string theVersion, string theEncoding)
        {
            IEncodingRule[] result = new IEncodingRule[0];
            if (originalContext != null)
                result = originalContext.getEncodingRules(theVersion, theEncoding);

            foreach (ISpecificEncodingRule rule in encodingRules)
            {
                // Add the rule if it applies
                bool flag1 = rule.GetVersions().Contains("*") || rule.GetVersions().Contains(theVersion);
                bool flag2 = rule.GetEncodings().Contains("*") || rule.GetEncodings().Contains(theEncoding);
                if (flag1 && flag2)
                {
                    List<IEncodingRule> rules = new List<IEncodingRule>(result);
                    rules.Add(rule);
                    result = rules.ToArray();
                }

            }

            return result;
        }