示例#1
0
文件: Form2.cs 项目: bzhu3216/FTPtool
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                var intValue = textBox1.GetValue <long>();

                if (textBox1.Text.Length != 11 || comboBox1.Text.Equals(""))
                {
                    textBox1.Focus();
                    textBox1.SelectAll();
                    MessageBox.Show("输入学号格式不正确,或未选择老师!", "学号为11为数字", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    userid   = textBox1.Text;
                    username = textBox2.Text;
                    teacher  = comboBox1.Text;
                    main mf = new main(userid, username, teacher);
                    // Form4 mf = new Form4(userid, username, teacher);
                    GenInfo.deldir(@"c:\downloadFTP");
                    mf.Show();
                    this.Hide();
                }
            }
            catch
            {
            }
        }
示例#2
0
文件: main.cs 项目: bzhu3216/FTPtool
        private void button1_Click(object sender, EventArgs e)
        {
            label1.Text     = "下载实验或试卷中。。。";
            button1.Enabled = false;
            System.DateTime currentTime = DateTime.Now;
            ////////////////////////////////////////////
            try
            {
                bool first;
                first = true;
                if (Directory.Exists(@"c:\downloadFTP"))
                {
                    GenInfo.deldir(@"c:\downloadFTP");
                }

                if (Directory.Exists(@"c:\" + userid + username + "-" + currentTime.ToString("m") + @"上传文件夹"))
                {
                    first = false;
                }
                downloadPaper pa = new downloadPaper();
                pa.downftp("ftp://192.168." + ConfigurationManager.AppSettings["ftpip"].ToString() + teacher + "/download", @"/", @"c:\downloadFTP");
                GenInfo.GenFile(username, userid, Getinfo.GetClientLocalIPv4Address(), Getinfo.GetMacAddress());
                if (first)
                {
                    GenInfo.Copy(@"c:\downloadFTP", @"c:\" + userid + username + "-" + currentTime.ToString("m") + @"上传文件夹");
                }
                ////////////
                string filePath = @"c:\" + userid + currentTime.ToString("m") + @"download";

                if (Directory.Exists(@"c:\downloadFTP"))
                {
                    GenInfo.deldir(@"c:\downloadFTP");
                }

                ///////////

                button2.Enabled = true;
                button3.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "请正确填写和选择信息下载不成功 ");
            }


            //////////////////////////////////////////


            label1.Text = "";
            MessageBox.Show("下载完成");
            // button1.Enabled = false;
        }
示例#3
0
文件: main.cs 项目: bzhu3216/FTPtool
        private void button2_Click(object sender, EventArgs e)
        {
            UploadFileFTP up = new UploadFileFTP();

            System.DateTime currentTime = DateTime.Now;

            if (GenInfo.Checkfile(@"c:\" + userid + username + "-" + currentTime.ToString("m") + @"上传文件夹\", "log.dat"))
            {
                button2.Enabled = false;
                label1.Text     = "上传文件中。。。";

                up.UploadDirectory(@"c:\", "ftp://192.168." + ConfigurationManager.AppSettings["ftpip"] + teacher + @"/upload/", userid + username + "-" + currentTime.ToString("m") + @"上传文件夹");
                MessageBox.Show("上传成功!");
                label1.Text     = "";
                button2.Enabled = true;
            }
            else
            {
                MessageBox.Show("你删除了系统文件,联系老师!");
            }
        }
示例#4
0
文件: Form1.cs 项目: bzhu3216/FTPtool
 private void button2_Click(object sender, EventArgs e)
 {
     GenInfo.GenFile(textBox3.Text, textBox4.Text, textBox2.Text, "");
 }