Exemple #1
0
        /// <summary>
        /// Creates a leaf condition node that represents a comparison of property value and Integer value.
        /// Overload method takes a DateTime parameter for the comparison value.
        /// </summary>
        /// <param name="propertyKey">The property to be compared.</param>
        /// <param name="value">The Integer value against which the property value should be compared.</param>
        /// <param name="operation">Specific condition to be used when comparing the actual value and the expected value of the given property</param>
        /// <returns>SearchCondition based on the given parameters</returns>
        /// <remarks>
        /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find
        /// the properties that are indexed, look for the specific property's property description and
        /// <see cref="P:Ssz.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.TypeFlags"/> property for IsQueryable flag.
        /// </remarks>
        public static SearchCondition CreateLeafCondition(PropertyKey propertyKey, int value, SearchConditionOperation operation)
        {
            string canonicalName;

            PropertySystemNativeMethods.PSGetNameFromPropertyKey(ref propertyKey, out canonicalName);

            if (string.IsNullOrEmpty(canonicalName))
            {
                throw new ArgumentException(LocalizedMessages.SearchConditionFactoryInvalidProperty, "propertyKey");
            }
            return(CreateLeafCondition(canonicalName, value, operation));
        }
Exemple #2
0
        /// <summary>
        /// Creates a leaf condition node that represents a comparison of property value and Integer value.
        /// Overload method takes a DateTime parameter for the comparison value.
        /// </summary>
        /// <param name="propertyKey">The property to be compared.</param>
        /// <param name="value">The Integer value against which the property value should be compared.</param>
        /// <param name="operation">Specific condition to be used when comparing the actual value and the expected value of the given property</param>
        /// <returns>SearchCondition based on the given parameters</returns>
        /// <remarks>
        /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find
        /// the properties that are indexed, look for the specific property's property description and
        /// <see cref="P:Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.TypeFlags"/> property for IsQueryable flag.
        /// </remarks>
        public static SearchCondition CreateLeafCondition(PropertyKey propertyKey, int value, SearchConditionOperation operation)
        {
            string canonicalName;

            PropertySystemNativeMethods.PSGetNameFromPropertyKey(ref propertyKey, out canonicalName);

            if (!string.IsNullOrEmpty(canonicalName))
            {
                return(CreateLeafCondition(canonicalName, value, operation));
            }
            else
            {
                throw new ArgumentException("Given property key is invalid", "propertyKey");
            }
        }
Exemple #3
0
        public static SearchCondition CreateLeafCondition(ShellPropertyKey propertyKey, DateTime value,
                                                          SearchConditionOperation operation)
        {
            Contract.Requires <ArgumentNullException>(propertyKey != null);

            string canonicalName;
            var    key = propertyKey.PropertyKeyNative;

            PropertySystemNativeMethods.PSGetNameFromPropertyKey(ref key, out canonicalName);
            if (string.IsNullOrEmpty(canonicalName))
            {
                throw new ArgumentException(ErrorMessages.SearchConditionFactoryInvalidProperty, nameof(propertyKey));
            }

            return(CreateLeafCondition(canonicalName, value, operation));
        }