Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion MinecraftLaunch.Base/Enums/AccountType.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace MinecraftLaunch.Base.Enums;

public enum AccountType {
public enum AccountType
{
Offline = 0,
Microsoft = 1,
Yggdrasil = 2
Expand Down
14 changes: 14 additions & 0 deletions MinecraftLaunch.Base/Enums/ClassId.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace MinecraftLaunch.Base.Enums;

public enum ClassId
{
Modpacks = 4471,
Shaders = 6552,
Mods = 6,
BukkitPlugins = 5,
Addons = 4559,
Worlds = 17,
ResourcePacks = 12,
Customization = 4546,
DataPacks = 6945
}
8 changes: 7 additions & 1 deletion MinecraftLaunch.Base/Enums/CrashReasons.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
namespace MinecraftLaunch.Base.Enums;

public enum CrashReasons {
public enum CrashReasons
{
// Minecraft
FileOrContentCheckFailed,

SpecificBlockCausedCrash,
SpecificEntityCausedCrash,
TextureTooLargeOrInsufficientGraphicsConfig,
Expand All @@ -11,6 +13,7 @@ public enum CrashReasons {

// Mod
ModConfigCausedGameCrash,

ModMixinFailed,
ModLoaderError,
ModInitializationFailed,
Expand All @@ -21,6 +24,7 @@ public enum CrashReasons {

// ModLoader
OptiFineIncompatibleWithForge,

FabricError,
FabricErrorWithSolution,
ForgeError,
Expand All @@ -30,11 +34,13 @@ public enum CrashReasons {

// Log
CrashLogStackAnalysisFoundKeyword,

CrashLogStackAnalysisFoundModName,
MCLogStackAnalysisFoundKeyword,

// Jvm
InsufficientMemory,

UsingJDK,
GraphicsCardDoesNotSupportOpenGL,
UsingOpenJ9,
Expand Down
11 changes: 11 additions & 0 deletions MinecraftLaunch.Base/Enums/DependencyType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace MinecraftLaunch.Base.Enums;

public enum DependencyType
{
Embedded = 1,
Optional,
Required,
Tool,
Incompatible,
Include
}
3 changes: 2 additions & 1 deletion MinecraftLaunch.Base/Enums/DownloadEntryType.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace MinecraftLaunch.Base.Enums;

public enum DownloadEntryType {
public enum DownloadEntryType
{
Jar,
Asset,
Library
Expand Down
3 changes: 2 additions & 1 deletion MinecraftLaunch.Base/Enums/DownloadResultType.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace MinecraftLaunch.Base.Enums;

public enum DownloadResultType {
public enum DownloadResultType
{
Successful,
Cancelled,
Failed
Expand Down
8 changes: 8 additions & 0 deletions MinecraftLaunch.Base/Enums/FileReleaseType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace MinecraftLaunch.Base.Enums;

public enum FileReleaseType
{
Release = 1,
Beta,
Alpha
}
5 changes: 3 additions & 2 deletions MinecraftLaunch.Base/Enums/HashType.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
namespace MinecraftLaunch.Base.Enums;

public enum HashType {
SHA1,
public enum HashType
{
SHA1,
SHA256,
SHA384,
SHA512
Expand Down
8 changes: 7 additions & 1 deletion MinecraftLaunch.Base/Enums/InstallStep.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
namespace MinecraftLaunch.Base.Enums;

public enum InstallStep {
public enum InstallStep
{
//Common
Started,

DownloadVersionJson,
ParseMinecraft,
DownloadLibraries,
Expand All @@ -11,25 +13,29 @@ public enum InstallStep {

//Forge Optifine
DownloadPackage,

ParsePackage,
WriteVersionJsonAndSomeDependencies,
RunInstallProcessor,

//Modpack
ParseFiles,

ParseDownloadUrls,
DownloadMods,
ExtractModpack,
RedirectInvalidMod,

//Composite
ParseInstaller,

InstallVanilla,
InstallPrimaryModLoader,
InstallSecondaryModLoader,

//Java
FetchingMetadata,

DownloadJava,
ExtractingFiles,

Expand Down
3 changes: 2 additions & 1 deletion MinecraftLaunch.Base/Enums/MinecraftLogLevel.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace MinecraftLaunch.Base.Enums;

public enum MinecraftLogLevel {
public enum MinecraftLogLevel
{
Fatal,
Error,
Warning,
Expand Down
3 changes: 2 additions & 1 deletion MinecraftLaunch.Base/Enums/MinecraftVersionType.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace MinecraftLaunch.Base.Enums;

public enum MinecraftVersionType {
public enum MinecraftVersionType
{
Release,
Snapshot,
OldBeta,
Expand Down
11 changes: 10 additions & 1 deletion MinecraftLaunch.Base/Enums/ModLoaderType.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
namespace MinecraftLaunch.Base.Enums;

public enum ModLoaderType {
public enum ModLoaderType
{
// 模组
Any = 0,

Forge = 1,
Cauldron = 2,
LiteLoader = 3,
Expand All @@ -10,4 +13,10 @@ public enum ModLoaderType {
NeoForge = 6,
OptiFine = 7,
Unknown,

// 光影
Canvas,

Iris,
Vanilla,
}
3 changes: 2 additions & 1 deletion MinecraftLaunch.Base/Enums/ModrinthSearchIndex.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace MinecraftLaunch.Base.Enums;

public enum ModrinthSearchIndex {
public enum ModrinthSearchIndex
{
Follows,
Downloads,
Relevance,
Expand Down
12 changes: 12 additions & 0 deletions MinecraftLaunch.Base/Enums/ResourceType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace MinecraftLaunch.Base.Enums;

public enum ResourceType
{
Instance,
Mod,
Modpack,
Datapack,
Resourcepack,
Shaderpack,
World
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace MinecraftLaunch.Base.EventArgs;

public sealed class ResourceDownloadProgressChangedEventArgs : System.EventArgs {
public sealed class ResourceDownloadProgressChangedEventArgs : System.EventArgs
{
public double Speed { get; set; }
public int TotalCount { get; set; }
public int CompletedCount { get; set; }
Expand Down
17 changes: 10 additions & 7 deletions MinecraftLaunch.Base/EventArgs/InstallProgressChangedEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,29 @@

namespace MinecraftLaunch.Base.EventArgs;

public class InstallProgressChangedEventArgs : System.EventArgs {
public class InstallProgressChangedEventArgs : System.EventArgs
{
public double Speed { get; set; }
public required double Progress { get; set; }
public double Progress { get; set; }

public int TotalStepTaskCount { get; set; }
public int FinishedStepTaskCount { get; set; }

public required TaskStatus Status { get; set; }
public required InstallStep StepName { get; set; }
public required bool IsStepSupportSpeed { get; set; }
public TaskStatus Status { get; set; }
public InstallStep StepName { get; set; }
public bool IsStepSupportSpeed { get; set; }

[Obsolete($"Replaced by {nameof(StepName)}")]
public string ProgressStatus { get; set; }
}

public class InstallComplatedEventArgs : System.EventArgs {
public class InstallComplatedEventArgs : System.EventArgs
{
public bool IsSuccessful { get; set; }
public Exception Exception { get; set; }
}

public sealed class CompositeInstallProgressChangedEventArgs : InstallProgressChangedEventArgs {
public sealed class CompositeInstallProgressChangedEventArgs : InstallProgressChangedEventArgs
{
public InstallStep PrimaryStepName { get; set; }
}
4 changes: 3 additions & 1 deletion MinecraftLaunch.Base/Interfaces/IDataProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

namespace MinecraftLaunch.Base.Interfaces;

public interface IDataProcessor {
public interface IDataProcessor
{
Dictionary<string, object> Datas { get; set; }

void Handle(IEnumerable<MinecraftEntry> data);

Task SaveAsync(CancellationToken cancellationToken = default);
}
3 changes: 2 additions & 1 deletion MinecraftLaunch.Base/Interfaces/IDownloadDependency.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace MinecraftLaunch.Base.Interfaces;

public interface IDownloadDependency {
public interface IDownloadDependency
{
string Url { get; }
string FullPath { get; }
long? Size { get; }
Expand Down
3 changes: 2 additions & 1 deletion MinecraftLaunch.Base/Interfaces/IDownloadMirror.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace MinecraftLaunch.Base.Interfaces;

public interface IDownloadMirror {
public interface IDownloadMirror
{
public string TryFindUrl(string sourceUrl);
}
4 changes: 3 additions & 1 deletion MinecraftLaunch.Base/Interfaces/IDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace MinecraftLaunch.Base.Interfaces;

public interface IDownloader {
public interface IDownloader
{
Task<DownloadResult> DownloadAsync(DownloadRequest request, CancellationToken cancellationToken);

Task<GroupDownloadResult> DownloadManyAsync(GroupDownloadRequest requests, CancellationToken cancellationToken);
}
3 changes: 2 additions & 1 deletion MinecraftLaunch.Base/Interfaces/IInstallEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

namespace MinecraftLaunch.Base.Interfaces;

public interface IInstallEntry {
public interface IInstallEntry
{
/// <summary>
/// Minecraft 的版本号,例如 "1.20.1"
/// </summary>
Expand Down
3 changes: 2 additions & 1 deletion MinecraftLaunch.Base/Interfaces/IInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

namespace MinecraftLaunch.Base.Interfaces;

public interface IInstaller {
public interface IInstaller
{
string MinecraftFolder { get; }

Task<MinecraftEntry> InstallAsync(CancellationToken cancellationToken = default);
Expand Down
5 changes: 4 additions & 1 deletion MinecraftLaunch.Base/Interfaces/INbtParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@

namespace MinecraftLaunch.Base.Interfaces;

public interface INbtParser {
public interface INbtParser
{
NbtReader GetReader(NbtCompression compression = NbtCompression.None);

NbtWriter GetWriter(NbtCompression compression = NbtCompression.None);

Task<SaveEntry> ParseSaveAsync(string saveName, bool @bool = true, CancellationToken cancellationToken = default);
}
26 changes: 16 additions & 10 deletions MinecraftLaunch.Base/Interfaces/IResource.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
namespace MinecraftLaunch.Base.Interfaces;
using MinecraftLaunch.Base.Enums;

public interface IResource {
string Name { get; init; }
string Summary { get; init; }
string IconUrl { get; init; }
int DownloadCount { get; init; }
DateTime DateModified { get; init; }
IEnumerable<string> Categories { get; init; }
IEnumerable<string> Screenshots { get; init; }
IEnumerable<string> MinecraftVersions { get; init; }
namespace MinecraftLaunch.Base.Interfaces;

public interface IResource
{
public string Name { get; init; }
public string Summary { get; init; }
public string IconUrl { get; init; }
public string WebsiteUrl { get; init; }
public int DownloadCount { get; init; }
public DateTime DateModified { get; init; }
public IEnumerable<string> Categories { get; init; }
public IEnumerable<string> Screenshots { get; init; }
public IEnumerable<string> MinecraftVersions { get; init; }
public IEnumerable<ModLoaderType> Loaders { get; init; }
public ResourceType ResourceType { get; }
}
16 changes: 16 additions & 0 deletions MinecraftLaunch.Base/Interfaces/IResourceFile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using MinecraftLaunch.Base.Enums;

namespace MinecraftLaunch.Base.Interfaces;

public interface IResourceFile
{
public string DisplayName { get; init; }
public string FileName { get; init; }
public string DownloadUrl { get; init; }
public long DownloadCount { get; init; }
public DateTime Published { get; init; }
public FileReleaseType ReleaseType { get; init; }
public IEnumerable<string> GameVersions { get; init; }
public IEnumerable<ModLoaderType> Loaders { get; init; }
public long FileSize { get; init; }
}
Loading