private void CopyFiles_Menu_Click(object sender, EventArgs e) { if (DragFilesList == null) { return; } string ero = ""; if (item_SeForm.iPathExpand != "") { if (Tools.checkFolderCreation(item_SeForm.iPathExpand)) { FileOperateProxy.CopyFiles(DragFilesList, item_SeForm.iPathExpand, true, true, false, ref ero); } } else { if (Tools.checkFolderCreation(ZIKU.DataBase.Config.Instance.dataFolderExpand)) { System.IO.Directory.CreateDirectory(ZIKU.DataBase.Config.Instance.dataFolderExpand + @"\" + item_SeForm.dataFolderName); FileOperateProxy.CopyFiles(DragFilesList, ZIKU.DataBase.Config.Instance.dataFolderExpand + @"\" + item_SeForm.dataFolderName, true, true, false, ref ero); } } }
private void btnSave_Click(object sender, EventArgs e) { resultInSetRow = 0; // MessageBox.Show("开始上传文件,如果遇到程自动关闭,请关闭360等杀毒,电脑管家再运行..."); if (this.con_ppr_data.Rows.Count <= 0) { return; } resultInSetRow = resultInSetRow + asicsIM.uploadToMysql(this.con_ppr_data); if (this.con_detail_data.Rows.Count <= 0) { return; } resultInSetRow = resultInSetRow + asicsIM.uploadCon_detailToMysql(this.con_detail_data); // string foldName = DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + Dns.GetHostName() + "_ASICS(" + this.files.Count.ToString() + ")"; string foldName = DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + Dns.GetHostName() + "_ASICS(" + this.files.Count.ToString() + ")"; if (!Directory.Exists(srcFolderPath + foldName)) { Directory.CreateDirectory(srcFolderPath + foldName); } /* * // barstr.maxstep = this.files.Count; * for (int i = 0; i < this.files.Count; i++) * { * // barstr.str = "正在复制:" + this.files[i] + "..."; * // barstr.step = i; * // UpdateUIDelegate(barstr); * * string[] fileName = this.files[i].Split('\\'); * string filestr = fileName[fileName.Length - 1]; * string drcPath = srcFolderPath + foldName + @"\" + filestr; * string cc = ""; * FileOperateProxy.CopyFile(this.files[i], drcPath, false, false, false, ref cc); * FileOperateProxy.DeleteFile(this.files[i], false, false, false, ref cc); * } */ barstr.maxstep = this.files.Count; int i = 1; // 移动加载成功的文件 foreach (string file in this.files) { barstr.str = "正在复制:" + file + "..."; barstr.step = i; UpdateUIDelegate(barstr); i++; string[] fileName = file.Split('\\'); string filestr = fileName[fileName.Length - 1]; string drcPath = srcFolderPath + foldName + @"\" + filestr; string cc = ""; string dd = ""; int c = FileOperateProxy.CopyFile(file, drcPath, false, false, false, ref cc); if (c == 0) { // 360会直接把程关闭删除会报错 FileOperateProxy.DeleteFile(file, false, false, false, ref dd); } } MessageBox.Show("保存成功"); }