Skip to content

Commit

Permalink
添加游戏崩溃分析器,更新版本号
Browse files Browse the repository at this point in the history
  • Loading branch information
YangSpring114 committed May 3, 2024
1 parent 84db42a commit 976d4c0
Show file tree
Hide file tree
Showing 8 changed files with 532 additions and 6 deletions.
29 changes: 27 additions & 2 deletions MinecraftLaunch.Test/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using MinecraftLaunch.Components.Resolver;
using MinecraftLaunch;
using MinecraftLaunch.Components.Resolver;
using MinecraftLaunch.Components.Analyzer;
using MinecraftLaunch.Components.Installer;
using MinecraftLaunch;
using MinecraftLaunch.Components.Authenticator;

MirrorDownloadManager.IsUseMirrorDownloadSource = true;

Expand Down Expand Up @@ -103,4 +105,27 @@

#endregion

#region MicrosoftAuthenticator

//MicrosoftAuthenticator microsoftAuthenticator = new("Your Client ID");
//await microsoftAuthenticator.DeviceFlowAuthAsync(x => {
// Console.WriteLine(x.UserCode);
// Console.WriteLine(x.VerificationUrl);
//});

//var account = await microsoftAuthenticator.AuthenticateAsync();

#endregion

#region Crash Analysis
GameResolver gameResolver = new("C:\\Users\\w\\Desktop\\总整包\\MC\\mc启动器\\BakaXL\\.minecraft");

var crashAnalyzer = new GameCrashAnalyzer(gameResolver.GetGameEntity("1.20.1"), true);
var reports = crashAnalyzer.AnalysisLogs();

foreach (var report in reports) {
Console.WriteLine(report);
}
#endregion

Console.ReadKey();
75 changes: 75 additions & 0 deletions MinecraftLaunch/Classes/Enums/CrashCauses.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
namespace MinecraftLaunch.Classes.Enums;

public enum CrashCauses {
#region Memory

NoEnoughMemory,
NoEnoughMemory32,

#endregion

#region Java

JdkUse,
OpenJ9Use,
JavaVersionTooHigh,
UnsupportedJavaVersion,

#endregion

#region GPU

UnsupportedNvDriver,
UnsupportedAmdDriver,
UnableToSetPixelFormat,
UnsupportedIntelDriver,

#endregion

#region Mod

DuplicateMod,
ModIdExceeded,
ModInitFailed,
ModMixinFailed,
ModLoaderError,
DecompressedMod,
IncorrectModConfig,
ModCausedGameCrash,

#endregion

#region OpenGL

OpenGl1282Error,
GpuDoesNotSupportOpenGl,

#endregion

#region Shaders

TextureTooLargeOrLowEndGpu,
FailedToLoadWorldBecauseOptiFine,

#endregion

#region AffiliatedComponent

ForgeError,
FabricError,
FabricErrorWithSolution,
MultipleForgeInVersionJson,
IncompatibleForgeAndOptifine,
LegacyForgeDoesNotSupportNewerJava,

#endregion

LogFileNotFound,
BlockCausedGameCrash,
EntityCausedGameCrash,
ContentValidationFailed,
ManuallyTriggeredDebugCrash,
IncorrectPathEncodingOrMainClassNotFound,

Other
}
6 changes: 4 additions & 2 deletions MinecraftLaunch/Classes/Models/Event/LogReceivedEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

namespace MinecraftLaunch.Classes.Models.Event;

public sealed class LogReceivedEventArgs(string log, string time, string source, LogType logType) : EventArgs {
public string Text => log;
public sealed class LogReceivedEventArgs(string original, string log, string time, string source, LogType logType) : EventArgs {
public string Log => log;
public string Time => time;
public string Source => source;
public string Original => original;

public LogType LogType => logType;
}
9 changes: 9 additions & 0 deletions MinecraftLaunch/Classes/Models/Launch/CrashReport.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using MinecraftLaunch.Classes.Enums;

namespace MinecraftLaunch.Classes.Models.Launch;

public sealed record CrashReport {
public string Original { get; set; }
public CrashCauses CrashCauses { get; set; }
public IReadOnlyCollection<string> Details { get; set; }
}
Loading

0 comments on commit 976d4c0

Please sign in to comment.