Пример #1
0
        private void btnReNameFile2_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtFilePath.Text))
            {
                this.lblInfo.Text = "请选择要重命名的文件";
                return;
            }

            if (string.IsNullOrEmpty(this.txtNewName.Text))
            {
                this.lblInfo.Text = "请输入新的名称";
                return;
            }

            try
            {
                FileOperateProxy.ReNameFile(txtFilePath.Text, txtNewName.Text);

                this.lblInfo.Text = "文件重命名成功";
            }
            catch (Exception ex)
            {
                this.lblInfo.Text = ex.Message.ToString();
            }
        }
Пример #2
0
        private void btnReNameFile_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtFilePath.Text))
            {
                this.lblInfo.Text = "请选择要重命名的文件";
                return;
            }

            if (string.IsNullOrEmpty(this.txtNewName.Text))
            {
                this.lblInfo.Text = "请输入新的名称";
                return;
            }


            string extensName = Path.GetExtension(txtFilePath.Text);
            string filDir     = Path.GetDirectoryName(txtFilePath.Text);

            string newName = filDir + this.txtNewName.Text + extensName;
            int    i       = FileOperateProxy.ReNameFile(txtFilePath.Text, newName, true, ref info);

            if (i != 0)
            {
                this.lblInfo.Text = info;
            }
            else
            {
                this.lblInfo.Text     = "文件重命名成功";
                this.txtFilePath.Text = string.Empty;
                this.txtNewName.Text  = string.Empty;
            }
        }
Пример #3
0
        //复制多个文件
        private void btnCopyFiles_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtCopyFiles.Text))
            {
                this.lblInfo.Text = "请选择要复制的文件";
                return;
            }

            if (string.IsNullOrEmpty(this.txtCopyDesPath.Text))
            {
                this.lblInfo.Text = "请选择目的路径";
                return;
            }
            int i = FileOperateProxy.CopyFiles(copyFiles, txtCopyDesPath.Text, true, true, true, ref info);

            if (i != 0)
            {
                this.lblInfo.Text = info;
            }
            else
            {
                this.lblInfo.Text        = "所有文件复制成功";
                copyFiles                = null;
                this.txtCopyFiles.Text   = string.Empty;
                this.txtCopyDesPath.Text = string.Empty;
            }
        }
Пример #4
0
        //移动多文件
        private void btnMoveFiles_Click(object sender, EventArgs e)
        {
            if (moveFiles == null || moveFiles.Length == 0)
            {
                this.lblInfo.Text = "请选择要移动的文件";
                return;
            }
            if (string.IsNullOrEmpty(this.txtMoveDesPath.Text))
            {
                this.lblInfo.Text = "请选择目的路径";
                return;
            }
            int i = FileOperateProxy.MoveFiles(moveFiles, txtMoveDesPath.Text, true, true, true, ref info);

            if (i != 0)
            {
                this.lblInfo.Text = info;
            }
            else
            {
                this.lblInfo.Text        = "所有文件移动成功";
                moveFiles                = null;
                this.txtMoveFiles.Text   = string.Empty;
                this.txtMoveDesPath.Text = string.Empty;
            }
        }
Пример #5
0
        //删除文件
        private void btnDelFile_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtDelFile.Text))
            {
                this.lblInfo.Text = "请选择要删除的文件";
                return;
            }
            int i = FileOperateProxy.DeleteFile(this.txtDelFile.Text, true, true, true, ref info);

            if (i != 0)
            {
                this.lblInfo.Text = info;
            }
            else
            {
                this.lblInfo.Text    = "文件删除成功";
                this.txtDelFile.Text = string.Empty;
            }
        }
Пример #6
0
        //删除多个文件
        private void btnDelFiles_Click(object sender, EventArgs e)
        {
            if (delFiles == null || delFiles.Length == 0)
            {
                this.lblInfo.Text = "请选择要删除的文件";
                return;
            }
            int i = FileOperateProxy.DeleteFiles(delFiles, true, true, true, ref info);

            if (i != 0)
            {
                this.lblInfo.Text = info;
            }
            else
            {
                this.lblInfo.Text     = "所有文件删除成功";
                delFiles              = null;
                this.txtDelFiles.Text = string.Empty;
            }
        }