From c148672c08bea5edf75f998452ba34cbd164d31b Mon Sep 17 00:00:00 2001 From: Ryan Macham Date: Mon, 6 Apr 2026 11:41:03 +0100 Subject: [PATCH] Updated Filestore. Finished Auth and Install Services. Introduced GameOptions and BaseConfig. Adjusted Settings Service to reflect. --- .../Abstractions/Configuration/BaseConfig.cs | 7 ++++++ .../Abstractions/Interfaces/IFileStore.cs | 7 ++++++ .../Interfaces/Services/IAuthService.cs | 7 ++++++ .../Services/IGameInstallService.cs | 13 ++++++++++ AlayaCore/Models/AlayaPath.cs | 7 ++++++ AlayaCore/Models/Configuration/GameOptions.cs | 7 ++++++ AlayaCore/Services/AuthService.cs | 7 ++++++ AlayaCore/Services/GameInstallService.cs | 7 ++++++ AlayaCore/Services/GameLaunchService.cs | 7 ++++++ ...nloadService.cs => HttpDownloadService.cs} | 4 +-- AlayaCore/Utilities/Enums/FolderLocation.cs | 7 ++++++ AlayaCore/Utilities/Stores/LocalFileStore.cs | 25 +++++++++++++++++++ 12 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 AlayaCore/Abstractions/Configuration/BaseConfig.cs create mode 100644 AlayaCore/Abstractions/Interfaces/IFileStore.cs create mode 100644 AlayaCore/Abstractions/Interfaces/Services/IAuthService.cs create mode 100644 AlayaCore/Abstractions/Interfaces/Services/IGameInstallService.cs create mode 100644 AlayaCore/Models/AlayaPath.cs create mode 100644 AlayaCore/Models/Configuration/GameOptions.cs create mode 100644 AlayaCore/Services/AuthService.cs create mode 100644 AlayaCore/Services/GameInstallService.cs create mode 100644 AlayaCore/Services/GameLaunchService.cs rename AlayaCore/Services/{DownloadService.cs => HttpDownloadService.cs} (98%) create mode 100644 AlayaCore/Utilities/Enums/FolderLocation.cs create mode 100644 AlayaCore/Utilities/Stores/LocalFileStore.cs diff --git a/AlayaCore/Abstractions/Configuration/BaseConfig.cs b/AlayaCore/Abstractions/Configuration/BaseConfig.cs new file mode 100644 index 0000000..514b8a3 --- /dev/null +++ b/AlayaCore/Abstractions/Configuration/BaseConfig.cs @@ -0,0 +1,7 @@ +namespace AlayaCore.Abstractions.Configuration +{ + public class BaseConfig + { + + } +} \ No newline at end of file diff --git a/AlayaCore/Abstractions/Interfaces/IFileStore.cs b/AlayaCore/Abstractions/Interfaces/IFileStore.cs new file mode 100644 index 0000000..7c327ba --- /dev/null +++ b/AlayaCore/Abstractions/Interfaces/IFileStore.cs @@ -0,0 +1,7 @@ +namespace AlayaCore.Abstractions.Interfaces +{ + public interface IFileStore + { + + } +} \ No newline at end of file diff --git a/AlayaCore/Abstractions/Interfaces/Services/IAuthService.cs b/AlayaCore/Abstractions/Interfaces/Services/IAuthService.cs new file mode 100644 index 0000000..22e3ab2 --- /dev/null +++ b/AlayaCore/Abstractions/Interfaces/Services/IAuthService.cs @@ -0,0 +1,7 @@ +namespace AlayaCore.Abstractions.Interfaces.Services +{ + public interface IAuthService + { + + } +} \ No newline at end of file diff --git a/AlayaCore/Abstractions/Interfaces/Services/IGameInstallService.cs b/AlayaCore/Abstractions/Interfaces/Services/IGameInstallService.cs new file mode 100644 index 0000000..21aac07 --- /dev/null +++ b/AlayaCore/Abstractions/Interfaces/Services/IGameInstallService.cs @@ -0,0 +1,13 @@ +using System.Threading; +using System.Threading.Tasks; +using AlayaCore.Installation; +using AlayaCore.Models.Manifests; + +namespace AlayaCore.Abstractions.Interfaces.Services +{ + public interface IMinecraftService + { + Task EnsureMinecraftInstalledAsync(ManifestModel manifest, InstallEnvironment environment, CancellationToken cancellationToken); + Task EnsureNeoForgeInstalledAsync(ManifestModel manifest, InstallEnvironment environment, CancellationToken cancellationToken); + } +} \ No newline at end of file diff --git a/AlayaCore/Models/AlayaPath.cs b/AlayaCore/Models/AlayaPath.cs new file mode 100644 index 0000000..adb10bb --- /dev/null +++ b/AlayaCore/Models/AlayaPath.cs @@ -0,0 +1,7 @@ +namespace AlayaCore.Models +{ + public class AlayaPath + { + + } +} \ No newline at end of file diff --git a/AlayaCore/Models/Configuration/GameOptions.cs b/AlayaCore/Models/Configuration/GameOptions.cs new file mode 100644 index 0000000..5d9f142 --- /dev/null +++ b/AlayaCore/Models/Configuration/GameOptions.cs @@ -0,0 +1,7 @@ +namespace AlayaCore.Models.Configuration +{ + public class GameOptions + { + + } +} \ No newline at end of file diff --git a/AlayaCore/Services/AuthService.cs b/AlayaCore/Services/AuthService.cs new file mode 100644 index 0000000..00ded87 --- /dev/null +++ b/AlayaCore/Services/AuthService.cs @@ -0,0 +1,7 @@ +namespace AlayaCore.Services +{ + public class AuthService + { + + } +} \ No newline at end of file diff --git a/AlayaCore/Services/GameInstallService.cs b/AlayaCore/Services/GameInstallService.cs new file mode 100644 index 0000000..476edf0 --- /dev/null +++ b/AlayaCore/Services/GameInstallService.cs @@ -0,0 +1,7 @@ +namespace AlayaCore.Services +{ + public class GameInstallService + { + + } +} \ No newline at end of file diff --git a/AlayaCore/Services/GameLaunchService.cs b/AlayaCore/Services/GameLaunchService.cs new file mode 100644 index 0000000..d2686ad --- /dev/null +++ b/AlayaCore/Services/GameLaunchService.cs @@ -0,0 +1,7 @@ +namespace AlayaCore.Services +{ + public class GameLaunchService + { + + } +} \ No newline at end of file diff --git a/AlayaCore/Services/DownloadService.cs b/AlayaCore/Services/HttpDownloadService.cs similarity index 98% rename from AlayaCore/Services/DownloadService.cs rename to AlayaCore/Services/HttpDownloadService.cs index c703dc2..767fbc9 100644 --- a/AlayaCore/Services/DownloadService.cs +++ b/AlayaCore/Services/HttpDownloadService.cs @@ -106,8 +106,8 @@ namespace AlayaCore.Services bytesPerSecond: null, statusMessage: "Starting download...")); - using Stream responseStream = await response.Content.ReadAsStreamAsync(); - using FileStream fileStream = new FileStream( + await using Stream responseStream = await response.Content.ReadAsStreamAsync(); + await using FileStream fileStream = new FileStream( tempFilePath, FileMode.Create, FileAccess.Write, diff --git a/AlayaCore/Utilities/Enums/FolderLocation.cs b/AlayaCore/Utilities/Enums/FolderLocation.cs new file mode 100644 index 0000000..942304b --- /dev/null +++ b/AlayaCore/Utilities/Enums/FolderLocation.cs @@ -0,0 +1,7 @@ +namespace AlayaCore.Utilities.Enums +{ + public class FolderLocation + { + + } +} \ No newline at end of file diff --git a/AlayaCore/Utilities/Stores/LocalFileStore.cs b/AlayaCore/Utilities/Stores/LocalFileStore.cs new file mode 100644 index 0000000..caf2ac6 --- /dev/null +++ b/AlayaCore/Utilities/Stores/LocalFileStore.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.IO; +using AlayaCore.Abstractions.Interfaces; +using AlayaCore.Utilities.Enums; + +namespace AlayaCore.Utilities.Stores +{ + public class FileStore : IFileStore + { + private static readonly string _baseDirectory = AppContext.BaseDirectory; + private static readonly string _javaDirectory = Path.Combine(_baseDirectory, "Java"); + + private static readonly Dictionary _folders = new() + { + { FolderLocation.BaseDirectory, _baseDirectory }, + { FolderLocation.Java, _javaDirectory} + }; + + public string Get(FolderLocation location) + { + return _folders[location]; + } + } +} \ No newline at end of file