Skip to content

Commit

Permalink
Update Downloader
Browse files Browse the repository at this point in the history
  • Loading branch information
JWJUN233233 committed Feb 17, 2024
1 parent 7230ed5 commit 5a49209
Show file tree
Hide file tree
Showing 4 changed files with 494 additions and 8 deletions.
7 changes: 4 additions & 3 deletions MinecraftLaunch.Test/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
MirrorDownloadManager.IsUseMirrorDownloadSource = true;

var account = new OfflineAuthenticator("Yang114").Authenticate();
var resolver = new GameResolver("C:\\Users\\w\\Desktop\\总整包\\MC\\mc启动器\\LauncherX\\.minecraft");
Directory.CreateDirectory(".minecraft");
var resolver = new GameResolver(".minecraft");

var installer = new VanlliaInstaller(resolver, "1.19.4", MirrorDownloadManager.Bmcl);
var installer = new VanlliaInstaller(resolver, "1.12.2");
installer.ProgressChanged += (_, args) => {
Console.WriteLine($"{args.ProgressStatus} - {args.Progress * 100:0.00}%");
};
Expand All @@ -26,7 +27,7 @@
var config = new LaunchConfig {
Account = account,
IsEnableIndependencyCore = true,
JvmConfig = new(@"C:\Program Files\Java\jdk1.8.0_301\bin\javaw.exe") {
JvmConfig = new(@"C:\Program Files\Java\jdk-17\bin\javaw.exe") {
MaxMemory = 1024,
}
};
Expand Down
17 changes: 14 additions & 3 deletions MinecraftLaunch/Classes/Interfaces/IDownloader.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
namespace MinecraftLaunch.Classes.Interfaces;
using MinecraftLaunch.Classes.Models.Download;
using MinecraftLaunch.Classes.Models.Event;

public interface IDownloader {
ValueTask<bool> DownloadAsync();
namespace MinecraftLaunch.Classes.Interfaces
{
public interface IDownloader
{
event Action<bool> Completed;
event EventHandler<DownloadProgressChangedEventArgs> ProgressChanged;

void Cancel();
ValueTask<bool> DownloadAsync();
void Retry();
void Setup(IEnumerable<DownloadRequest> downloadItems);
}
}
Loading

0 comments on commit 5a49209

Please sign in to comment.