Skip to content

Commit

Permalink
Update GeneralClientBootstrap.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
JusterZhu committed Oct 1, 2024
1 parent 371aa96 commit 4e44f0b
Showing 1 changed file with 13 additions and 31 deletions.
44 changes: 13 additions & 31 deletions src/c#/GeneralUpdate.ClientCore/GeneralClientBootstrap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ public override async Task<GeneralClientBootstrap> LaunchAsync()
ExecuteCustomOptions();
await InitializeData();
var manager = new DownloadManager(Packet.InstallPath, Packet.Format, 30);
foreach (var versionInfo in Packet.UpdateVersions) manager.Add(new DownloadTask(manager, versionInfo));
foreach (var versionInfo in Packet.UpdateVersions)
manager.Add(new DownloadTask(manager, versionInfo));

await manager.LaunchTasksAsync();
return this;
}
Expand Down Expand Up @@ -139,38 +141,26 @@ public GeneralClientBootstrap AddCustomOption(List<Func<bool>> funcs)

public GeneralClientBootstrap AddListenerMultiAllDownloadCompleted(
Action<object, MultiAllDownloadCompletedEventArgs> callbackAction)
{
return AddListener(callbackAction);
}
=> AddListener(callbackAction);

public GeneralClientBootstrap AddListenerMultiDownloadProgress(
Action<object, MultiDownloadProgressChangedEventArgs> callbackAction)
{
return AddListener(callbackAction);
}
=> AddListener(callbackAction);

public GeneralClientBootstrap AddListenerMultiDownloadCompleted(
Action<object, MultiDownloadCompletedEventArgs> callbackAction)
{
return AddListener(callbackAction);
}
=> AddListener(callbackAction);

public GeneralClientBootstrap AddListenerMultiDownloadError(
Action<object, MultiDownloadErrorEventArgs> callbackAction)
{
return AddListener(callbackAction);
}
=> AddListener(callbackAction);

public GeneralClientBootstrap AddListenerMultiDownloadStatistics(
Action<object, MultiDownloadStatisticsEventArgs> callbackAction)
{
return AddListener(callbackAction);
}
=> AddListener(callbackAction);

public GeneralClientBootstrap AddListenerException(Action<object, ExceptionEventArgs> callbackAction)
{
return AddListener(callbackAction);
}
=> AddListener(callbackAction);

#endregion Public Methods

Expand Down Expand Up @@ -308,24 +298,16 @@ private GeneralClientBootstrap AddListener<TArgs>(Action<object, TArgs> callback
}

private void OnMultiDownloadStatistics(object sender, MultiDownloadStatisticsEventArgs e)
{
EventManager.Instance.Dispatch(sender, e);
}
=> EventManager.Instance.Dispatch(sender, e);

private void OnMultiDownloadProgressChanged(object sender, MultiDownloadProgressChangedEventArgs e)
{
EventManager.Instance.Dispatch(sender, e);
}
=> EventManager.Instance.Dispatch(sender, e);

private void OnMultiDownloadCompleted(object sender, MultiDownloadCompletedEventArgs e)
{
EventManager.Instance.Dispatch(sender, e);
}
=> EventManager.Instance.Dispatch(sender, e);

private void OnMultiDownloadError(object sender, MultiDownloadErrorEventArgs e)
{
EventManager.Instance.Dispatch(sender, e);
}
=> EventManager.Instance.Dispatch(sender, e);

private void OnMultiAllDownloadCompleted(object sender, MultiAllDownloadCompletedEventArgs e)
{
Expand Down

0 comments on commit 4e44f0b

Please sign in to comment.