示例#1
0
        private static string GetMatchConditionForLikeOperator(string propertyName, object propertyValue)
        {
            bool            flag            = false;
            string          str             = (string)LanguagePrimitives.ConvertTo(propertyValue, typeof(string), CultureInfo.InvariantCulture);
            WildcardPattern wildcardPattern = new WildcardPattern(str, WildcardOptions.IgnoreCase);
            string          wqlLikeOperand  = CimQuery.WildcardToWqlLikeOperand(wildcardPattern, out flag);

            object[] objArray = new object[2];
            objArray[0] = propertyName;
            objArray[1] = wqlLikeOperand;
            string str1 = string.Format(CultureInfo.InvariantCulture, "({0} LIKE {1})", objArray);

            return(str1);
        }
示例#2
0
        private static string GetMatchConditionForLikeOperator(string propertyName, object propertyValue)
        {
            var expectedPropertyValueAsString             = (string)LanguagePrimitives.ConvertTo(propertyValue, typeof(string), CultureInfo.InvariantCulture);
            var expectedPropertyValueAsPowerShellWildcard = WildcardPattern.Get(expectedPropertyValueAsString, WildcardOptions.IgnoreCase);

            bool needsClientSideFiltering; // not used because for simplicity all results go through post-filtering
            var  expectedPropertyValueAsWqlWildcard = CimQuery.WildcardToWqlLikeOperand(expectedPropertyValueAsPowerShellWildcard, out needsClientSideFiltering);

            string condition = string.Format(
                CultureInfo.InvariantCulture,
                "({0} LIKE {1})",
                propertyName,
                expectedPropertyValueAsWqlWildcard);

            return(condition);
        }