mlaumcherb/Mlaumcherb.Client.Avalonia/сеть/TaskFactories/ModpackDownloadTaskFactory.cs
2025-01-05 22:19:56 +05:00

25 lines
862 B
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Mlaumcherb.Client.Avalonia.классы;
namespace Mlaumcherb.Client.Avalonia.сеть.TaskFactories;
public class ModpackDownloadTaskFactory : INetworkTaskFactory
{
INetworkTaskFactory _implementationVersion;
public ModpackDownloadTaskFactory(GameVersionDescriptor descriptor)
{
if(descriptor.modpack is null)
throw new ArgumentNullException(nameof(descriptor.modpack));
_implementationVersion = descriptor.modpack.format_version switch
{
2 => new MyModpackV2DownloadTaskFactory(descriptor),
_ => throw new Exception($"Unknown Modpack format_version: {descriptor.modpack.format_version}")
};
}
public Task<NetworkTask?> CreateAsync(bool checkHashes)
{
return _implementationVersion.CreateAsync(checkHashes);
}
}