private void DoDirectoryCopy( ListViewItem item ) { FileBrowserNode node = base.TreeNode as FileBrowserNode; // Determine destingation to copy to SelectDestinationDialog destinationDialog = new SelectDestinationDialog(node.Path, SelectDestinationDialog.SELECT_DESTINATION_OPERATION.COPY_DIRECTORY, plugin); if (destinationDialog.ShowDialog() == DialogResult.OK) { WinError error = FileClient.FileClient.CopyDirectory(node.Path, destinationDialog.GetPath(), item.Text, item.Text, true); if (error == WinError.ERROR_FILE_EXISTS || error == WinError.ERROR_ALREADY_EXISTS) { error = FileClient.FileClient.CopyDirectory(node.Path, destinationDialog.GetPath(), item.Text, "Copy of " + item.Text, true); } if (error == WinError.NO_ERROR) { Refresh(); } else { string message = "Copy directory operation failed. Error: " + error.ToString(); MessageBox.Show(message, "Could not copy directory", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void DoFileCopy( ListViewItem item ) { FileBrowserNode node = base.TreeNode as FileBrowserNode; string destination = ""; // Determine destingation to copy to SelectDestinationDialog destinationDialog = new SelectDestinationDialog(node.Path, SelectDestinationDialog.SELECT_DESTINATION_OPERATION.COPY_FILE, plugin); if (destinationDialog.ShowDialog() == DialogResult.OK) { destination = destinationDialog.GetPath() + PathSeparator + item.Text; string path = node.Path + PathSeparator + item.Text; WinError error = FileClient.FileClient.CopyFile(path, destination, true); if (error == WinError.ERROR_FILE_EXISTS) { destination = destinationDialog.GetPath() + PathSeparator + "Copy of " + item.Text; error = FileClient.FileClient.CopyFile(path, destination, true); } if (error == WinError.NO_ERROR) { Refresh(); } else { string message = "Copy file operation failed. Error: " + error.ToString(); MessageBox.Show(message, "Could not copy file", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void DoFileMove( ListViewItem item ) { FileBrowserNode node = base.TreeNode as FileBrowserNode; string destination = ""; // Determine destingation to move to SelectDestinationDialog destinationDialog = new SelectDestinationDialog(node.Path, SelectDestinationDialog.SELECT_DESTINATION_OPERATION.MOVE_FILE, plugin); if (destinationDialog.ShowDialog() == DialogResult.OK) { destination = destinationDialog.GetPath() + PathSeparator + item.Text; string path = node.Path + PathSeparator + item.Text; WinError error = FileClient.FileClient.MoveFile(path, destination); if (error == WinError.NO_ERROR) { lvFilePage.BeginUpdate(); lvFilePage.Items.Remove(item); lvFilePage.EndUpdate(); Refresh(); } else { string message = "Move file operation failed. Error: " + error.ToString(); MessageBox.Show(message, "Could not move file", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void DoDirectoryMove( ListViewItem item ) { FileBrowserNode node = base.TreeNode as FileBrowserNode; // Determine destingation to move to SelectDestinationDialog destinationDialog = new SelectDestinationDialog(node.Path, SelectDestinationDialog.SELECT_DESTINATION_OPERATION.MOVE_DIRECTORY, plugin); if (destinationDialog.ShowDialog() == DialogResult.OK) { string path = node.Path + PathSeparator + item.Text; WinError error = FileClient.FileClient.MoveDirectory(node.Path, destinationDialog.GetPath(), item.Text, item.Text, true); if (error == WinError.ERROR_FILE_EXISTS || error == WinError.ERROR_ALREADY_EXISTS) { error = FileClient.FileClient.MoveDirectory(node.Path, destinationDialog.GetPath(), item.Text, "Copy of " + item.Text, true); } if (error == WinError.NO_ERROR) { TreeNode[] removedItem = node.Nodes.Find(item.Text, false); if (removedItem.Length > 0) { removedItem[0].Remove(); } lvFilePage.BeginUpdate(); lvFilePage.Items.Remove(item); lvFilePage.EndUpdate(); Refresh(); } else { string message = "Move directory operation failed. Error: " + error.ToString(); MessageBox.Show(message, "Could not move directory", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void cm_OnMove(object sender, EventArgs e) { if (_currentNode != null && _selectedNode != null && _currentNode == _selectedNode) { FileBrowserNode node = _currentNode as FileBrowserNode; FileBrowserNode parent = _currentNode.Parent as FileBrowserNode; // Determine destingation to copy to SelectDestinationDialog destinationDialog = new SelectDestinationDialog(node.Path, SelectDestinationDialog.SELECT_DESTINATION_OPERATION.MOVE_DIRECTORY, this); if (destinationDialog.ShowDialog() == DialogResult.OK) { WinError error = FileClient.FileClient.MoveDirectory(parent.Path, destinationDialog.GetPath(), node.Name, node.Name, true); if (error == WinError.ERROR_FILE_EXISTS || error == WinError.ERROR_ALREADY_EXISTS) { error = FileClient.FileClient.MoveDirectory(parent.Path, destinationDialog.GetPath(), node.Name, "Copy of " + node.Name, true); } if (error != WinError.NO_ERROR) { string message = "Move directory operation failed. Error: " + error.ToString(); MessageBox.Show(message, "Could not move directory", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { _currentNode.Remove(); } } } }
private void DoDirectoryMove( ListViewItem item ) { FileBrowserNode node = base.TreeNode as FileBrowserNode; // Determine destingation to move to SelectDestinationDialog destinationDialog = new SelectDestinationDialog(node.Path, SelectDestinationDialog.SELECT_DESTINATION_OPERATION.MOVE_DIRECTORY, plugin); if (destinationDialog.ShowDialog() == DialogResult.OK) { string path = node.Path + PathSeparator + item.Text; WinError error = FileClient.FileClient.MoveDirectory(node.Path, destinationDialog.GetPath(), item.Text, item.Text, true); if (error == WinError.ERROR_FILE_EXISTS || error == WinError.ERROR_ALREADY_EXISTS) { error = FileClient.FileClient.MoveDirectory(node.Path, destinationDialog.GetPath(), item.Text, "Copy of " + item.Text, true); } if (error == WinError.NO_ERROR) { TreeNode[] removedItem = node.Nodes.Find(item.Text, false); if (removedItem.Length > 0) removedItem[0].Remove(); lvFilePage.BeginUpdate(); lvFilePage.Items.Remove(item); lvFilePage.EndUpdate(); Refresh(); } else { string message = "Move directory operation failed. Error: " + error.ToString(); MessageBox.Show(message, "Could not move directory", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }