-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
28710a2
commit 143fdd4
Showing
8 changed files
with
721 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,53 @@ | ||
// | ||
using MinecraftLaunch.Components.Fetcher; | ||
using MinecraftLaunch.Components.Launcher; | ||
using MinecraftLaunch.Components.Launcher; | ||
using MinecraftLaunch.Components.Resolver; | ||
using MinecraftLaunch.Classes.Models.Launch; | ||
using MinecraftLaunch.Components.Authenticator; | ||
using System.IO.Compression; | ||
|
||
var resolver = new GameResolver("C:\\Users\\w\\Desktop\\temp\\.minecraft"); | ||
Launcher launcher = new(resolver, new(new OfflineAuthenticator("Yang114").Authenticate()) { | ||
JvmConfig = new(new JavaFetcher().Fetch().FirstOrDefault().JavaPath) { | ||
//new() { | ||
// "https://download.mcbbs.net/version/1.7.10/client", | ||
// "https://download.mcbbs.net/version/1.12.2/client", | ||
// "https://download.mcbbs.net/version/1.16.5/client", | ||
// "https://download.mcbbs.net/version/1.20.1/client", | ||
// "https://download.mcbbs.net/version/1.20.2/client", | ||
// "https://download.mcbbs.net/version/1.20.3/client", | ||
// "https://download.mcbbs.net/version/1.20.4/client", | ||
//} | ||
|
||
var file = new DownloadFile() { | ||
DownloadPath = "C:\\Users\\w\\Desktop\\temp\\natives", | ||
FileName = "test.jar", | ||
DownloadUri = "https://download.mcbbs.net/version/1.20.4/client", | ||
}; | ||
|
||
file.Changed += (_, x) => { | ||
Console.WriteLine($"{x.ProgressPercentage * 100:0.00} - {x.Speed}"); | ||
}; | ||
|
||
await DownloadHelper.AdvancedDownloadFile(file,DownloadSettings.Default); | ||
|
||
Console.ReadKey(); | ||
return; | ||
var account = new OfflineAuthenticator("Yang114").Authenticate(); | ||
var resolver = new GameResolver(".minecraft"); | ||
|
||
var config = new LaunchConfig { | ||
Account = account, | ||
IsEnableIndependencyCore = true, | ||
JvmConfig = new(@"C:\Program Files\Java\jdk1.8.0_301\bin\javaw.exe") { | ||
MaxMemory = 1024, | ||
} | ||
}); | ||
}; | ||
|
||
Launcher launcher = new(resolver, config); | ||
var gameProcessWatcher = await launcher.LaunchAsync("1.12.2"); | ||
|
||
//获取输出日志 | ||
gameProcessWatcher.OutputLogReceived += (sender, args) => { | ||
Console.WriteLine(args.Text); | ||
}; | ||
|
||
await launcher.LaunchAsync("1.12.2"); | ||
//检测游戏退出 | ||
gameProcessWatcher.Exited += (sender, args) => { | ||
Console.WriteLine("exit"); | ||
}; |
Oops, something went wrong.