public void Go_DowndLoad(object p) { if (Down_list_Selete == null) { return; } if (DownInfo[Down_list_Selete.ID].State == "下载") { return; } DownLoad d = new DownLoad(); string name = DownInfo[Down_list_Selete.ID].filename; Information inf = d.RSerialization(name); if (inf.filename == null) { MessageBox.Show("文件不存在!"); int i = Down_list_Selete.ID; DownInfo.RemoveAt(Down_list_Selete.ID); for (; i < DownInfo.Count; i++) { DownInfo[i].ID = i; } Serialization(@"./config/ImportDownLoadInfo", DownInfo); return; } d.ContinuousDownLoad(inf); DownInfo[Down_list_Selete.ID].ID = Down_d.Count; DownInfo[Down_list_Selete.ID].State = "下载"; Down_d.Add(d); for (int i = 0; i < Down_d.Count; i++) { Down_d[i].Maxseepd = Limit_DownLoad_Speed; Down_d[i].Sum = Down_d.Count; } Task <int> task = _client.DownloadRequestAsync(Down_list_Selete.Hash, d.Port); task.ContinueWith(T => { }); Serialization(@"./config/ImportDownLoadInfo", DownInfo); }
public void Detelet_DownListViewInfo(object p) { if (Down_list_Selete == null) { return; } GarbageInfo.Add(Down_list_Selete); if (Down_list_Selete.State == "下载") { Down_d[Down_list_Selete.ID].Stop_DownLoad = true; Down_d[Down_list_Selete.ID].AllDone.Set(); Down_d.RemoveAt(Down_list_Selete.ID); } int i = Down_list_Selete.ID; DownInfo.RemoveAt(Down_list_Selete.ID); for (; i < DownInfo.Count; i++) { DownInfo[i].ID = i; } Serialization(@"./config/GarbageInfo", GarbageInfo); Serialization(@"./config/ImportDownLoadInfo", DownInfo); }