6 changed files
Shell | ||
_Plugin Interfaces | ||
IListItemEx.cs | ||
FileNameComboBox.cs | ||
ShellItem.cs | ||
ShellTreeViewEx.cs | ||
ShellViewEx.cs | ||
SyncQueue.cs | ||
IListItemEx.cs
/Shell/_Plugin Interfaces/IListItemEx.cs-5+4/Shell/_Plugin Interfaces/IListItemEx.cs
Add comment 130 /// </summary>
Add comment 131 /// <param name="isEnumHidden">Should we include the hidden items?</param>
Add comment 132 /// <returns></returns>
Add comment 133 Minus IListItemEx[] GetSubItems(Boolean isEnumHidden); //TODO: Use or Delete
Add comment 133 Plus IListItemEx[] GetSubItems(Boolean isEnumHidden);
Add comment 134
Add comment 135 IShellFolder GetIShellFolder();
Add comment 136
Add comment 141 /// <summary>Returns drive information</summary>
Add comment 142 DriveInfo GetDriveInfo();
Add comment 143
Add comment 144 Minus Boolean IsRCWSet { get; set; } //TODO: Use or Delete
Add comment 144 Plus Boolean IsRCWSet { get; set; }
Add comment 145
Add comment 146 Minus Int32 RCWThread { get; set; } //TODO: Use or Delete
Add comment 146 Plus Int32 RCWThread { get; set; }
Add comment 147
Add comment 148 HResult ExtractAndDrawThumbnail(IntPtr hdc, uint iconSize, out WTS_CACHEFLAGS flags, User32.RECT iconBounds, out bool retrieved, bool isHidden, bool isRefresh = false); //TODO: Use or Delete
Add comment 149
Add comment 151
Add comment 152 IntPtr GetHBitmap(int iconSize, bool isThumbnail, bool isForce = false);
Add comment 153
Add comment 154 Minus Boolean RefreshThumb(int iconSize, out WTS_CACHEFLAGS flags); //TODO: Use or Delete
Add comment 154 Plus Boolean RefreshThumb(int iconSize, out WTS_CACHEFLAGS flags);
Add comment 155
Add comment 156 String GetDisplayName(SIGDN type);
Add comment 157
Add comment 160 int GetSystemImageListIndex(IntPtr pidl, ShellIconType type, ShellIconFlags flags);
Add comment 161
Add comment 162 int GetUniqueID();
Add comment 163 Minus //Work On This and the TODOList
Add comment 164 163
Add comment 165 164 }
Add comment 166 165 }
Add comment 125 }
Add comment 126 }
Add comment 127
Add comment 128 Minus void AutoComplete()
Add comment 128 Plus private void AutoComplete()
Add comment 129 {
Add comment 130 string path;
Add comment 131 string pattern;
Add comment 163 }
Add comment 164 }
Add comment 165
Add comment 166 Minus bool Open(string path)
Add comment 166 Plus private bool Open(string path)
Add comment 167 {
Add comment 168 Minus //TODO: Someone clean this!
Add comment 168 Plus //TODO: Find out if we can replace [result] with a returns
Add comment 169 bool result = false;
Add comment 170
Add comment 171 if (File.Exists(path))
Add comment 183 }
Add comment 184 else
Add comment 185 {
Add comment 186 Minus //OpenParentOf(path);
Add comment 187 186 Text = Path.GetFileName(path);
Add comment 188 187 }
Add comment 189 188
Add comment 541
Add comment 542
Add comment 543 public PropVariant GetPropertyValue(PROPERTYKEY pkey) {
Add comment 544 Minus //TODO: Remove Parameter Type
Add comment 545 544 var pvar = new PropVariant();
Add comment 546 545 var isi2 = (IShellItem2)ComInterface;
Add comment 547 546 isi2.GetProperty(ref pkey, pvar);
Add comment 804 803 /// <returns>Equality result.</returns>
Add comment 805 804 public override bool Equals(object obj) => this.Equals(obj as ShellItem);
Add comment 806 805
Add comment 807 Minus
Add comment 808 806 #endregion Comparisons
Add comment 809 807
Add comment 810 808 #region Static Stuff
Add comment 836 834 }
Add comment 837 835
Add comment 838 836 private static IShellItem CreateItemFromIDList(IntPtr pidl) {
Add comment 839 Minus //TODO: Consider moving the Try Finally to here
Add comment 840 Minus if (RunningVista)
Add comment 841 Minus return Shell32.SHCreateItemFromIDList(pidl, typeof(IShellItem).GUID);
Add comment 842 Minus else
Add comment 843 Minus return new Interop.VistaBridge.ShellItemImpl(pidl, false);
Add comment 837 Plus return RunningVista ? Shell32.SHCreateItemFromIDList(pidl, typeof(IShellItem).GUID) : new Interop.VistaBridge.ShellItemImpl(pidl, false);
Add comment 844 838 }
Add comment 845 839
Add comment 846 840 private static IShellItem CreateItemFromParsingName(string path) {
Add comment 1067 1061 }
Add comment 1068 1062 else
Add comment 1069 1063 return new ShellItem(path);
Add comment 1070 Minus } //TODO: Consider making this a constructor!
Add comment 1064 Plus }
Add comment 1071 1065
Add comment 1072 1066 /// <summary>
Add comment 1073 1067 /// Tries to create a new <see cref="ShellItem"/> using Path/Uri (As String)
Add comment 484 if (childItem != null) {
Add comment 485 var nodeHandle = childItem.Handle;
Add comment 486
Add comment 487 Minus //TODO: Try to remove this Try Catch! It's slowing this down!!
Add comment 488 487 try {
Add comment 489 488 var sho = (node.Tag as IListItemEx);
Add comment 490 489 if (!sho.HasSubFolders) User32.SendMessage(treeHandle, MSG.TVM_DELETEITEM, 0, nodeHandle);
Add comment 762 761 }
Add comment 763 762
Add comment 764 763 private void ShellTreeView_ItemDrag(object sender, ItemDragEventArgs e) {
Add comment 764 Plus //TODO: Finish code or remove
Add comment 765 IntPtr dataObjPtr = IntPtr.Zero;
Add comment 766 var shellItem = ((e.Item as TreeNode).Tag as IListItemEx);
Add comment 767 if (shellItem != null) {
Add comment 768 Minus //TODO: Fix the dead code here
Add comment 769 768 //System.Runtime.InteropServices.ComTypes.IDataObject dataObject = shellItem.GetIDataObject(out dataObjPtr);
Add comment 770 769
Add comment 771 770 //uint ef = 0;
Add comment 691 this.EndLabelEdit(true);
Add comment 692 else if (e == Keys.F2) {
Add comment 693 //TODO: implement a conditional selection inside rename textbox!
Add comment 694 Plus
Add comment 694 695 } else if (e == Keys.Enter)
Add comment 695 696 this.EndLabelEdit();
Add comment 696 697 }
Add comment 697 Minus if ((Control.ModifierKeys & Keys.Control) == Keys.Control &&
Add comment 698 Minus !(System.Windows.Input.Keyboard.FocusedElement is System.Windows.Controls.TextBox)) {
Add comment 698 Plus if ((Control.ModifierKeys & Keys.Control) == Keys.Control && !(System.Windows.Input.Keyboard.FocusedElement is System.Windows.Controls.TextBox)) {
Add comment 699 switch (e) {
Add comment 700 case Keys.A:
Add comment 701 SelectAll();
Add comment 1854
Add comment 1855 #endregion Case
Add comment 1856
Add comment 1857 Minus case WNM.LVN_GROUPINFO: //TODO: Deal with this useless code
Add comment 1858 1857
Add comment 1859 Minus #region Case
Add comment 1860 Minus
Add comment 1861 Minus //RedrawWindow();
Add comment 1858 Plus case WNM.LVN_GROUPINFO:
Add comment 1862 1859 break;
Add comment 1863 1860
Add comment 1864 Minus #endregion Case
Add comment 1865 Minus
Add comment 1866 1861 case WNM.LVN_HOTTRACK:
Add comment 1867 1862
Add comment 1868 1863 #region Case
Add comment 2778 2773 }
Add comment 2779 2774 } else if (col.CollumnType == typeof(Int64)) {
Add comment 2780 2775 var j = reversed ? 7 : 0;
Add comment 2781 Minus //TODO: Upgrade next to use an Action<>
Add comment 2782 2776
Add comment 2783 2777 var uspec = new ListViewGroupEx();
Add comment 2784 2778 uspec.Items = this.Items.Where(w => w.IsFolder).ToArray();
Add comment 2787 2781 this.Groups.Add(uspec);
Add comment 2788 2782
Add comment 2789 2783 var testgrn = new ListViewGroupEx();
Add comment 2790 Minus testgrn.Items =
Add comment 2791 Minus this.Items.Where(w => Convert.ToInt64(w.GetPropertyValue(col.pkey, typeof(Int64)).Value) == 0 && !w.IsFolder)
Add comment 2792 Minus .ToArray();
Add comment 2784 Plus testgrn.Items =this.Items.Where(w => Convert.ToInt64(w.GetPropertyValue(col.pkey, typeof(Int64)).Value) == 0 && !w.IsFolder).ToArray();
Add comment 2793 2785 testgrn.Header = $"Empty ({testgrn.Items.Count()})";
Add comment 2794 2786 testgrn.Index = reversed ? j-- : j++;
Add comment 2795 2787 this.Groups.Add(testgrn);
Add comment 2796 2788
Add comment 2797 2789 var testgr = new ListViewGroupEx();
Add comment 2798 Minus testgr.Items =
Add comment 2799 Minus this.Items.Where(
Add comment 2790 Plus testgr.Items = this.Items.Where(
Add comment 2800 2791 w =>
Add comment 2801 2792 Convert.ToInt64(w.GetPropertyValue(col.pkey, typeof(Int64)).Value) > 0 &&
Add comment 2802 2793 Convert.ToInt64(w.GetPropertyValue(col.pkey, typeof(Int64)).Value) <= 10 * 1024).ToArray();
Add comment 2805 2796 this.Groups.Add(testgr);
Add comment 2806 2797
Add comment 2807 2798 var testgr2 = new ListViewGroupEx();
Add comment 2808 Minus testgr2.Items =
Add comment 2809 Minus this.Items.Where(
Add comment 2799 Plus testgr2.Items = this.Items.Where(
Add comment 2810 2800 w =>
Add comment 2811 2801 Convert.ToInt64(w.GetPropertyValue(col.pkey, typeof(Int64)).Value) > 10 * 1024 &&
Add comment 2812 2802 Convert.ToInt64(w.GetPropertyValue(col.pkey, typeof(Int64)).Value) <= 100 * 1024).ToArray();
Add comment 2825 2815 this.Groups.Add(testgr3);
Add comment 2826 2816
Add comment 2827 2817 var testgr4 = new ListViewGroupEx();
Add comment 2828 Minus testgr4.Items =
Add comment 2829 Minus this.Items.Where(
Add comment 2818 Plus testgr4.Items = this.Items.Where(
Add comment 2830 2819 w =>
Add comment 2831 2820 Convert.ToInt64(w.GetPropertyValue(col.pkey, typeof(Int64)).Value) > 1 * 1024 * 1024 &&
Add comment 2832 2821 Convert.ToInt64(w.GetPropertyValue(col.pkey, typeof(Int64)).Value) <= 16 * 1024 * 1024).ToArray();
Add comment 2845 2834 this.Groups.Add(testgr5);
Add comment 2846 2835
Add comment 2847 2836 var testgr6 = new ListViewGroupEx();
Add comment 2848 Minus testgr6.Items =
Add comment 2849 Minus this.Items.Where(w => Convert.ToInt64(w.GetPropertyValue(col.pkey, typeof(Int64)).Value) > 128 * 1024 * 1024)
Add comment 2837 Plus testgr6.Items = this.Items.Where(w => Convert.ToInt64(w.GetPropertyValue(col.pkey, typeof(Int64)).Value) > 128 * 1024 * 1024)
Add comment 2850 2838 .ToArray();
Add comment 2851 2839 testgr6.Header = $"Gigantic ({testgr6.Items.Count()})";
Add comment 2852 2840 testgr6.Index = reversed ? j-- : j++;
Add comment 24 /// Adds an object to the end of the System.Collections.Generic.Queue[T] then runs System.Threading.Monitor.PulseAll(queue) when queue.Count == 1;
Add comment 25 /// </summary>
Add comment 26 /// <param name="item">The object to add to the System.Collections.Generic.Queue[T]. The value can be null for reference types.</param>
Add comment 27 Plus /// <param name="force">Force the item to update even if it has queue already contains it</param>
Add comment 27 28 public void Enqueue(T item, Boolean force = false) {
Add comment 28 29 lock (queue) {
Add comment 29 Minus //Task.Run(() => {
Add comment 30 Minus
Add comment 31 30 if (force || !queue.Contains(item)) {
Add comment 32 31 queue.Enqueue(item);
Add comment 33 32
Add comment 36 35 System.Threading.Monitor.PulseAll(queue);
Add comment 37 36 }
Add comment 38 37 }
Add comment 39 Minus // });
Add comment 40 38 }
Add comment 41 39
Add comment 42 40 }
Add comment 64 62
Add comment 65 63 public class QueueEx<T> {
Add comment 66 64 public readonly Queue<T> queue = new Queue<T>();
Add comment 67 Minus
Add comment 68 65 public void Clear() => this.queue.Clear();
Add comment 69 66 public int Count() => this.queue.Count;
Add comment 70 67
Add comment 77 74 /// Adds an object to the end of the System.Collections.Generic.Queue[T] then runs System.Threading.Monitor.PulseAll(queue) when queue.Count == 1;
Add comment 78 75 /// </summary>
Add comment 79 76 /// <param name="item">The object to add to the System.Collections.Generic.Queue[T]. The value can be null for reference types.</param>
Add comment 77 Plus /// <param name="force">Force the item to update even if it has queue already contains it</param>
Add comment 80 78 public Boolean Enqueue(T item, Boolean force = false) {
Add comment 81 79 if (!queue.Contains(item) || force) {
Add comment 82 80 queue.Enqueue(item);
Add comment 95 93 /// <Exceptions>
Add comment 96 94 /// System.InvalidOperationException: The System.Collections.Generic.Queue(Of T) is empty.
Add comment 97 95 /// </Exceptions>
Add comment 98 Minus public T Dequeue() {
Add comment 99 Minus return queue.Dequeue();
Add comment 100 Minus }
Add comment 96 Plus public T Dequeue() => queue.Dequeue();
Add comment 101 97 }
Add comment 102 98
Add comment 103 99 public class ConQueue<T> {