diff --git a/MinecraftLaunch.Test/MinecraftLaunch.Test.csproj b/MinecraftLaunch.Test/MinecraftLaunch.Simple.csproj similarity index 100% rename from MinecraftLaunch.Test/MinecraftLaunch.Test.csproj rename to MinecraftLaunch.Test/MinecraftLaunch.Simple.csproj diff --git a/MinecraftLaunch.Test/Program.cs b/MinecraftLaunch.Test/Program.cs index c23aad4..41a676c 100644 --- a/MinecraftLaunch.Test/Program.cs +++ b/MinecraftLaunch.Test/Program.cs @@ -1,36 +1,14 @@ -using MinecraftLaunch; +// +using MinecraftLaunch.Components.Authenticator; using MinecraftLaunch.Components.Fetcher; -using MinecraftLaunch.Components.Installer; +using MinecraftLaunch.Components.Launcher; using MinecraftLaunch.Components.Resolver; -using MinecraftLaunch.Extensions; -string gameFolder = "C:\\Users\\w\\Desktop\\temp\\.minecraft"; -foreach (var item in new GameResolver(gameFolder).GetGameEntitys().ToList()) -{ - Console.WriteLine(item.JavaVersion); -}; -var installer = new VanlliaInstaller(new GameResolver(gameFolder), "1.16.5", MirrorDownloadManager.Mcbbs); -return; -installer.ProgressChanged += (_, x) => { - Console.Clear(); - Console.SetCursorPosition(0, 0); - Console.WriteLine($"{x.Status} - {x.ProgressStatus} - {x.Progress.ToPercentage(0.0d, 0.65d) * 100:F2}%"); - Console.SetCursorPosition(0, 0); -}; - -var result = await installer.InstallAsync(); - -var fInstaller = new ForgeInstaller(new GameResolver(gameFolder).GetGameEntity("1.16.5"), - (await ForgeInstaller.EnumerableFromVersionAsync("1.16.5")).FirstOrDefault(),new JavaFetcher().Fetch().First().JavaPath); - -fInstaller.ProgressChanged += (_, x) => { - Console.Clear(); - Console.SetCursorPosition(0, 0); - Console.WriteLine($"{x.Status} - {x.ProgressStatus} - {x.Progress.ToPercentage(0.65d, 1.0d) * 100:F2}%"); - Console.SetCursorPosition(0, 0); -}; - -await fInstaller.InstallAsync(); - -Console.ReadKey(); +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) { + MaxMemory = 1024, + } +}); +await launcher.LaunchAsync("1.12.2"); \ No newline at end of file diff --git a/MinecraftLaunch.sln b/MinecraftLaunch.sln index c570a40..19c0de3 100644 --- a/MinecraftLaunch.sln +++ b/MinecraftLaunch.sln @@ -5,9 +5,7 @@ VisualStudioVersion = 17.8.34309.116 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MinecraftLaunch", "MinecraftLaunch\MinecraftLaunch.csproj", "{695112FD-D509-48BE-B050-0A4C1FFAC382}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Natsurainko.FluentCore", "..\..\..\Code\Natsurainko.FluentCore.New\Natsurainko.FluentCore\Natsurainko.FluentCore.csproj", "{510C557E-E4EB-4E28-BB05-969373030054}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MinecraftLaunch.Test", "MinecraftLaunch.Test\MinecraftLaunch.Test.csproj", "{76E3BD50-5A2C-43D0-A5B5-CD139EB60C94}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MinecraftLaunch.Simple", "MinecraftLaunch.Test\MinecraftLaunch.Simple.csproj", "{76E3BD50-5A2C-43D0-A5B5-CD139EB60C94}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -25,14 +23,6 @@ Global {695112FD-D509-48BE-B050-0A4C1FFAC382}.Release|Any CPU.Build.0 = Release|Any CPU {695112FD-D509-48BE-B050-0A4C1FFAC382}.Release|x64.ActiveCfg = Release|Any CPU {695112FD-D509-48BE-B050-0A4C1FFAC382}.Release|x64.Build.0 = Release|Any CPU - {510C557E-E4EB-4E28-BB05-969373030054}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {510C557E-E4EB-4E28-BB05-969373030054}.Debug|Any CPU.Build.0 = Debug|Any CPU - {510C557E-E4EB-4E28-BB05-969373030054}.Debug|x64.ActiveCfg = Debug|Any CPU - {510C557E-E4EB-4E28-BB05-969373030054}.Debug|x64.Build.0 = Debug|Any CPU - {510C557E-E4EB-4E28-BB05-969373030054}.Release|Any CPU.ActiveCfg = Release|Any CPU - {510C557E-E4EB-4E28-BB05-969373030054}.Release|Any CPU.Build.0 = Release|Any CPU - {510C557E-E4EB-4E28-BB05-969373030054}.Release|x64.ActiveCfg = Release|Any CPU - {510C557E-E4EB-4E28-BB05-969373030054}.Release|x64.Build.0 = Release|Any CPU {76E3BD50-5A2C-43D0-A5B5-CD139EB60C94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {76E3BD50-5A2C-43D0-A5B5-CD139EB60C94}.Debug|Any CPU.Build.0 = Debug|Any CPU {76E3BD50-5A2C-43D0-A5B5-CD139EB60C94}.Debug|x64.ActiveCfg = Debug|Any CPU diff --git a/MinecraftLaunch/Components/Checker/PreLaunchChecker.cs b/MinecraftLaunch/Components/Checker/PreLaunchChecker.cs new file mode 100644 index 0000000..c79c16e --- /dev/null +++ b/MinecraftLaunch/Components/Checker/PreLaunchChecker.cs @@ -0,0 +1,17 @@ +using MinecraftLaunch.Classes.Interfaces; +using MinecraftLaunch.Classes.Models.Game; + +namespace MinecraftLaunch.Components.Checker { + public class PreLaunchChecker(GameEntry entry) : IChecker { + public bool IsCheckResource { get; set; } + + public bool IsCheckAccount { get; set; } + + public ValueTask CheckAsync() { + /* + * + */ + throw new NotImplementedException(); + } + } +} diff --git a/MinecraftLaunch/Components/Launcher/Launcher.cs b/MinecraftLaunch/Components/Launcher/Launcher.cs index e0ba8c6..6cad81e 100644 --- a/MinecraftLaunch/Components/Launcher/Launcher.cs +++ b/MinecraftLaunch/Components/Launcher/Launcher.cs @@ -48,7 +48,7 @@ private Process CreateProcess(IEnumerable arguments, string versionPath) private async Task ExtractNativesAndStartProcess(string versionPath, LibrariesResolver librariesResolver, Process process) { var libraries = librariesResolver.GetLibraries() - .Where(x => (x as LibraryEntry).IsNative) + .Where(x => ((x as LibraryEntry)?.IsNative) != null) .Select(x => x.Path) .ToList(); diff --git a/MinecraftLaunch/MinecraftLaunch.csproj b/MinecraftLaunch/MinecraftLaunch.csproj index f97f752..943a5ca 100644 --- a/MinecraftLaunch/MinecraftLaunch.csproj +++ b/MinecraftLaunch/MinecraftLaunch.csproj @@ -1,6 +1,6 @@  - 3.0.0-preview3 + 3.0.0-preview4