Example #1
0
        void Button1Click(object sender, EventArgs e)
        {
            if (this.treeView1.SelectedNode == null)
            {
                MessageBox.Show("请选择FTP目录");
                return;
            }
            string newpath = this.treeView1.SelectedNode.FullPath.Replace('\\', '/');

            CreateNameForm cn = new CreateNameForm();

            cn.StartPosition = FormStartPosition.CenterParent;
            if (cn.ShowDialog() == DialogResult.OK)
            {
                newpath = newpath + "/" + cn.name;
                if (this.MakeDirectory(newpath))
                {
                    TreeNode tn = new TreeNode();
                    tn.Text = cn.name;
                    this.treeView1.SelectedNode.Nodes.Add(tn);
                    MessageBox.Show("创建文件夹成功!");
                }
                else
                {
                    MessageBox.Show("创建文件夹失败!");
                }
            }
            else
            {
                return;
            }
        }
Example #2
0
        //新建
        void Button3Click(object sender, EventArgs e)
        {
            string temp    = this.treeView1.SelectedNode.FullPath.Replace('\\', '/');
            string newpath = System.Text.RegularExpressions.Regex.Replace(
                temp, "服务器根目录", ftphost);
            CreateNameForm cn = new CreateNameForm();

            cn.StartPosition = FormStartPosition.CenterParent;
            if (cn.ShowDialog() == DialogResult.OK)
            {
                newpath = newpath + "/" + cn.name;
                if (this.MakeDirectory(newpath))
                {
                    TreeNode tn = new TreeNode();
                    tn.Text = cn.name;
                    this.treeView1.SelectedNode.Nodes.Add(tn);
                    MessageBox.Show("创建文件夹成功!");
                }
                else
                {
                    MessageBox.Show("创建文件夹失败!");
                }
            }
            else
            {
                return;
            }
        }