public m3u8Download(m3u8File m, int id, bool automerge, m3u8DownloadCallBack cb) { m3u8 = m; callBack = cb; status = 0; this.id = id; this.automerge = automerge; }
private void btnSelectDownload_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0)//小于等于0 为没有选中任何行 { m3u8DownloadCallBack cb = new m3u8DownloadCallBack(OnSelectDownloadDataReceived); int t = dataGridView1.SelectedRows[0].Index;// 获取当前行的 行号 m3u8Download download = new m3u8Download((m3u8File)(dt.Rows[t][5]), t, chkMerge.Checked, cb); download.start(); } else { MessageBox.Show("请选择一行!"); } }
private void btnDownloadAll_Click(object sender, EventArgs e) { DownloadParamterInit(); DownloadAllDataReceived = new m3u8DownloadCallBack(OnDownloadAllDataReceived);; if (dataGridView1.Rows.Count > 0)//小于等于0 为没有任何行 { for (int i = 0; i < dataGridView1.Rows.Count; i++) { finishList.Add(Aria2Download.Status.NoStart); } int t = 0; for (int i = 0; i < MAX_DOWNLOAD_COUNT && i < dataGridView1.Rows.Count; i++) { m3u8Download download = new m3u8Download((m3u8File)(dt.Rows[t][5]), t, chkMerge.Checked, DownloadAllDataReceived); finishList[t] = Aria2Download.Status.Running; download.start(); t++; } } else { MessageBox.Show("内容为空!"); } }