Esempio n. 1
0
        private void cmsRemoteMove_Click(object sender, EventArgs e)
        {
            if (lvRemote.SelectedItems.Count == 0)
            {
                return;
            }
            string filename = lvRemote.SelectedItems[0].Text;
            string oldName  = "";

            if (lblRemotePath.Text == "/")
            {
                oldName = tboxServerUrl.Text + lblRemotePath.Text + filename;
            }
            else
            {
                oldName = tboxServerUrl.Text + lblRemotePath.Text + "/" + filename;
            }

            folderExplorer moveFile = new folderExplorer();

            moveFile._formName         = "Переместить файл";
            moveFile._btnName          = "Переместить";
            moveFile._lblText          = "Выберите папку:";
            moveFile._server           = tboxServerUrl.Text;
            moveFile._path             = lblRemotePath.Text;
            moveFile._username         = tboxUserName.Text;
            moveFile._password         = tboxUserPass.Text;
            moveFile._selectedFile     = lvRemote.SelectedItems[0].Text;
            moveFile._selectedFilePath = tboxServerUrl.Text + lblRemotePath;
            moveFile.ShowDialog();

            if (moveFile.DialogResult == DialogResult.OK)
            {
                string newName = moveFile.prop + "/" + lvRemote.SelectedItems[0].Text;
                ftpSet.renameFile(oldName, newName);
            }
        }
Esempio n. 2
0
        private void cmsLocalUpload_Click(object sender, EventArgs e)
        {
            if (lblRemotePath.Text == "Нет подключения")
            {
                MessageBox.Show("Необходимо подключиться к ftp-серверу.");
                return;
            }

            if (this.lvLocal.SelectedItems.Count == 0)
            {
                return;
            }
            folderExplorer upload = new folderExplorer();

            upload._formName         = "Зугрузить файл на сервер";
            upload._btnName          = "Загрузить";
            upload._lblText          = "Выберите папку:";
            upload._server           = tboxServerUrl.Text;
            upload._path             = lblRemotePath.Text;
            upload._username         = tboxUserName.Text;
            upload._password         = tboxUserPass.Text;
            upload._selectedFile     = lvLocal.SelectedItems[0].Text;
            upload._selectedFilePath = tboxServerUrl.Text + lblRemotePath;
            upload.ShowDialog();

            string path = "";

            if (upload.DialogResult == DialogResult.OK)
            {
                if (lvLocal.SelectedItems[0].ImageIndex == (int)directionEntryTypes.file)
                {
                    string filename = lvLocal.SelectedItems[0].Text;
                    if (lblRemotePath.Text == "/")
                    {
                        path = tboxServerUrl.Text + upload.prop;
                        ftpSet.addFileToUploadQueue(lblLocalPath.Text + @"\" + filename, path);
                    }

                    else
                    {
                        path = tboxServerUrl.Text + upload.prop;
                        ftpSet.addFileToUploadQueue(lblLocalPath.Text + @"\" + filename, tboxServerUrl.Text + lblRemotePath.Text + "/" + filename);
                    }

                    ftpSet.startProcessing();
                }
                else if (lvLocal.SelectedItems[0].ImageIndex == (int)directionEntryTypes.directory)
                {
                    string filename = lvLocal.SelectedItems[0].Text;
                    if (lblRemotePath.Text == "/")
                    {
                        path = tboxServerUrl.Text + upload.prop;
                        ftpSet.addFolderToUploadQueue(lblLocalPath.Text + @"\" + filename, tboxServerUrl.Text + lblRemotePath.Text + filename);
                    }
                    else
                    {
                        path = tboxServerUrl.Text + upload.prop;
                        ftpSet.addFolderToUploadQueue(lblLocalPath.Text + @"\" + filename, tboxServerUrl.Text + lblRemotePath.Text + "/" + filename);
                    }

                    ftpSet.startProcessing();
                }
            }
        }