add support for {ref} placeholder
This commit is contained in:
@@ -47,4 +47,18 @@ public static class Extensions
|
||||
return @this.SourceUrl;
|
||||
return @this.SourceUrl.Replace("{version}", version.ToString(3));
|
||||
}
|
||||
|
||||
public static string GetInstallUrl(this ModpackConfig @this)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(@this.RefTag))
|
||||
return @this.InstallUrl;
|
||||
return @this.InstallUrl.Replace("{ref}", @this.RefTag);
|
||||
}
|
||||
|
||||
public static string GetUpdateUrl(this ModpackConfig @this)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(@this.RefTag))
|
||||
return @this.UpdateUrl;
|
||||
return @this.UpdateUrl.Replace("{ref}", @this.RefTag);
|
||||
}
|
||||
}
|
||||
@@ -32,13 +32,13 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
|
||||
|
||||
private async Task<UpdateInfos> DownloadUpdateInfos()
|
||||
{
|
||||
var content = await http.GetStringAsync(updateConfig.UpdateUrl);
|
||||
var content = await http.GetStringAsync(updateConfig.GetUpdateUrl());
|
||||
return UpdateInfos.Parse(content);
|
||||
}
|
||||
|
||||
private async Task<InstallInfos> DownloadInstallInfos()
|
||||
{
|
||||
var content = await http.GetStringAsync(updateConfig.InstallUrl);
|
||||
var content = await http.GetStringAsync(updateConfig.GetInstallUrl());
|
||||
return InstallInfos.Parse(content);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ public class ModpackConfig
|
||||
public string UnleashInstanceId { get; set; }
|
||||
public bool PreferDirectLinks { get; set; }
|
||||
public string MinecraftVersion { get; set; }
|
||||
public string RefTag { get; set; }
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public ModLoader ModLoader { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user