Пример #1
0
        internal static ExchangeBuild GetTextProcessorVersion(TextProcessorType textProcessorType, XElement textProcessorElement)
        {
            if (textProcessorElement == null)
            {
                throw new ArgumentNullException("textProcessorElement");
            }
            ExAssert.RetailAssert(TextProcessorType.Function <= textProcessorType && textProcessorType <= TextProcessorType.Fingerprint, "The specified textProcessorType '{0}' is out-of-range", new object[]
            {
                textProcessorType.ToString()
            });
            ExchangeBuild result = ClassificationDefinitionConstants.DefaultVersion;

            if (ClassificationDefinitionConstants.TextProcessorTypeToVersions.ContainsKey(textProcessorType))
            {
                result = ClassificationDefinitionConstants.TextProcessorTypeToVersions[textProcessorType];
            }
            else if (textProcessorType == TextProcessorType.Function)
            {
                string value = textProcessorElement.Attribute("id").Value;
                ExAssert.RetailAssert(value != null, "The functionName in the specfied textProcessorElement is null", new object[]
                {
                    textProcessorElement.ToString()
                });
                if (ClassificationDefinitionConstants.FunctionNameToVersions.ContainsKey(value))
                {
                    result = ClassificationDefinitionConstants.FunctionNameToVersions[value];
                }
            }
            return(result);
        }
Пример #2
0
        internal TextProcessorGrouping(IGrouping <TextProcessorType, KeyValuePair <string, ExchangeBuild> > textProcessorGrouping, IEqualityComparer <string> textProcessorIdsComparer = null)
        {
            if (textProcessorGrouping == null)
            {
                throw new ArgumentNullException("textProcessorGrouping");
            }
            TextProcessorType key = textProcessorGrouping.Key;

            ExAssert.RetailAssert(TextProcessorType.Function <= key && key <= TextProcessorType.Fingerprint, "The specified textProcessorType '{0}' is out-of-range", new object[]
            {
                key.ToString()
            });
            this.textProcessorType = key;
            this.textProcessors    = textProcessorGrouping.ToDictionary((KeyValuePair <string, ExchangeBuild> textProcessor) => textProcessor.Key, (KeyValuePair <string, ExchangeBuild> textProcessor) => textProcessor.Value, textProcessorIdsComparer ?? ClassificationDefinitionConstants.TextProcessorIdComparer);
        }