From 9112d1e62b69b2ca09c912bdc9c9d5d9896508c1 Mon Sep 17 00:00:00 2001 From: Scighost Date: Tue, 30 May 2023 11:28:12 +0800 Subject: [PATCH] update release version info --- Starward.Core/Metadata/VersionRelease.cs | 41 ++++++++++++++++++++---- metadata.ps1 | 2 ++ 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/Starward.Core/Metadata/VersionRelease.cs b/Starward.Core/Metadata/VersionRelease.cs index 4a85001ad..3413e13a2 100644 --- a/Starward.Core/Metadata/VersionRelease.cs +++ b/Starward.Core/Metadata/VersionRelease.cs @@ -2,7 +2,7 @@ namespace Starward.Core.Metadata; -public class ReleaseVersion +public class ReleaseVersion : IJsonOnDeserialized { public string Version { get; set; } @@ -35,6 +35,9 @@ public class ReleaseVersion public string PortableHash { get; set; } + public string SeparatePrefix { get; set; } + + public List SeparateFiles { get; set; } @@ -42,6 +45,34 @@ public class ReleaseVersion public string ReleasePage => $"https://github.com/Scighost/Starward/releases/tag/{Version}"; + public void OnDeserialized() + { + if (SeparateFiles is not null) + { + string prefix; + if (string.IsNullOrWhiteSpace(SeparatePrefix)) + { +#if DEBUG || DEV + prefix = $"https://starward.scighost.com/release/separate_files/dev/"; +#else + prefix = $"https://starward.scighost.com/release/separate_files/"; +#endif + } + else + { + prefix = SeparatePrefix; + } + foreach (var file in SeparateFiles) + { + if (string.IsNullOrWhiteSpace(file.Url)) + { + file.Url = Path.Combine(prefix, file.Hash); + } + } + + } + } + } @@ -57,11 +88,7 @@ public class ReleaseFile public string Hash { get; set; } - [JsonIgnore] -#if DEBUG || DEV - public string Url => $"https://starward.scighost.com/release/separate_files/dev/{Hash}"; -#else - public string Url => $"https://starward.scighost.com/release/separate_files/{Hash}"; -#endif + + public string Url { get; set; } } \ No newline at end of file diff --git a/metadata.ps1 b/metadata.ps1 index a09f4754d..b3ebd90ac 100644 --- a/metadata.ps1 +++ b/metadata.ps1 @@ -45,10 +45,12 @@ $release = @{ Portable = "https://starward.scighost.com/release/package/$portableName" PortableSize = (Get-Item $portableFile).Length PortableHash = (Get-FileHash $portableFile).Hash + SeparatePrefix = "https://starward.scighost.com/release/separate_files/" }; if ($Dev) { $release.Portable = "https://starward.scighost.com/release/package/dev/$portableName"; + $release.SeparatePrefix = "https://starward.scighost.com/release/separate_files/dev/"; } Out-File -Path "$metadata/version_preview_$Architecture.json" -InputObject (ConvertTo-Json $release);