Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

add aria2c commandline support (extremely dirty fix) #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 23 additions & 13 deletions BaiduPanDownload/Forms/Main.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions BaiduPanDownload/Forms/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,33 @@ private void CopyFilesAddress()
}
}

private void CopyAria2Address()
{
StringBuilder sb = new StringBuilder();
foreach (ListViewItem item in FilelistView.SelectedItems)
{
var info = Fileinfo[item.Text];
if (info.isdir == 1)
{
Console.WriteLine("暂时不支持复制文件夹...");
}
else
{
sb.AppendLine($"aria2c -c -s10 -k1M -x10 --enable-rpc=false \"https://www.baidupcs.com/rest/2.0/pcs/stream?method=download&access_token={Program.config.Access_Token}&path=" + Uri.EscapeDataString($"{info.path}")+ "\"");
}
}
try
{

Clipboard.SetDataObject(sb.ToString());
Console.WriteLine(sb.ToString());
}
catch (Exception ex)
{
MessageBox.Show("访问剪贴板失败! " + ex.Message);
}
}

private void UpdateDownLoadList_Timer_Tick(object sender, EventArgs e)
{
DownloadListView.BeginUpdate();
Expand Down Expand Up @@ -589,5 +616,15 @@ private void 继续ToolStripMenuItem_Click(object sender, EventArgs e)
{
TaskManager.GetTastManager.GetTaskByID(int.Parse(DownloadListView.SelectedItems[0].Text)).Start();
}

private void 导出Aria2c命令ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!Fileinfo.ContainsKey(FilelistView.SelectedItems[0].Text))
{
MessageBox.Show("出现了未知错误! 请刷新重试");
return;
}
CopyAria2Address();
}
}
}
2 changes: 1 addition & 1 deletion BaiduPanDownload/Forms/Main.resx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD0
FQAAAk1TRnQBSQFMAgEBBAEAASABAQEgAQEBUAEAAVABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
FQAAAk1TRnQBSQFMAgEBBAEAASgBAQEoAQEBUAEAAVABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAEBAgABoAMAAQEBAAEIBgAByBgAAYACAAGAAwACgAEAAYADAAGAAQABgAEAAoACAAPAAQABwAHc
AcABAAHwAcoBpgEAATMFAAEzAQABMwEAATMBAAIzAgADFgEAAxwBAAMiAQADKQEAA1UBAANNAQADQgEA
AzkBAAGAAXwB/wEAAlAB/wEAAZMBAAHWAQAB/wHsAcwBAAHGAdYB7wEAAdYC5wEAAZABqQGtAgAB/wEz
Expand Down