Esempio n. 1
0
        private void cmnFtpDownloadFile_Click(object sender, EventArgs e)
        {
            if (this.lvFtpFiles.SelectedItems.Count != 1)
            {
                return;
            }

            FileDirectoryInfo fdi = this.lvFtpFiles.SelectedItems[0].Tag as FileDirectoryInfo;

            if (fdi == null)
            {
                return;
            }

            if (fdi.Type != "Файл")
            {
                MessageBox.Show("Выберете файл", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else if (this._currentPath == "Компьютер")
            {
                MessageBox.Show("Выберете путь для скачивания", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            this.DownloadFileFromFtp(fdi.Name);
        }
Esempio n. 2
0
        private void cmnFtpRename_Click(object sender, EventArgs e)
        {
            if (this.lvFtpFiles.SelectedItems.Count != 1)
            {
                return;
            }

            FileDirectoryInfo fdi = this.lvFtpFiles.SelectedItems[0].Tag as FileDirectoryInfo;

            if (fdi == null)
            {
                return;
            }

            NameForm nameForm = new NameForm(fdi.Name);

            if (nameForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (fdi.Name == nameForm.FileName)
                {
                    return;
                }
                this.FtpRename(fdi.Name, nameForm.FileName, fdi.Type == "Файл");
            }
        }
Esempio n. 3
0
        private void lvFtpFiles_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            ListView lv = sender as ListView;

            if (lv == null)
            {
                return;
            }

            if (lv.SelectedItems.Count != 1)
            {
                return;
            }

            ListViewItem      currentItem = lv.SelectedItems[0];
            FileDirectoryInfo fdi         = currentItem.Tag as FileDirectoryInfo;

            if (fdi == null)
            {
                return;
            }

            if (fdi.Type == "Каталог")
            {
                this._ftpPath      += "/" + fdi.Name;
                this.sbFtpPath.Text = this._ftpPath;
                this.GetFilesFromFTPServer(this._ftpPath);
                this.UpdateFtpFilesList();
            }
        }
Esempio n. 4
0
        private void cmnFtpDeleteDirectory_Click(object sender, EventArgs e)
        {
            if (this.lvFtpFiles.SelectedItems.Count != 1)
            {
                return;
            }

            FileDirectoryInfo fdi = this.lvFtpFiles.SelectedItems[0].Tag as FileDirectoryInfo;

            if (fdi == null)
            {
                return;
            }

            string method = (fdi.Type == "Каталог") ? WebRequestMethods.Ftp.RemoveDirectory : WebRequestMethods.Ftp.DeleteFile;

            this.FtpOperations(fdi.Name, method);
        }