void uploadfile() { OpenFileDialog ofd = new OpenFileDialog(); ofd.Multiselect = true; ofd.Filter = PCPath.FilterAllFiles; ofd.InitialDirectory = PCPath.Mycomputer; DialogResult result = ofd.ShowDialog(); if (result != DialogResult.OK | result != DialogResult.Yes) { return; } List <IItemNode> items = new List <IItemNode>(); IItemNode root = ItemNode.GetNodeFromDiskPath(System.IO.Path.GetDirectoryName(ofd.FileNames[0])); foreach (string s in ofd.SafeFileNames) { IItemNode n = new ItemNode(); n.Info.Name = s; root.AddChild(n); FileInfo info = new FileInfo(n.GetFullPathString()); n.Info.Size = info.Length; n.Info.DateMod = info.LastWriteTime; items.Add(n); } Setting_UI.reflection_eventtocore.ExplorerAndManagerFile.TransferItems(items, root, managerehistory_itemnodes.NodeWorking(), false); }
private void OpenItemLV() { if (LV_item.SelectedItems.Count != 1) { return; } ItemNode find = FindNodeLV(LV_item.SelectedItems[0]); if (find != null) { if (find.Info.Size > 0) //file { if (find.GetRoot.RootType.Type != CloudType.LocalDisk) //cloud { MessageBox.Show("Not support now.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); } else//disk { System.Diagnostics.Process.Start(find.GetFullPathString()); } } else//folder { managerhistory_itemnodes.Next(find); ExplorerCurrentNode(); } } }
public static bool Delete(ItemNode node, bool PernamentDelete) { string path = node.GetFullPathString(); if (PernamentDelete)//delete { FileInfo info = new FileInfo(path); if (info.Exists) { info.Delete(); return(true); } else { DirectoryInfo dinfo = new DirectoryInfo(path); if (dinfo.Exists) { dinfo.Delete(true); return(true); } } return(false); } else//trash { return(FileOperationAPIWrapper.SendRecycleBin(path)); } }