public void CreateConsoleFolder() { try { var folderName = DialogExtensions.ShowTextInputDialog(this, "Add New Folder", "Folder Name: ", ""); if (folderName != null) { string folderPath = FtpDirectoryPath + "/" + folderName; if (FtpClient.DirectoryExists(folderPath)) { XtraMessageBox.Show($"A folder with this name already exists.", "Error"); return; } else { _ = FtpExtensions.CreateDirectory(folderPath); LoadConsoleDirectory(FtpDirectoryPath); } } } catch (FtpException ex) { DarkMessageBox.ShowError($"Unable to create new folder. Error: {ex.Message}", "Error"); } catch (Exception ex) { DarkMessageBox.ShowError($"Unable to create new folder. Error: {ex.Message}", "Error"); } }
private void RenameLocalFolder() { if (GridViewLocalFiles.SelectedRowsCount > 0) { string oldFolderName = GridViewLocalFiles.GetRowCellValue(GridViewLocalFiles.FocusedRowHandle, "Name").ToString(); string oldFolderPath = TextBoxLocalPath.Text + @"\" + oldFolderName; string newFolderName = StringExtensions.ReplaceInvalidChars(DialogExtensions.ShowTextInputDialog(this, "Rename Folder", "Folder Name:", oldFolderName)); string newFolderPath = TextBoxLocalPath.Text + @"\" + newFolderName; if (newFolderName != null && !newFolderName.Equals(oldFolderName)) { if (!Directory.Exists(newFolderPath)) { SetLocalStatus("A folder with this name already exists."); } else { SetLocalStatus($"Renaming folder to: {newFolderName}"); FileSystem.RenameDirectory(oldFolderPath, newFolderName); SetLocalStatus($"Successfully renamed folder to: {newFolderName}"); LoadLocalDirectory(DirectoryPathLocal); } } } }
public void CreateLocalFolder() { try { var newName = DialogExtensions.ShowTextInputDialog(this, "Add New Folder", "Folder name: ", ""); if (newName != null) { string folderPath = TextBoxLocalPath.Text + @"\" + newName; if (Directory.Exists(folderPath)) { XtraMessageBox.Show($"A folder with this name already exists.", "Error"); return; } else { _ = Directory.CreateDirectory(folderPath); LoadLocalDirectory(LocalDirectoryPath); } } } catch (FtpException ex) { DarkMessageBox.ShowError($"Unable to create new folder. Error: {ex.Message}", "Error"); } catch (Exception ex) { DarkMessageBox.ShowError($"Unable to create new folder. Error: {ex.Message}", "Error"); } }
public void CreateLocalFolder() { try { string newName = DialogExtensions.ShowTextInputDialog(this, "Add New Folder", "Folder name: ", ""); if (newName != null) { string folderPath = TextBoxLocalPath.Text + @"\" + newName; if (Directory.Exists(folderPath)) { XtraMessageBox.Show("A folder with this name already exists.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { SetLocalStatus($"Creating folder: {folderPath}"); Directory.CreateDirectory(folderPath); SetLocalStatus($"Successfully created folder: {folderPath}"); LoadLocalDirectory(DirectoryPathLocal); } } } catch (Exception ex) { SetLocalStatus($"Unable to create a new folder. Error: {ex.Message}"); XtraMessageBox.Show($"Unable to create a new folder. Error: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ContextMenuItemConsoleRenameFolder_Click(object sender, EventArgs e) { try { var oldFolderName = DgvConsoleFiles.CurrentRow.Cells[2].Value.ToString(); var folderPath = TextBoxConsolePath.Text + oldFolderName; var newFolderName = DialogExtensions.ShowTextInputDialog(this, "Rename Folder", "Folder Name:", oldFolderName); var newFolderPath = TextBoxConsolePath.Text + newFolderName; if (newFolderName != null && !newFolderName.Equals(oldFolderName)) { if (FtpClient.DirectoryExists(folderPath)) { SetConsoleStatus($"A folder with this name already exists."); return; } else { SetConsoleStatus($"Renaming folder: {folderPath} to: {newFolderName}"); FtpExtensions.RenameFileOrFolder(FtpConnection, folderPath, newFolderName); SetConsoleStatus($"Successfully renamed folder to: {newFolderName}"); LoadConsoleDirectory(FtpDirectoryPath); } } } catch (Exception ex) { SetConsoleStatus($"Unable to rename folder. Error: {ex.Message}", ex); } }
private void ContextMenuLocalRenameFolder_Click(object sender, EventArgs e) { if (DgvLocalFiles.CurrentRow != null) { var oldFolderName = DgvLocalFiles.CurrentRow.Cells[2].Value.ToString(); var folderPath = TextBoxLocalPath.Text + @"\" + oldFolderName; var newFolderName = DialogExtensions.ShowTextInputDialog(this, "Rename Folder", "Folder Name: ", oldFolderName); var newFolderPath = TextBoxLocalPath.Text + @"\" + newFolderName; if (newFolderName != null && newFolderName.Equals(oldFolderName)) { if (!Directory.Exists(newFolderPath)) { SetLocalStatus($"A folder with this name already exists."); } else { SetConsoleStatus($"Renaming file {folderPath} to: {newFolderName}"); FileSystem.RenameDirectory(folderPath, newFolderName); SetConsoleStatus($"Successfully renamed folder to: {newFolderName}"); LoadLocalDirectory(LocalDirectoryPath); } } } }
private void ToolStripLocalNewFolder_Click(object sender, EventArgs e) { var newName = DialogExtensions.ShowTextInputDialog(this, "Add New Folder", "Folder name: ", ""); if (newName != null) { _ = Directory.CreateDirectory(TextBoxLocalPath.Text + @"\" + newName); LoadLocalDirectory(LocalDirectoryPath); } }
private void ButtonCreateNewList_Click(object sender, EventArgs e) { string listName = DialogExtensions.ShowTextInputDialog(this, "Create New List", "List Name:", ""); if (!string.IsNullOrWhiteSpace(listName)) { if (CustomListNameExists(listName)) { XtraMessageBox.Show("A list with this name already exists.", "List Name Exists"); } else { Settings.AddCustomList(listName); LoadCustomLists(); } } }
private void ButtonRenameList_Click(object sender, EventArgs e) { string currentListName = GridViewCustomLists.GetRowCellDisplayText(GridViewCustomLists.GetSelectedRows()[0], "List Name"); string newListName = DialogExtensions.ShowTextInputDialog(this, "Rename List", "List Name:", currentListName); if (!string.IsNullOrWhiteSpace(newListName)) { if (currentListName != newListName && CustomListNameExists(newListName)) { XtraMessageBox.Show("A list with this name already exists.", "List Name Exists"); } else { Settings.RenameCustomList(currentListName, newListName); LoadCustomLists(); } } }
private void ToolStripConsoleNewFolder_Click(object sender, EventArgs e) { try { var folderName = DialogExtensions.ShowTextInputDialog(this, "Add New Folder", "Folder Name: ", ""); if (folderName != null) { _ = FtpExtensions.CreateDirectory(FtpDirectoryPath + "/" + folderName); LoadConsoleDirectory(FtpDirectoryPath); } } catch (FtpException ex) { _ = DarkMessageBox.Show(this, $"Unable to create new folder. Error: {ex.Message}", "Error", MessageBoxIcon.Error); } catch (Exception ex) { _ = DarkMessageBox.Show(this, $"Unable to create new folder. Error: {ex.Message}", "Error", MessageBoxIcon.Error); } }