internal SearchCondition(ICondition nativeSearchCondition)
        {
            if (nativeSearchCondition == null)
            {
                throw new ArgumentNullException("nativeSearchCondition");
            }

            NativeSearchCondition = nativeSearchCondition;

            HResult hr = NativeSearchCondition.GetConditionType(out conditionType);

            if (!CoreErrorHelper.Succeeded(hr))
            {
                throw new ShellException(hr);
            }

            if (ConditionType == SearchConditionType.Leaf)
            {
                using (PropVariant propVar = new PropVariant())
                {
                    hr = NativeSearchCondition.GetComparisonInfo(out canonicalName, out conditionOperation, propVar);

                    if (!CoreErrorHelper.Succeeded(hr))
                    {
                        throw new ShellException(hr);
                    }

                    PropertyValue = propVar.Value.ToString();
                }
            }
        }
Esempio n. 2
0
        internal SearchCondition(ICondition nativeSearchCondition)
        {
            if (nativeSearchCondition == null)
            {
                throw new ArgumentNullException("nativeSearchCondition");
            }

            NativeSearchCondition = nativeSearchCondition;

            HResult hr = NativeSearchCondition.GetConditionType(out conditionType);

            if (!CoreErrorHelper.Succeeded(hr))
            {
                throw new ShellException(hr);
            }

            if (ConditionType == SearchConditionType.Leaf)
            {
                using (PropVariant propVar = new PropVariant())
                {
                    hr = NativeSearchCondition.GetComparisonInfo(out canonicalName, out conditionOperation, propVar);

                    if (!CoreErrorHelper.Succeeded(hr))
                    {
                        throw new ShellException(hr);
                    }

                    PropertyValue = propVar.Value.ToString();
                }
            }
        }
Esempio n. 3
0
        internal SearchCondition(ICondition nativeSearchCondition)
        {
            if (nativeSearchCondition == null)
                throw new ArgumentNullException("nativeSearchCondition");

            NativeSearchCondition = nativeSearchCondition;

            HRESULT hr = NativeSearchCondition.GetConditionType(out conditionType);

            if (!CoreErrorHelper.Succeeded((int)hr))
                Marshal.ThrowExceptionForHR((int)hr);

            if (ConditionType == SearchConditionType.Leaf)
            {
                PropVariant propVar;
                hr = NativeSearchCondition.GetComparisonInfo(out canonicalName, out conditionOperation, out propVar);

                if (!CoreErrorHelper.Succeeded((int)hr))
                    Marshal.ThrowExceptionForHR((int)hr);

                try
                {
                    propertyValue = propVar.Value.ToString();
                }
                finally
                {
                    propVar.Clear();
                }

            }
        }
        internal SearchCondition(ICondition nativeSearchCondition)
        {
            if (nativeSearchCondition == null)
            {
                throw new ArgumentNullException("nativeSearchCondition");
            }

            NativeSearchCondition = nativeSearchCondition;

            HResult hr = NativeSearchCondition.GetConditionType(out conditionType);

            if (hr != HResult.S_OK)
            {
                return;
            }

            if (ConditionType == SearchConditionType.Leaf)
            {
                using (var propVar = new PropVariant())
                {
                    hr = NativeSearchCondition.GetComparisonInfo(out canonicalName, out conditionOperation, propVar);

                    if (hr != HResult.S_OK)
                    {
                        return;
                    }

                    PropertyValue = propVar.Value.ToString();
                }
            }
        }
Esempio n. 5
0
        internal SearchCondition(ICondition nativeSearchCondition)
        {
            if (nativeSearchCondition == null) throw new ArgumentNullException("nativeSearchCondition");

            NativeSearchCondition = nativeSearchCondition;

            HResult hr = NativeSearchCondition.GetConditionType(out conditionType);

            if (hr != HResult.S_OK) return;

            if (ConditionType == SearchConditionType.Leaf)
            {
                using (var propVar = new PropVariant())
                {
                    hr = NativeSearchCondition.GetComparisonInfo(out canonicalName, out conditionOperation, propVar);

                    if (hr != HResult.S_OK) return;

                    PropertyValue = propVar.Value.ToString();
                }
            }
        }
        internal SearchCondition(ICondition nativeSearchCondition)
        {
            if (nativeSearchCondition == null)
            {
                throw new ArgumentNullException("nativeSearchCondition");
            }

            NativeSearchCondition = nativeSearchCondition;

            HRESULT hr = NativeSearchCondition.GetConditionType(out conditionType);

            if (!CoreErrorHelper.Succeeded((int)hr))
            {
                Marshal.ThrowExceptionForHR((int)hr);
            }

            if (ConditionType == SearchConditionType.Leaf)
            {
                PropVariant propVar;
                hr = NativeSearchCondition.GetComparisonInfo(out canonicalName, out conditionOperation, out propVar);

                if (!CoreErrorHelper.Succeeded((int)hr))
                {
                    Marshal.ThrowExceptionForHR((int)hr);
                }

                try
                {
                    propertyValue = propVar.Value.ToString();
                }
                finally
                {
                    propVar.Clear();
                }
            }
        }