public bool DeleteFolderOrFile(ListView.SelectedListViewItemCollection selectedItems, string parentPath) { StringBuilder pathSb = new StringBuilder(); foreach (ListViewItem item in selectedItems) { pathSb.Append(Path.Combine(parentPath, item.Text) + "\0"); } int retVal = SysFileOrDirActionUtil.DeleteFileOrDirectory(pathSb); if (retVal == 0) { SFULogger.DEFAULT.InfoFormat("删除文件/文件夹成功.retVal=[{0}],pathSb=[{1}]", retVal, pathSb.ToString().Replace("\0", ";")); return(true); } else if (retVal == 1223) { SFULogger.DEFAULT.InfoFormat("操作没有进行.retVal=[{0}],pathSb=[{1}]", retVal, pathSb.ToString().Replace("\0", ";")); return(true); } else { SFULogger.DEFAULT.ErrorFormat("删除文件/文件夹失败.retVal=[{0}],pathSb=[{1}]", retVal, pathSb.ToString().Replace("\0", ";")); return(false); } }
private void menuItemProperty4Local_Click(object sender, EventArgs e) { Point listViewPoint = listView4Local.PointToClient(tempPoint); ListViewItem listViewItem = listView4Local.GetItemAt(listViewPoint.X, listViewPoint.Y); string path = Path.Combine(localPath, listViewItem.Text); SysFileOrDirActionUtil.PropertyFileOrDirectory(path); }
public bool CopyFileOrFolder(StringBuilder sourcePath, string targetPath) { int retVal = SysFileOrDirActionUtil.CopyFileOrDirectory(sourcePath, targetPath); if (retVal == 0) { SFULogger.DEFAULT.InfoFormat("复制文件成功.retVal=[{0}],sourcePath=[{1}],targetPath=[{2}]", retVal, sourcePath.ToString(), targetPath); return(true); } else if (retVal == 1223) { SFULogger.DEFAULT.InfoFormat("操作没有进行.retVal=[{0}],sourcePath=[{1}],targetPath=[{2}]", retVal, sourcePath.ToString(), targetPath); return(true); } else { SFULogger.DEFAULT.ErrorFormat("复制文件失败.retVal=[{0}],sourcePath=[{1}],targetPath=[{2}]", retVal, sourcePath.ToString(), targetPath); return(false); } }