internal static void HandleRenaming(ListViewWrapper lvw, IntPtr pIDL, Control ctrl) { if(pIDL != IntPtr.Zero) { StringBuilder pszPath = new StringBuilder(260); if(PInvoke.SHGetPathFromIDList(pIDL, pszPath) && (pszPath.Length > 0)) { string path = pszPath.ToString(); if(!Directory.Exists(path)) { if(File.Exists(path)) { string extension = Path.GetExtension(path); if(!string.IsNullOrEmpty(extension) && (extension.Equals(".lnk", StringComparison.OrdinalIgnoreCase) || extension.Equals(".url", StringComparison.OrdinalIgnoreCase))) { return; } } IntPtr hWnd = lvw.GetEditControl(); if(hWnd != IntPtr.Zero) { IntPtr lParam = Marshal.AllocHGlobal(520); if(0 < ((int)PInvoke.SendMessage(hWnd, WM.GETTEXT, (IntPtr)260, lParam))) { string str3 = Marshal.PtrToStringUni(lParam); if(str3.Length > 2) { int num = str3.LastIndexOf("."); if(num > 0) { new WaitTimeoutCallback(QTTabBarClass.WaitTimeout).BeginInvoke(0x4b, new AsyncCallback(QTTabBarClass.AsyncComplete_ItemEdit), new object[] { hWnd, num, ctrl }); } } } Marshal.FreeHGlobal(lParam); } } } } }
internal static void HandleF2(ListViewWrapper listViewWrapper) { IntPtr hWnd = listViewWrapper.GetEditControl(); if(hWnd != IntPtr.Zero) { IntPtr lParam = Marshal.AllocHGlobal(520); if(0 < ((int)PInvoke.SendMessage(hWnd, 13, (IntPtr)260, lParam))) { string str = Marshal.PtrToStringUni(lParam); if(str.Length > 2) { int num = str.LastIndexOf("."); if(num != -1) { IntPtr ptr3 = PInvoke.SendMessage(hWnd, 0xb0, IntPtr.Zero, IntPtr.Zero); int num2 = QTUtility2.GET_X_LPARAM(ptr3); int length = QTUtility2.GET_Y_LPARAM(ptr3); if((length - num2) >= 0) { if((num2 == 0) && (length == num)) { num2 = length = num; } else if((num2 == length) && (length == num)) { num2 = num + 1; length = str.Length; } else if((num2 == (num + 1)) && (length == str.Length)) { num2 = 0; length = -1; } else if((num2 == 0) && (length == str.Length)) { num2 = 0; length = 0; } else { num2 = 0; length = num; } PInvoke.SendMessage(hWnd, 0xb1, (IntPtr)num2, (IntPtr)length); } } } } Marshal.FreeHGlobal(lParam); } }