コード例 #1
0
ファイル: LimeLib.cs プロジェクト: Starwer/Lime
        /// <summary>
        /// Reserve a PIDL by cloning an existent PIDL and convert it to a path ':1234' format.
        /// </summary>
        /// <param name="pidl">Source PIDL (IntPtr) to be cloned</param>
        /// <returns>A PIDL path in ':1234' format</returns>
        public static string ReservePIDL(IntPtr pidl)
        {
            string ret = null;

            if (pidl != IntPtr.Zero)
            {
                var cpidl = PIDL.ILClone(pidl);
                ret = String.Format(":{0}", cpidl);
                LimeMsg.Debug("LimeLib ReservePIDL: PIDL: {0} --> {1}", pidl, ret);
            }
            return(ret);
        }
コード例 #2
0
        internal static PIDL getParentPIDL(PIDL pidl, out PIDL relPIDL)
        {
            relPIDL = new PIDL(pidl, true); //0.21
            if (pidl.Size == 0)
            {
                return(pidl);
            }
            IntPtr pParent = PIDL.ILClone(pidl.Ptr);

            relPIDL = getRelativePIDL(pidl);
            if (pParent == IntPtr.Zero || !PIDL.ILRemoveLastID2(ref pParent))
            {
                return(DirectoryInfoEx.CSIDLtoPIDL(ShellAPI.CSIDL.DESKTOP));
            }

            return(new PIDL(pParent, false)); //pParent will be freed by the PIDL.
        }