Skip to content

Commit

Permalink
chore: async方法命名统一以Async结尾
Browse files Browse the repository at this point in the history
  • Loading branch information
gnattu committed Oct 25, 2023
1 parent b8d1925 commit e78cd2a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions BBDown/BBDownApiServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void SetUpServer()
return Results.BadRequest("输入有误");
}
var req = bindingResult.Result;
AddDownloadTask(req);
AddDownloadTaskAsync(req);
return Results.Ok();
});
var finishedRemovalApi = app.MapGroup("remove-finished");
Expand Down Expand Up @@ -85,7 +85,7 @@ public void Run(string url)
app.Run(url);
}

private async Task AddDownloadTask(MyOption option)
private async Task AddDownloadTaskAsync(MyOption option)
{
var aid = await BBDownUtil.GetAvIdAsync(option.Url);
if (runningTasks.Any(task => task.Aid == aid)) return;
Expand All @@ -94,11 +94,11 @@ private async Task AddDownloadTask(MyOption option)
try
{
var (encodingPriority, dfnPriority, firstEncoding, downloadDanmaku, input, savePathFormat, lang, aidOri, delay) = Program.SetUpWork(option);
var (fetchedAid, vInfo, apiType) = await Program.GetVideoInfo(option, aidOri, input);
var (fetchedAid, vInfo, apiType) = await Program.GetVideoInfoAsync(option, aidOri, input);
task.Title = vInfo.Title;
task.Pic = vInfo.Pic;
task.VideoPubTime = vInfo.PubTime;
await Program.DownloadPage(option, vInfo, encodingPriority, dfnPriority, firstEncoding, downloadDanmaku,
await Program.DownloadPageAsync(option, vInfo, encodingPriority, dfnPriority, firstEncoding, downloadDanmaku,
input, savePathFormat, lang, fetchedAid, delay, apiType, task);
task.IsSuccessful = true;
}
Expand Down
8 changes: 4 additions & 4 deletions BBDown/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public static (Dictionary<string, byte>? encodingPriority, Dictionary<string, in
return (encodingPriority, dfnPriority, firstEncoding, downloadDanmaku, input, savePathFormat, lang, aidOri, delay);
}

public static async Task<(string fetchedAid, VInfo vInfo, string apiType)> GetVideoInfo(MyOption myOption, string aidOri, string input)
public static async Task<(string fetchedAid, VInfo vInfo, string apiType)> GetVideoInfoAsync(MyOption myOption, string aidOri, string input)
{
//加载认证信息
LoadCredentials(myOption);
Expand Down Expand Up @@ -274,7 +274,7 @@ public static (Dictionary<string, byte>? encodingPriority, Dictionary<string, in
return (aidOri, vInfo, apiType);
}

public static async Task DownloadPage(MyOption myOption, VInfo vInfo, Dictionary<string, byte>? encodingPriority, Dictionary<string, int>? dfnPriority,
public static async Task DownloadPageAsync(MyOption myOption, VInfo vInfo, Dictionary<string, byte>? encodingPriority, Dictionary<string, int>? dfnPriority,
string? firstEncoding, bool downloadDanmaku, string input, string savePathFormat, string lang, string aidOri, int delay, string apiType, DownloadTask? relatedTask = null)
{
string title = vInfo.Title;
Expand Down Expand Up @@ -717,8 +717,8 @@ private static async Task DoWorkAsync(MyOption myOption)
{
var (encodingPriority, dfnPriority, firstEncoding, downloadDanmaku,
input, savePathFormat, lang, aidOri, delay) = SetUpWork(myOption);
var (fetchedAid, vInfo, apiType) = await GetVideoInfo(myOption, aidOri, input);
await DownloadPage(myOption, vInfo, encodingPriority, dfnPriority, firstEncoding, downloadDanmaku,
var (fetchedAid, vInfo, apiType) = await GetVideoInfoAsync(myOption, aidOri, input);
await DownloadPageAsync(myOption, vInfo, encodingPriority, dfnPriority, firstEncoding, downloadDanmaku,
input, savePathFormat, lang, fetchedAid, delay, apiType);
}
catch (Exception e)
Expand Down

0 comments on commit e78cd2a

Please sign in to comment.