/// <summary>upload specimen file / example /demo </summary> /// <param name="specimenid"></param> /// <param name="lll"></param> /// <param name="filetablep"></param> /// <param name="choose_number"></param> void uploadSpecimenFile(int specimenid, List <tbFile> lll, string filetablep, int choose_number) { //从slice表中随机找出10张图 List <string> fl = new List <string>(); int[] fr = CTHelper.RandomIntArray(choose_number, 0, lll.Count - 1); for (int i = 0; i < fr.Length; i++) { string url = CTHelper.GetConfig("downloadurl") + "ct/" + filetablep + "/" + lll[fr[i]].f_pid + "/"; string fn = Path.GetFileName(lll[fr[i]].f_path.Trim()); fl.Add(url + fn); } Application.DoEvents(); string ftmpd = CTHelper.CommonPath("app") + "\\" + "d.jpg"; string ftmp = ""; //对每张图进行上传操作 同 Add功能 note(fl.Count); for (int i = 0; i < fr.Length; i++) { notep(); if (File.Exists(ftmpd)) { File.Delete(ftmpd); } CTHelper.DownloadFile(fl[i], ftmpd); //download source image string fn = CTHelper.GetMD5Hash(ftmpd) + ".jpg"; if (File.Exists(ftmpd)) { Bitmap b = CTHelper.CreateDemoImage(ftmpd, 150, 150); ftmp = CTHelper.CommonPath("app") + "\\" + fn; b.Save(ftmp, System.Drawing.Imaging.ImageFormat.Jpeg); if (File.Exists(ftmp)) { cdFileAuthor.Text = "selected from " + filetablep; string r = addFile(ftmp, ftmp, "ctdb-specimen", specimenid); if (r != "") { MessageBox.Show(r); } } } if (File.Exists(ftmpd)) { File.Delete(ftmpd); } if (File.Exists(ftmp)) { File.Delete(ftmp); } } }