private void LoadRoot()
        {
            ShellItem        desktop = new ShellItem();
            List <ShellItem> subDirs;

            root                    = new TreeNode(desktop.Text);
            root.ImageIndex         = imageList.GetIconIndex(desktop, false);
            root.SelectedImageIndex = imageList.GetIconIndex(desktop, true);
            root.Tag                = desktop;
            subDirs                 = desktop.GetFolders(true);
            foreach (ShellItem sh in subDirs)
            {
                root.Nodes.Add(MakeNode(sh));
            }
            Nodes.Clear();
            Nodes.Add(root);
            root.Expand();
        }
Esempio n. 2
0
        private void LoadListViewDetails()
        {
            DateTime empty = new DateTime(1, 1, 1, 0, 0, 0);

            foreach (ListViewItem lvi in Items)
            {
                ShellItem item = (ShellItem)lvi.Tag;
                if (!item.IsFolder && item.IsFileSystem)
                {
                    if (item.Length > 1024)
                    {
                        lvi.SubItems.Add(String.Format("{0:#,###} KB", item.Length >> 10));
                    }
                    else
                    {
                        lvi.SubItems.Add(String.Format("{0:##0}  B", item.Length));
                    }
                }
                else
                {
                    lvi.SubItems.Add("");
                }
                lvi.SubItems.Add(item.Type);
                if (item.IsDisk)
                {
                    lvi.SubItems.Add("");
                }
                else
                if (item.LastWriteTime == empty)
                {
                    lvi.SubItems.Add("");
                }
                else
                {
                    lvi.SubItems.Add(
                        item.LastWriteTime.ToShortDateString() +
                        " " +
                        item.LastWriteTime.ToShortTimeString());
                }
                lvi.ImageIndex = imageList.GetIconIndex(item, false);
            }
            mre.Set();
        }