Ejemplo n.º 1
0
        private static Boolean checkStatus(int ItemCount, Shell32.Folder DestFlder)
        {
            DateTime timeoutDeadline = DateTime.Now.AddMinutes(1);

            for (; ; )
            {
                //Are we past the deadline?
                if (DateTime.Now > timeoutDeadline)
                {
                    break;
                }

                //Check the number of items in the new zip to see if it matches
                //the number of items in the original source location

                //Only check the item count every .25 seconds
                System.Threading.Thread.Sleep(250);

                int ZipFileItemCount = RecurseCount(DestFlder.Items());

                if (ItemCount == ZipFileItemCount)
                {
                    break;
                }
            }
            return true;
        }
Ejemplo n.º 2
0
        private void FillLocalView(Shell32.Folder folder)
        {

            this.Cursor = Cursors.WaitCursor;

            m_currentFolder = folder;
            // Notify that update begins
            LocalView.BeginUpdate();

            // Erase last view items
            LocalView.Items.Clear();

            // Erase previous lists image
            ImgListViewSmall.Images.Clear();
            ImgListViewLarge.Images.Clear();

            int idImage = 0;

            ListViewItem lvItem = new ListViewItem("..");
            lvItem.Tag = folder;

            LocalView.Items.Add(lvItem);

            Shell32.FolderItems items = folder.Items();

            // Folder enumeration
            foreach (Shell32.FolderItem item in items)
            {
                if (item.IsFolder)
                {
                    AddViewItem(item, ref idImage);
                }
            }

            // Other files 
            foreach (Shell32.FolderItem item in items)
            {
                if (!item.IsFolder)
                {
                    
                    AddViewItem(item, ref idImage);
                }
            }

            // End update view
            LocalView.EndUpdate();

            //ftpc.LocalFolder = folder.Title;

            this.Cursor = Cursors.Default;

        }
Ejemplo n.º 3
0
 // Gets each video in the child folders
 private static void DirSearch(Shell32.Folder sDir)
 {
     // Goes through each folder
     foreach (Shell32.FolderItem2 item in sDir.Items())
     {
         // Finds each file in folder
         string type = (string)item.ExtendedProperty("Type");
         if (type.ToLower().Contains("folder"))
         {
             DirSearch(shell.NameSpace(sDir.GetDetailsOf(item, 180)));
         } else
         {
             if (type.ToLower().Contains("mp3"))
             {
                 Songs w = new Songs((string)item.ExtendedProperty("Name"), sDir.GetDetailsOf(item, 21));
                 windowsSongs.Add(w);
                 //Debug.WriteLine("Title: {0}\n Name: {1}\n Ext: {2}\n\n", sDir.GetDetailsOf(item, 21), (string)item.ExtendedProperty("Name"), (string)item.ExtendedProperty("Type"));
             }
         }
     }
 }
Ejemplo n.º 4
0
    public static int AddRootNode(TreeView tree, int imageCount, ImageList imageList, bool getIcons, Shell32.Shell shell32, Shell32.Folder shell32Folder, string rootNodeS)
    {
        Shell32.FolderItems items = shell32Folder.Items();

            tree.Nodes.Clear();
            TreeNode desktop = new TreeNode(rootNodeS, 0, 0);

            // Added in version 1.11
            // add a FolderItem object to the root (Desktop) node tag that corresponds to the DesktopDirectory namespace
            // This ensures that the GetSelectedNodePath will return the actual Desktop folder path when queried.
            // There's possibly a better way to create a Shell32.FolderItem instance for this purpose,
            // but I surely don't know it

            Shell32.Folder dfolder = shell32Folder; //shell32.NameSpace(ShellFolder.DesktopDirectory);
            foreach (Shell32.FolderItem fi in dfolder.ParentFolder.Items())
            {
                if (fi.Name == dfolder.Title)
                {
                    desktop.Tag = fi;
                    break;
                }
            }

            // Add the Desktop root node to the tree
            tree.Nodes.Add(desktop);

            vlozitSLozkuNa = 0;
            // iterate through the Desktop namespace and populate the first level nodes
            foreach (Shell32.FolderItem item in items)
            {

                    TreeNode tn = AddTreeNode(item, ref imageCount, imageList, getIcons);
                    if (item.IsFolder) // this ensures that desktop shortcuts etc are not displayed
                    {
                        desktop.Nodes.Insert(vlozitSLozkuNa, tn);
                        vlozitSLozkuNa++;

                        CheckForSubDirs(tn, imageList);
                        CheckForSubItems(tn, imageCount);
                    }
                    else
                    {
                        desktop.Nodes.Add( tn);
                    }
                //}
            }
            return imageCount;
    }