You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
983 B
29 lines
983 B
using StabilityMatrix.Core.Models.Packages; |
|
using StabilityMatrix.Core.Models.Progress; |
|
|
|
namespace StabilityMatrix.Core.Models.PackageModification; |
|
|
|
public class InstallPackageStep : IPackageStep |
|
{ |
|
private readonly BasePackage package; |
|
private readonly TorchVersion torchVersion; |
|
private readonly string installPath; |
|
|
|
public InstallPackageStep(BasePackage package, TorchVersion torchVersion, string installPath) |
|
{ |
|
this.package = package; |
|
this.torchVersion = torchVersion; |
|
this.installPath = installPath; |
|
} |
|
|
|
public async Task ExecuteAsync(IProgress<ProgressReport>? progress = null) |
|
{ |
|
package.ConsoleOutput += (sender, output) => |
|
{ |
|
progress?.Report(new ProgressReport { IsIndeterminate = true, Message = output.Text }); |
|
}; |
|
await package.InstallPackage(installPath, torchVersion, progress).ConfigureAwait(false); |
|
} |
|
|
|
public string ProgressTitle => "Installing package..."; |
|
}
|
|
|