-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathmodify-previewManifest.ps1
42 lines (31 loc) · 1.28 KB
/
modify-previewManifest.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
$manifestPath = "Natsurainko.FluentLauncher\Package-Preview.appxmanifest"
$absoluteManifestPath = Resolve-Path -Path $manifestPath
[xml]$xmlContent = Get-Content -Path $manifestPath
$version = $xmlContent.Package.Identity.Version
Write-Output "Stable Identity.Version: $version"
$url = "https://github.com/Xcube-Studio/FluentLauncher.PreviewChannel.PackageInstaller/releases/download/v0.0.2/PackageInstaller-x64.exe"
$installerPath = "PackageInstaller-64.exe"
$ErrorActionPreference = "Stop"
$ErrorVariable = "DownloadError"
try {
Invoke-WebRequest -Uri $url -OutFile $installerPath -ErrorAction Stop -ErrorVariable DownloadError
Write-Output "File downloaded successfully to $installerPath"
} catch {
Write-Error "Download failed: $($DownloadError[0])"
exit 1
}
$output = & .\$installerPath query --getBuildCountOfVersion $version
if ($output -match "BuildCount: (\d+)") {
$build = $matches[1]
Write-Output "BuildCount: $build"
$build = [int]$build + 1
$versionParts = $version.Split('.')
$versionParts[-1] = $build
$newVersion = $versionParts -join '.'
Write-Output "New Version: $newVersion"
} else {
Write-Error "Failed to retrieve BuildCount."
exit 1
}
$xmlContent.Package.Identity.Version = $newVersion
$xmlContent.Save($absoluteManifestPath)