Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.IO.Abstractions;
using WheelWizard.CustomDistributions.Domain;
using WheelWizard.Shared.Services;

namespace WheelWizard.CustomDistributions;

public interface ICustomDistributionSingletonService
{
List<IDistribution> GetAllDistributions();
RetroRewind RetroRewind { get; }
}

public class CustomDistributionSingletonService : ICustomDistributionSingletonService
{
public IFileSystem FileSystem { get; }
public RetroRewind RetroRewind { get; }

public CustomDistributionSingletonService(IFileSystem fileSystem, IApiCaller<IRetroRewindApi> api)
{
FileSystem = fileSystem;
RetroRewind = new RetroRewind(fileSystem, api);
}

public List<IDistribution> GetAllDistributions()
{
return [RetroRewind];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Refit;
using WheelWizard.CustomDistributions.Domain;
using WheelWizard.Services;

namespace WheelWizard.CustomDistributions;

public static class CustomDistributionsExtentions
{
public static IServiceCollection AddCustomDistributionService(this IServiceCollection services)
{
services.AddWhWzRefitApi<IRetroRewindApi>(Endpoints.RRUrl);

services.AddSingleton<ICustomDistributionSingletonService, CustomDistributionSingletonService>();
return services;
}
}
18 changes: 18 additions & 0 deletions WheelWizard/Features/CustomDistributions/Domain/RetroRewindApi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Refit;

namespace WheelWizard.CustomDistributions.Domain;

public interface IRetroRewindApi
{
[Get("/RetroRewind/RetroRewind.zip")]
Task<HttpContent> DownloadRetroRewindZip();

[Get("/RetroRewind/RetroRewindVersion.txt")]
Task<string> GetVersionFile();

[Get("/RetroRewind/RetroRewindDelete.txt")]
Task<string> GetDeletionFile();

[Get("/")]
Task<string> Ping(); // use to test server reachability
}
38 changes: 38 additions & 0 deletions WheelWizard/Features/CustomDistributions/IDistribution.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Semver;
using WheelWizard.Models.Enums;
using WheelWizard.Views.Popups.Generic;

namespace WheelWizard.CustomDistributions;

//todo: we cannot make more distributions before we also write a mystuff service and a service to download using UI

public interface IDistribution
{
/// <summary>
/// The title of the given distribution.
/// </summary>
public string Title { get; }

/// <summary>
/// The name of the primary folder where the distribution is installed within the wheelwizard folder.
/// </summary>
string FolderName { get; }

/// <summary>
/// Install the distribution.
/// </summary>
Task<OperationResult> InstallAsync(ProgressWindow progressWindow);

/// <summary>
/// Update the distribution.
/// </summary>
Task<OperationResult> UpdateAsync(ProgressWindow progressWindow);

Task<OperationResult> RemoveAsync(ProgressWindow progressWindow);

Task<OperationResult> ReinstallAsync(ProgressWindow progressWindow);

Task<OperationResult<WheelWizardStatus>> GetCurrentStatusAsync();

SemVersion? GetCurrentVersion();
}
Loading
Loading