Skip to content

Commit

Permalink
将所有公共类密封
Browse files Browse the repository at this point in the history
  • Loading branch information
YangSpring114 committed Jan 28, 2024
1 parent ab8e5c9 commit d19b0fd
Show file tree
Hide file tree
Showing 87 changed files with 2,549 additions and 2,704 deletions.
44 changes: 19 additions & 25 deletions MinecraftLaunch/Classes/Enums/AccountType.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MinecraftLaunch.Classes.Enums;

namespace MinecraftLaunch.Classes.Enums {
public enum AccountType {
/// <summary>
/// 离线账户
/// </summary>
Offline,
public enum AccountType {
/// <summary>
/// 离线账户
/// </summary>
Offline,

/// <summary>
/// 微软账户
/// </summary>
Microsoft,
/// <summary>
/// 微软账户
/// </summary>
Microsoft,

/// <summary>
/// Yggdrasil 第三方账户
/// </summary>
Yggdrasil,
/// <summary>
/// Yggdrasil 第三方账户
/// </summary>
Yggdrasil,

/// <summary>
/// UnifiedPass 统一通行证
/// </summary>
UnifiedPass
}
}
/// <summary>
/// UnifiedPass 统一通行证
/// </summary>
UnifiedPass
}
18 changes: 6 additions & 12 deletions MinecraftLaunch/Classes/Enums/DownloadEntryType.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MinecraftLaunch.Classes.Enums;

namespace MinecraftLaunch.Classes.Enums {
public enum DownloadEntryType {
Jar,
Asset,
Library
}
}
public enum DownloadEntryType {
Jar,
Asset,
Library
}
24 changes: 9 additions & 15 deletions MinecraftLaunch/Classes/Enums/LoaderType.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MinecraftLaunch.Classes.Enums;

namespace MinecraftLaunch.Classes.Enums {
public enum LoaderType {
Forge,
Quilt,
Fabric,
Vanilla,
OptiFine,
LiteLoader,
}
}
public enum LoaderType {
Forge,
Quilt,
Fabric,
Vanilla,
OptiFine,
LiteLoader,
}
22 changes: 7 additions & 15 deletions MinecraftLaunch/Classes/Enums/Platform.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MinecraftLaunch.Classes.Enums;

namespace MinecraftLaunch.Classes.Enums
{
public enum Platform
{
windows,
linux,
osx,
unknown
}
}
public enum Platform {
windows,
linux,
osx,
unknown
}
16 changes: 8 additions & 8 deletions MinecraftLaunch/Classes/Interfaces/IAuthenticator.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace MinecraftLaunch.Classes.Interfaces {
/// <summary>
/// 验证器统一接口(IoC 适应)
/// </summary>
public interface IAuthenticator<out TAccount> {
TAccount Authenticate();
}
}
namespace MinecraftLaunch.Classes.Interfaces;

/// <summary>
/// 验证器统一接口(IoC 适应)
/// </summary>
public interface IAuthenticator<out TAccount> {
TAccount Authenticate();
}
20 changes: 7 additions & 13 deletions MinecraftLaunch/Classes/Interfaces/IChecker.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MinecraftLaunch.Classes.Interfaces;

namespace MinecraftLaunch.Classes.Interfaces {
/// <summary>
/// 检查器统一接口
/// </summary>
public interface IChecker {
ValueTask<bool> CheckAsync();
}
}
/// <summary>
/// 检查器统一接口
/// </summary>
public interface IChecker {
ValueTask<bool> CheckAsync();
}
23 changes: 9 additions & 14 deletions MinecraftLaunch/Classes/Interfaces/IDownloadEntry.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
using MinecraftLaunch.Classes.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MinecraftLaunch.Classes.Interfaces {
public interface IDownloadEntry {
int Size { get; set; }
namespace MinecraftLaunch.Classes.Interfaces;

string Url { get; set; }
public interface IDownloadEntry {
int Size { get; set; }

string Path { get; set; }
string Url { get; set; }

string Checksum { get; set; }
string Path { get; set; }

DownloadEntryType Type { get; }
}
}
string Checksum { get; set; }

DownloadEntryType Type { get; }
}
14 changes: 4 additions & 10 deletions MinecraftLaunch/Classes/Interfaces/IDownloader.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MinecraftLaunch.Classes.Interfaces;

namespace MinecraftLaunch.Classes.Interfaces {
public interface IDownloader {
ValueTask<bool> DownloadAsync();
}
}
public interface IDownloader {
ValueTask<bool> DownloadAsync();
}
18 changes: 9 additions & 9 deletions MinecraftLaunch/Classes/Interfaces/IFetcher.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
namespace MinecraftLaunch.Classes.Interfaces {
/// <summary>
/// 统一搜寻器接口
/// </summary>
public interface IFetcher<T> {
public T Fetch();
namespace MinecraftLaunch.Classes.Interfaces;

public ValueTask<T> FetchAsync();
}
}
/// <summary>
/// 统一搜寻器接口
/// </summary>
public interface IFetcher<T> {
public T Fetch();

public ValueTask<T> FetchAsync();
}
16 changes: 8 additions & 8 deletions MinecraftLaunch/Classes/Interfaces/IGameProcessWatcher.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using System.Diagnostics;
using MinecraftLaunch.Classes.Models.Event;

namespace MinecraftLaunch.Classes.Interfaces {
public class IGameProcessWatcher {
public Process Process { get; }
namespace MinecraftLaunch.Classes.Interfaces;

public IEnumerable<string> Arguments { get; }
public class IGameProcessWatcher {
public Process Process { get; }

public event EventHandler<ExitedEventArgs> Exited;
public IEnumerable<string> Arguments { get; }

public event EventHandler<LogReceivedEventArgs> OutputLogReceived;
}
}
public event EventHandler<ExitedEventArgs> Exited;

public event EventHandler<LogReceivedEventArgs> OutputLogReceived;
}
14 changes: 7 additions & 7 deletions MinecraftLaunch/Classes/Interfaces/IGameResolver.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using MinecraftLaunch.Classes.Models.Game;

namespace MinecraftLaunch.Classes.Interfaces {
public interface IGameResolver {
DirectoryInfo Root { get; }
namespace MinecraftLaunch.Classes.Interfaces;

GameEntry GetGameEntity(string id);
public interface IGameResolver {
DirectoryInfo Root { get; }

IEnumerable<GameEntry> GetGameEntitys();
}
}
GameEntry GetGameEntity(string id);

IEnumerable<GameEntry> GetGameEntitys();
}
16 changes: 8 additions & 8 deletions MinecraftLaunch/Classes/Interfaces/IInstaller.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using MinecraftLaunch.Classes.Models.Event;

namespace MinecraftLaunch.Classes.Interfaces {
public interface IInstaller {
ValueTask<bool> InstallAsync();
namespace MinecraftLaunch.Classes.Interfaces;

void ReportProgress(double progress, string progressStatus, TaskStatus status);
public interface IInstaller {
ValueTask<bool> InstallAsync();

event EventHandler<EventArgs> Completed;
void ReportProgress(double progress, string progressStatus, TaskStatus status);

event EventHandler<ProgressChangedEventArgs> ProgressChanged;
}
}
event EventHandler<EventArgs> Completed;

event EventHandler<ProgressChangedEventArgs> ProgressChanged;
}
24 changes: 12 additions & 12 deletions MinecraftLaunch/Classes/Interfaces/ILauncher.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using MinecraftLaunch.Classes.Models.Launch;

namespace MinecraftLaunch.Classes.Interfaces {
/// <summary>
/// 启动器统一接口(IoC适应)
/// </summary>
public interface ILauncher {
LaunchConfig LaunchConfig { get; }

IGameResolver GameResolver { get; }

ValueTask<IGameProcessWatcher> LaunchAsync(string id);
}
}
namespace MinecraftLaunch.Classes.Interfaces;

/// <summary>
/// 启动器统一接口(IoC适应)
/// </summary>
public interface ILauncher {
LaunchConfig LaunchConfig { get; }

IGameResolver GameResolver { get; }

ValueTask<IGameProcessWatcher> LaunchAsync(string id);
}
22 changes: 8 additions & 14 deletions MinecraftLaunch/Classes/Interfaces/IResolver.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MinecraftLaunch.Classes.Interfaces;

namespace MinecraftLaunch.Classes.Interfaces {
public interface IResolver {}
public interface IResolver {}

public interface IResolver<T> : IResolver {
T Resolve(string str);
}

public interface IResolver<TReturn, TParameter> : IResolver {
TReturn Resolve(TParameter parameter);
}
public interface IResolver<T> : IResolver {
T Resolve(string str);
}

public interface IResolver<TReturn, TParameter> : IResolver {
TReturn Resolve(TParameter parameter);
}
Loading

0 comments on commit d19b0fd

Please sign in to comment.