add reftag commandline argument
This commit is contained in:
@@ -48,17 +48,21 @@ public static class Extensions
|
||||
return @this.SourceUrl.Replace("{version}", version.ToString(3));
|
||||
}
|
||||
|
||||
public static string GetInstallUrl(this ModpackConfig @this)
|
||||
public static string GetInstallUrl(this ModpackConfig @this, string? overwriteRefTag = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(@this.RefTag))
|
||||
return @this.InstallUrl;
|
||||
return @this.InstallUrl.Replace("{ref}", @this.RefTag);
|
||||
if (!string.IsNullOrWhiteSpace(overwriteRefTag))
|
||||
return @this.InstallUrl.Replace("{ref}", overwriteRefTag);
|
||||
if (!string.IsNullOrWhiteSpace(@this.RefTag))
|
||||
return @this.InstallUrl.Replace("{ref}", @this.RefTag);
|
||||
return @this.InstallUrl;
|
||||
}
|
||||
|
||||
public static string GetUpdateUrl(this ModpackConfig @this)
|
||||
public static string GetUpdateUrl(this ModpackConfig @this, string? overwriteRefTag = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(@this.RefTag))
|
||||
return @this.UpdateUrl;
|
||||
return @this.UpdateUrl.Replace("{ref}", @this.RefTag);
|
||||
if (!string.IsNullOrWhiteSpace(overwriteRefTag))
|
||||
return @this.UpdateUrl.Replace("{ref}", overwriteRefTag);
|
||||
if (!string.IsNullOrWhiteSpace(@this.RefTag))
|
||||
return @this.UpdateUrl.Replace("{ref}", @this.RefTag);
|
||||
return @this.UpdateUrl;
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
|
||||
public delegate void CheckingProgressUpdatedEventHandler(int toCheck, int processed);
|
||||
|
||||
public ILogger Log { get; set; } = NullLogger.Instance;
|
||||
public string? OverwriteRefTag { get; set; }
|
||||
|
||||
private readonly HttpClient http = new();
|
||||
private readonly ModpackFactory factory = new();
|
||||
@@ -32,13 +33,13 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
|
||||
|
||||
private async Task<UpdateInfos> DownloadUpdateInfos()
|
||||
{
|
||||
var content = await http.GetStringAsync(updateConfig.GetUpdateUrl());
|
||||
var content = await http.GetStringAsync(updateConfig.GetUpdateUrl(overwriteRefTag: OverwriteRefTag));
|
||||
return UpdateInfos.Parse(content);
|
||||
}
|
||||
|
||||
private async Task<InstallInfos> DownloadInstallInfos()
|
||||
{
|
||||
var content = await http.GetStringAsync(updateConfig.GetInstallUrl());
|
||||
var content = await http.GetStringAsync(updateConfig.GetInstallUrl(overwriteRefTag: OverwriteRefTag));
|
||||
return InstallInfos.Parse(content);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user