コード例 #1
0
ファイル: ShellObject.cs プロジェクト: X10sions/X10sions
        /// <summary>
        /// Determines if two ShellObjects are identical.
        /// </summary>
        /// <param name="other">The ShellObject to comare this one to.</param>
        /// <returns>True if the ShellObjects are equal, false otherwise.</returns>
        public bool Equals(ShellObject other)
        {
            bool areEqual = false;

            if (other != null)
            {
                IShellItem ifirst  = NativeShellItem;
                IShellItem isecond = other.NativeShellItem;
                if (ifirst != null && isecond != null)
                {
                    HResult hr = ifirst.Compare(
                        isecond, SICHINTF.SICHINT_ALLFIELDS, out var result);

                    areEqual = (hr == HResult.Ok) && (result == 0);
                }
            }

            return(areEqual);
        }
コード例 #2
0
        /// <summary>
        /// Determines whether two <see cref="ShellItem"/>s refer to
        /// the same shell folder.
        /// </summary>
        ///
        /// <param name="obj">
        /// The item to compare.
        /// </param>
        ///
        /// <returns>
        /// <see langword="true"/> if the two objects refer to the same
        /// folder, <see langword="false"/> otherwise.
        /// </returns>
        /// <summary>
        /// Determines if two ShellObjects are identical.
        /// </summary>
        /// <param name="other">The ShellObject to comare this one to.</param>
        /// <returns>True if the ShellObjects are equal, false otherwise.</returns>
        public bool Equals(ShellItem other)
        {
            bool areEqual = false;

            if (other != null)
            {
                IShellItem ifirst  = this.m_ComInterface;
                IShellItem isecond = other.m_ComInterface;
                if (ifirst != null && isecond != null)
                {
                    int result = ifirst.Compare(
                        isecond, SICHINT.ALLFIELDS);

                    areEqual = (result == 0);
                }
            }

            return(areEqual);
        }
コード例 #3
0
        private static bool ListContainsShellObject(List <JumpList._ShellObjectPair> removedList, object shellObject)
        {
            if (removedList.Count == 0)
            {
                return(false);
            }
            IShellItem shellItem = shellObject as IShellItem;

            if (shellItem != null)
            {
                foreach (JumpList._ShellObjectPair current in removedList)
                {
                    IShellItem shellItem2 = current.ShellObject as IShellItem;
                    if (shellItem2 != null && shellItem.Compare(shellItem2, (SICHINT)805306368u) == 0)
                    {
                        bool result = true;
                        return(result);
                    }
                }
                return(false);
            }
            IShellLinkW shellLinkW = shellObject as IShellLinkW;

            if (shellLinkW != null)
            {
                foreach (JumpList._ShellObjectPair current2 in removedList)
                {
                    IShellLinkW shellLinkW2 = current2.ShellObject as IShellLinkW;
                    if (shellLinkW2 != null)
                    {
                        string a = JumpList.ShellLinkToString(shellLinkW2);
                        string b = JumpList.ShellLinkToString(shellLinkW);
                        if (a == b)
                        {
                            bool result = true;
                            return(result);
                        }
                    }
                }
                return(false);
            }
            return(false);
        }
コード例 #4
0
        private static bool ListContainsShellObject(List <JumpList._ShellObjectPair> removedList, object shellObject)
        {
            if (removedList.Count == 0)
            {
                return(false);
            }
            IShellItem shellItem = shellObject as IShellItem;

            if (shellItem != null)
            {
                foreach (JumpList._ShellObjectPair shellObjectPair in removedList)
                {
                    IShellItem shellItem2 = shellObjectPair.ShellObject as IShellItem;
                    if (shellItem2 != null && shellItem.Compare(shellItem2, SICHINT.CANONICAL | SICHINT.TEST_FILESYSPATH_IF_NOT_EQUAL) == 0)
                    {
                        return(true);
                    }
                }
                return(false);
            }
            IShellLinkW shellLinkW = shellObject as IShellLinkW;

            if (shellLinkW != null)
            {
                foreach (JumpList._ShellObjectPair shellObjectPair2 in removedList)
                {
                    IShellLinkW shellLinkW2 = shellObjectPair2.ShellObject as IShellLinkW;
                    if (shellLinkW2 != null)
                    {
                        string a = JumpList.ShellLinkToString(shellLinkW2);
                        string b = JumpList.ShellLinkToString(shellLinkW);
                        if (a == b)
                        {
                            return(true);
                        }
                    }
                }
                return(false);
            }
            return(false);
        }
コード例 #5
0
ファイル: ShellObject.cs プロジェクト: ewin66/taskbartimer
        /// <summary>
        /// Determines if two ShellObjects are identical.
        /// </summary>
        /// <param name="other">The ShellObject to comare this one to.</param>
        /// <returns>True if the ShellObjects are equal, false otherwise.</returns>
        public bool Equals(ShellObject other)
        {
            bool areEqual = false;

            if ((object)other != null)
            {
                IShellItem ifirst  = this.NativeShellItem;
                IShellItem isecond = other.NativeShellItem;
                if (((ifirst != null) && (isecond != null)))
                {
                    int     result = 0;
                    HRESULT hr     = ifirst.Compare(
                        isecond, SICHINTF.SICHINT_ALLFIELDS, out result);

                    if ((hr == HRESULT.S_OK) && (result == 0))
                    {
                        areEqual = true;
                    }
                }
            }

            return(areEqual);
        }