add reftag commandline argument

This commit is contained in:
2025-04-21 20:50:16 +02:00
parent 70805083ba
commit 01fc5606cb
3 changed files with 17 additions and 10 deletions

View File

@@ -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;
}
}