Skip to content

Commit

Permalink
优化大量组件,重写参数构建器,更新版本号
Browse files Browse the repository at this point in the history
  • Loading branch information
YangSpring114 committed Aug 29, 2024
1 parent 81d5f80 commit 964985b
Show file tree
Hide file tree
Showing 91 changed files with 657 additions and 533 deletions.
36 changes: 18 additions & 18 deletions MinecraftLaunch.Test/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,30 +114,30 @@

GameResolver gameResolver = new("C:\\Users\\wxysd\\Desktop\\temp\\.minecraft");

VanlliaInstaller vanlliaInstaller = new(gameResolver, "1.18.2", MirrorDownloadManager.Bmcl);
vanlliaInstaller.ProgressChanged += (_, args) => {
Console.WriteLine($"{args.Progress * 100:0.00} - {args.Status} - {args.ProgressStatus}");
};
//VanlliaInstaller vanlliaInstaller = new(gameResolver, "1.18.2", MirrorDownloadManager.Bmcl);
//vanlliaInstaller.ProgressChanged += (_, args) => {
// Console.WriteLine($"{args.Progress * 100:0.00} - {args.Status} - {args.ProgressStatus}");
//};

await vanlliaInstaller.InstallAsync();
//await vanlliaInstaller.InstallAsync();

Console.WriteLine();
//Console.WriteLine();

ForgeInstaller forgeInstaller = new(gameResolver.GetGameEntity("1.18.2"),
(await ForgeInstaller.EnumerableFromVersionAsync("1.18.2")).First(),
"C:\\Users\\wxysd\\AppData\\Roaming\\.minecraft\\runtime\\java-runtime-gamma\\bin\\javaw.exe",
"1.18.2-Composition-114514",
MirrorDownloadManager.Bmcl);
//ForgeInstaller forgeInstaller = new(gameResolver.GetGameEntity("1.18.2"),
// (await ForgeInstaller.EnumerableFromVersionAsync("1.18.2")).First(),
// "C:\\Users\\wxysd\\AppData\\Roaming\\.minecraft\\runtime\\java-runtime-gamma\\bin\\javaw.exe",
// "1.18.2-Composition-114514",
// MirrorDownloadManager.Bmcl);

CompositionInstaller compositionInstaller = new(forgeInstaller,
"1.18.2-Composition-114514",
(await OptifineInstaller.EnumerableFromVersionAsync("1.18.2")).First());
//CompositionInstaller compositionInstaller = new(forgeInstaller,
// "1.18.2-Composition-114514",
// (await OptifineInstaller.EnumerableFromVersionAsync("1.18.2")).First());

compositionInstaller.ProgressChanged += (_, args) => {
Console.WriteLine($"{args.Progress * 100:0.00} - {args.Status} - {args.ProgressStatus}");
};
//compositionInstaller.ProgressChanged += (_, args) => {
// Console.WriteLine($"{args.Progress * 100:0.00} - {args.Status} - {args.ProgressStatus}");
//};

await compositionInstaller.InstallAsync();
//await compositionInstaller.InstallAsync();

#endregion

Expand Down
12 changes: 11 additions & 1 deletion MinecraftLaunch.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MinecraftLaunch", "Minecraf
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MinecraftLaunch.Simple", "MinecraftLaunch.Test\MinecraftLaunch.Simple.csproj", "{76E3BD50-5A2C-43D0-A5B5-CD139EB60C94}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MinecraftLaunch.BanchTest", "MinecraftLaunch.BanchTest\MinecraftLaunch.BanchTest.csproj", "{95AA9E60-2FD0-41C1-ACC7-1C3021B30F73}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MinecraftLaunch.Banchmark", "MinecraftLaunch.BanchTest\MinecraftLaunch.Banchmark.csproj", "{95AA9E60-2FD0-41C1-ACC7-1C3021B30F73}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Natsurainko.FluentCore", "..\..\..\Code\Natsurainko.FluentLauncher\Natsurainko.FluentCore\Natsurainko.FluentCore\Natsurainko.FluentCore.csproj", "{0EEEF9C0-49BE-4D3D-80B4-B01ED15CF7CA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -41,6 +43,14 @@ Global
{95AA9E60-2FD0-41C1-ACC7-1C3021B30F73}.Release|Any CPU.Build.0 = Release|Any CPU
{95AA9E60-2FD0-41C1-ACC7-1C3021B30F73}.Release|x64.ActiveCfg = Release|Any CPU
{95AA9E60-2FD0-41C1-ACC7-1C3021B30F73}.Release|x64.Build.0 = Release|Any CPU
{0EEEF9C0-49BE-4D3D-80B4-B01ED15CF7CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0EEEF9C0-49BE-4D3D-80B4-B01ED15CF7CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0EEEF9C0-49BE-4D3D-80B4-B01ED15CF7CA}.Debug|x64.ActiveCfg = Debug|Any CPU
{0EEEF9C0-49BE-4D3D-80B4-B01ED15CF7CA}.Debug|x64.Build.0 = Debug|Any CPU
{0EEEF9C0-49BE-4D3D-80B4-B01ED15CF7CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0EEEF9C0-49BE-4D3D-80B4-B01ED15CF7CA}.Release|Any CPU.Build.0 = Release|Any CPU
{0EEEF9C0-49BE-4D3D-80B4-B01ED15CF7CA}.Release|x64.ActiveCfg = Release|Any CPU
{0EEEF9C0-49BE-4D3D-80B4-B01ED15CF7CA}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
3 changes: 2 additions & 1 deletion MinecraftLaunch/Classes/Enums/AccountType.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace MinecraftLaunch.Classes.Enums;

public enum AccountType {

/// <summary>
/// 离线账户
/// </summary>
Expand All @@ -15,7 +16,7 @@ public enum AccountType {
/// Yggdrasil 第三方账户
/// </summary>
Yggdrasil,

/// <summary>
/// UnifiedPass 统一通行证
/// </summary>
Expand Down
19 changes: 10 additions & 9 deletions MinecraftLaunch/Classes/Enums/CrashCauses.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
namespace MinecraftLaunch.Classes.Enums;

public enum CrashCauses {

#region Memory

NoEnoughMemory,
NoEnoughMemory32,

#endregion
#endregion Memory

#region Java

Expand All @@ -15,7 +16,7 @@ public enum CrashCauses {
JavaVersionTooHigh,
UnsupportedJavaVersion,

#endregion
#endregion Java

#region GPU

Expand All @@ -24,7 +25,7 @@ public enum CrashCauses {
UnableToSetPixelFormat,
UnsupportedIntelDriver,

#endregion
#endregion GPU

#region Mod

Expand All @@ -38,21 +39,21 @@ public enum CrashCauses {
ModCausedGameCrash,
MissingOrUnsupportedMandatoryMod,

#endregion
#endregion Mod

#region OpenGL

OpenGl1282Error,
GpuDoesNotSupportOpenGl,

#endregion
#endregion OpenGL

#region Shaders

TextureTooLargeOrLowEndGpu,
FailedToLoadWorldBecauseOptiFine,
FailedToLoadWorldBecauseOptiFine,

#endregion
#endregion Shaders

#region AffiliatedComponent

Expand All @@ -63,7 +64,7 @@ public enum CrashCauses {
IncompatibleForgeAndOptifine,
LegacyForgeDoesNotSupportNewerJava,

#endregion
#endregion AffiliatedComponent

LogFileNotFound,
BlockCausedGameCrash,
Expand All @@ -73,4 +74,4 @@ public enum CrashCauses {
IncorrectPathEncodingOrMainClassNotFound,

Other
}
}
5 changes: 2 additions & 3 deletions MinecraftLaunch/Classes/Interfaces/IAuthenticator.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using MinecraftLaunch.Classes.Models.Auth;

namespace MinecraftLaunch.Classes.Interfaces;
namespace MinecraftLaunch.Classes.Interfaces;

/// <summary>
/// 验证器统一接口
/// </summary>
public interface IAuthenticator<out TAccount> {

/// <summary>
/// 验证方法
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions MinecraftLaunch/Classes/Interfaces/IChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/// 检查器统一接口
/// </summary>
public interface IChecker {

/// <summary>
/// 异步检查方法
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions MinecraftLaunch/Classes/Interfaces/IDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/// 下载器统一接口
/// </summary>
public interface IDownloader {

/// <summary>
/// 异步下载方法
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions MinecraftLaunch/Classes/Interfaces/IFetcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/// 统一搜寻器接口
/// </summary>
public interface IFetcher<T> {

/// <summary>
/// 同步搜寻 <typeparamref name="T"/> 类型方法
/// </summary>
Expand Down
6 changes: 4 additions & 2 deletions MinecraftLaunch/Classes/Interfaces/IGameProcessWatcher.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System.Diagnostics;
using MinecraftLaunch.Classes.Models.Event;
using MinecraftLaunch.Classes.Models.Event;

using System.Diagnostics;

namespace MinecraftLaunch.Classes.Interfaces;

public interface IGameProcessWatcher {

/// <summary>
/// 游戏进程
/// </summary>
Expand Down
3 changes: 2 additions & 1 deletion MinecraftLaunch/Classes/Interfaces/IGameResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ namespace MinecraftLaunch.Classes.Interfaces;
/// 游戏实例解析器接口
/// </summary>
public interface IGameResolver {

/// <summary>
/// 根目录
/// </summary>
DirectoryInfo Root { get; }
DirectoryInfo Root { get; }

/// <summary>
/// 根据 Id 获取指定的 <see cref="GameEntry"/> 游戏实例
Expand Down
1 change: 1 addition & 0 deletions MinecraftLaunch/Classes/Interfaces/IInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace MinecraftLaunch.Classes.Interfaces;

public interface IInstaller {

/// <summary>
/// 异步安装方法
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions MinecraftLaunch/Classes/Interfaces/ILauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace MinecraftLaunch.Classes.Interfaces;
/// 启动器统一接口
/// </summary>
public interface ILauncher {

/// <summary>
/// 游戏启动配置
/// </summary>
Expand Down
3 changes: 2 additions & 1 deletion MinecraftLaunch/Classes/Interfaces/IWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
/// 监视器统一接口
/// </summary>
public interface IWatcher {

void Start();
}
}
2 changes: 1 addition & 1 deletion MinecraftLaunch/Classes/Models/Auth/Account.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ public sealed record UnifiedPassAccount : Account {
}

[JsonSerializable(typeof(Account))]
sealed partial class AccountContext : JsonSerializerContext;
internal sealed partial class AccountContext : JsonSerializerContext;
2 changes: 1 addition & 1 deletion MinecraftLaunch/Classes/Models/Auth/DeviceCodeResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ public sealed record DeviceCodeResponse {
}

[JsonSerializable(typeof(DeviceCodeResponse))]
sealed partial class DeviceCodeResponseContext : JsonSerializerContext;
internal sealed partial class DeviceCodeResponseContext : JsonSerializerContext;
26 changes: 13 additions & 13 deletions MinecraftLaunch/Classes/Models/Auth/LauncherAccountEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ namespace MinecraftLaunch.Classes.Models.Auth;
public sealed record LauncherAccountEntry {
[JsonPropertyName("mojangClientToken")]
public string MojangClientToken { get; set; }

[JsonPropertyName("activeAccountLocalId")]
public string ActiveAccountLocalId { get; set; }
[JsonPropertyName("accounts")]

[JsonPropertyName("accounts")]
public Dictionary<string, AccountEntry> Accounts { get; set; }
}

Expand All @@ -20,7 +20,7 @@ public sealed record AccountEntry {
[JsonPropertyName("accessTokenExpiresAt")]
public DateTime AccessTokenExpiresAt { get; set; }

[JsonPropertyName("avatar")]
[JsonPropertyName("avatar")]
public string AvatarUrl { get; set; }

[JsonPropertyName("eligibleForMigration")]
Expand All @@ -29,28 +29,28 @@ public sealed record AccountEntry {
[JsonPropertyName("hasMultipleProfiles")]
public bool HasMultipleProfiles { get; set; }

[JsonPropertyName("legacy")]
[JsonPropertyName("legacy")]
public bool IsLegacy { get; set; }

[JsonPropertyName("localId")]
[JsonPropertyName("localId")]
public string LocalId { get; set; }

[JsonPropertyName("minecraftProfile")]
public AccountProfileEntry MinecraftProfile { get; set; }

[JsonPropertyName("persistent")]
[JsonPropertyName("persistent")]
public bool IsPersistent { get; set; }

[JsonPropertyName("remoteId")]
[JsonPropertyName("remoteId")]
public string RemoteId { get; set; }

[JsonPropertyName("type")]
[JsonPropertyName("type")]
public string Type { get; set; }

[JsonPropertyName("userProperites")]
[JsonPropertyName("userProperites")]
public AccountProfileEntry[] UserProperites { get; set; }

[JsonPropertyName("username")]
[JsonPropertyName("username")]
public string UserName { get; set; }

[JsonPropertyName("__id")]
Expand All @@ -61,9 +61,9 @@ public sealed record AccountProfileEntry {
[JsonPropertyName("id")]
public string Uuid { get; set; }

[JsonPropertyName("name")]
[JsonPropertyName("name")]
public string Name { get; set; }
}

[JsonSerializable(typeof(LauncherAccountEntry))]
partial class LauncherAccountEntryContext : JsonSerializerContext;
internal partial class LauncherAccountEntryContext : JsonSerializerContext;
4 changes: 2 additions & 2 deletions MinecraftLaunch/Classes/Models/Auth/OAuth2TokenResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public sealed record OAuth2TokenResponse {
[JsonPropertyName("foci")]
public string Foci { get; set; }
}

[JsonSerializable(typeof(OAuth2TokenResponse))]
sealed partial class OAuth2TokenResponseContext : JsonSerializerContext;
internal sealed partial class OAuth2TokenResponseContext : JsonSerializerContext;
4 changes: 2 additions & 2 deletions MinecraftLaunch/Classes/Models/Auth/YggdrasilResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ public sealed record ProfileModel {
[JsonPropertyName("id")]
public string Id { get; set; }
}

[JsonSerializable(typeof(YggdrasilResponse))]
sealed partial class YggdrasilResponseContext : JsonSerializerContext;
internal sealed partial class YggdrasilResponseContext : JsonSerializerContext;
4 changes: 2 additions & 2 deletions MinecraftLaunch/Classes/Models/Download/DownloadsEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ public sealed record FileEntry {
[JsonPropertyName("id")]
public string Id { get; set; }
}

[JsonSerializable(typeof(DownloadsEntry))]
sealed partial class DownloadsEntryContext : JsonSerializerContext;
internal sealed partial class DownloadsEntryContext : JsonSerializerContext;
Loading

0 comments on commit 964985b

Please sign in to comment.