Esempio n. 1
0
 private void Visit(FileSystem.NodeVisitCallback callback, FileSystemNode node)
 {
     if (!callback(node, 0, 1))
     {
         return;
     }
     if (node is Folder && !(node is HiddenDataStreamFileNTFS))                //No zip support yet
     {
         foreach (FileSystemNode child in node.GetChildren())
         {
             Visit(callback, child);
         }
     }
 }
Esempio n. 2
0
        private void ShowContextMenu(TreeNodeMouseClickEventArgs e)
        {
            FileSystemNode fsnode = e.Node.Tag as FileSystemNode;

            if (fsnode != null)
            {
                ContextMenu menu = new ContextMenu();
                if (fsnode is Folder)
                {
                    Folder f = fsnode as Folder;
                    menu.MenuItems.Add(new MenuItem("Refresh", new EventHandler(delegate(object o, EventArgs ea) {
                        fsnode.ReloadChildren();
                        AppendChildren(e.Node, fsnode.GetChildren());
                    })));
                    menu.MenuItems.Add(new MenuItem("Save Folder...", new EventHandler(delegate(object o, EventArgs ea) {
                        SaveFileDialog saveFileDialog  = new SaveFileDialog();
                        saveFileDialog.Filter          = "Any Files|*.*";
                        saveFileDialog.Title           = "Select a Location";
                        saveFileDialog.FileName        = f.Name;
                        saveFileDialog.OverwritePrompt = true;

                        if (saveFileDialog.ShowDialog() == DialogResult.OK)
                        {
                            SaveFolder(f, saveFileDialog.FileName);
                        }
                    })));
                }
                if (fsnode is File)
                {
                    File f = fsnode as File;
                    menu.MenuItems.Add(new MenuItem("Save File...", new EventHandler(delegate(object o, EventArgs ea) {
                        SaveFileDialog saveFileDialog  = new SaveFileDialog();
                        saveFileDialog.Filter          = "Any Files|*.*";
                        saveFileDialog.Title           = "Select a Location";
                        saveFileDialog.FileName        = f.Name;
                        saveFileDialog.OverwritePrompt = true;

                        if (saveFileDialog.ShowDialog() == DialogResult.OK)
                        {
                            SaveFile(f, saveFileDialog.FileName);
                        }
                    })));
                }
                menu.Show(e.Node.TreeView, e.Location);
            }
        }
		private void Visit(FileSystem.NodeVisitCallback callback, FileSystemNode node) {
			if (!callback(node, 0, 1)) {
				return;
			}
			if (node is Folder && !(node is HiddenDataStreamFileNTFS)) {  //No zip support yet
				foreach (FileSystemNode child in node.GetChildren()) {
					Visit(callback, child);
				}
			}
		}