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; }
private void button2_Click(object sender, EventArgs e) { GenInfo.GenFile(textBox3.Text, textBox4.Text, textBox2.Text, ""); }