Exemplo n.º 1
0
        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");
            }
        }
Exemplo n.º 2
0
        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);
                    }
                }
            }
        }
Exemplo n.º 3
0
        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");
            }
        }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
0
        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);
            }
        }
Exemplo n.º 6
0
        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);
                    }
                }
            }
        }
Exemplo n.º 7
0
        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);
            }
        }
Exemplo n.º 8
0
        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();
                }
            }
        }
Exemplo n.º 9
0
        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();
                }
            }
        }
Exemplo n.º 10
0
        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);
            }
        }