コード例 #1
0
        /// <summary>
        /// Get encoding rules
        /// </summary>
        /// <param name="theVersion">an HL7 version (eg "2.1").</param>
        /// <param name="theEncoding">an encoding name (eg "VB", "XML).</param>
        /// <returns>
        /// the active encoding rules that apply to the given version and encoding.
        /// </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);
        }