//public void upFolder(string webpath, string localpath, ArrayList foldername, UserInformation userinformation, RefreshListViewSuccess refresh, UpYunLibrary.UpYun.SetProgressBar setprogressbar) //{ //} public void upFileByUpYun(string localpath, string webpath, ArrayList filenamelist, UserInformation userinformation, RefreshListViewSuccess refresh, UpYunLibrary.UpYun.SetProgressBar setprogressbar) { int SelectNum = filenamelist.Count; try { for (int i = 0; i < SelectNum; i++) { string localpath_up = localpath + filenamelist[i]; FileStream fs = new FileStream(localpath_up, FileMode.Open, FileAccess.Read); BinaryReader r = new BinaryReader(fs); byte[] postArray = r.ReadBytes((int)fs.Length); string webpath_up = webpath + filenamelist[i]; userinformation.upYun.writeFile(webpath_up, postArray, true, setprogressbar); fs.Close(); } } catch (Exception ex) { refresh(false); XtraMessageBox.Show(ex.ToString(), "错误信息"); } refresh(true); }
public void upFile(string webpath, string localpath, ArrayList filenamelist, UserInformation userinformation, RefreshListViewSuccess refresh, UpYunLibrary.UpYun.SetProgressBar setprogressbar) { Thread thread = new Thread(() => upFileByUpYun(localpath, webpath, filenamelist, userinformation, refresh, setprogressbar)); thread.IsBackground = true; thread.Start(); }