From d01d5deccaa76bd09816a4c4d17585d0de9d67be Mon Sep 17 00:00:00 2001 From: Esco Date: Tue, 6 Apr 2021 22:35:16 +0200 Subject: [PATCH] Update YamlCreate to Manifest v1.0.0 (#9583) * Add NZXT CAM v4.22.0 * Update YamlCreate to Manifest v1.0.0 * Hotfix + Fixed some strong script breaking typo last minute changes on ShortDescription... + YamlCreate can now be used anywhere * Revert "Add NZXT CAM v4.22.0" This reverts commit c181784da181c4601f4df36f375e9fc9e99904f0. * Revert "Revert "Add NZXT CAM v4.22.0"" This reverts commit 16c5afba3e288aba992262665b29fb3fe602e033. * Revert "Revert "Revert "Add NZXT CAM v4.22.0""" This reverts commit c0d5f8d6032dea1b4f3e0b1534ead60d6598d4f7. * Update YamlCreate.ps1 + Select menu + Function to only update version number, download url and hash * Added Prompt's for everything * Added support for new Locale * Fixed Tags miss value and added Extensions, Protocols and Commands * Moved Enter the URL to after old manifest check * Proper Tag, Protocol, FileExtension and Command limit * Increased some value limits * Update MullvadVPN manifest * Revert "Update MullvadVPN manifest" This reverts commit cc92e4993f4642712d33c44b033a413e3477f5fa. * Small Tweaks * Added Encoding? * Added Encoding for Update and NewLocale * Added ProductCode variable * Added ProductCode to Update switch * Moved Publisher and PackageName * Added Custom switch * Custom variable hotfix * Fixed another tiny bug.. --- Tools/YamlCreate.ps1 | 943 +++++++++++++++++++++++++++++++++---------- 1 file changed, 731 insertions(+), 212 deletions(-) diff --git a/Tools/YamlCreate.ps1 b/Tools/YamlCreate.ps1 index 486e34428..41309a9a1 100644 --- a/Tools/YamlCreate.ps1 +++ b/Tools/YamlCreate.ps1 @@ -31,32 +31,29 @@ filter TrimString { $_.Trim() } +while ([string]::IsNullOrWhiteSpace($OptionMenu)) { + Clear-Host + Write-Host -ForegroundColor 'Cyan' -Object 'Select Mode' + Write-Host -ForegroundColor 'DarkCyan' -NoNewline "`n["; Write-Host -NoNewline '1'; Write-Host -ForegroundColor DarkCyan -NoNewline "]"; ` + Write-Host -ForegroundColor 'DarkCyan' -Object ' New Manifest' + Write-Host -ForegroundColor 'DarkCyan' -NoNewline "`n["; Write-Host -NoNewline '2'; Write-Host -ForegroundColor DarkCyan -NoNewline "]"; ` + Write-Host -ForegroundColor 'DarkCyan' -Object ' Update Manifest' + Write-Host -ForegroundColor 'DarkCyan' -NoNewline "`n["; Write-Host -NoNewline '3'; Write-Host -ForegroundColor DarkCyan -NoNewline "]"; ` + Write-Host -ForegroundColor 'DarkCyan' -Object ' New Locale' + Write-Host -ForegroundColor 'DarkCyan' -NoNewline "`n["; Write-Host -NoNewline 'q'; Write-Host -ForegroundColor DarkCyan -NoNewline "]"; ` + Write-Host -ForegroundColor 'Red' -Object ' Any key to quit' + $OptionMenu = Read-Host "`nSelection" + switch ($OptionMenu) { + '1' {$Option = 'New'} + '2' {$Option = 'Update'} + '3' {$Option = 'NewLocale'} + default {exit} + } +} + ########################################## #region checksum -while ([string]::IsNullOrWhiteSpace($URL)) { - $URL = Read-Host -Prompt 'Enter the URL to the installer' | TrimString -} -Write-Host $NewLine -Write-Host "Downloading URL. This will take awhile..." -ForegroundColor Blue -$WebClient = New-Object System.Net.WebClient -try { - $Stream = $WebClient.OpenRead($URL) - $Hash = (Get-FileHash -InputStream $Stream -Algorithm SHA256).Hash -} -catch { - Write-Host "Error downloading file. Please run the script again." -ForegroundColor Red - exit 1 -} -finally { - $Stream.Close() -} - -Write-Host "Url: $URL" -Write-Host "Sha256: $Hash" - -Write-Host $NewLine -Write-Host "File downloaded. Please Fill out required fields." #endregion ########################################## @@ -64,199 +61,721 @@ Write-Host "File downloaded. Please Fill out required fields." ########################################## #region Read in metadata -while ($ID.Length -lt 4 -or $ID.Length -ge 255) { - Write-Host 'Enter the package Id, in the following format ' - $ID = Read-Host -Prompt 'For example: Microsoft.Excel' | TrimString +while ($PackageIdentifier.Length -lt 4 -or $ID.Length -ge 255) { + Write-Host + Write-Host -ForegroundColor 'Green' -Object ' [Required] Enter the Package Identifier, in the following format . For example: Microsoft.Excel' + $PackageIdentifier = Read-Host -Prompt 'PackageIdentifier' | TrimString + $PackageIdentifierFolder = $PackageIdentifier.Replace('.','\') } -$host.UI.RawUI.ForegroundColor = "White" -while ([string]::IsNullOrWhiteSpace($Publisher) -or $Publisher.Length -ge 128) { - $Publisher = Read-Host -Prompt 'Enter the publisher' | TrimString +while ([string]::IsNullOrWhiteSpace($PackageVersion) -or $PackageName.Length -ge 128) { + Write-Host + Write-Host -ForegroundColor 'Green' -Object '[Required] Enter the version. for example: 1.33.7' + $PackageVersion = Read-Host -Prompt 'Version' | TrimString } -while ([string]::IsNullOrWhiteSpace($AppName) -or $AppName.Length -ge 128) { - $AppName = Read-Host -Prompt 'Enter the application name' | TrimString - $AppNameFolder = $AppName -replace '\s','' +if (Test-Path -Path "$PSScriptRoot\..\manifests") { + $ManifestsFolder = (Resolve-Path "$PSScriptRoot\..\manifests").Path +} else { + $ManifestsFolder = (Resolve-Path ".\").Path } -while ([string]::IsNullOrWhiteSpace($version)) { - $version = Read-Host -Prompt 'Enter the version. For example: 1.0.0, 1.0.0.0, 1.0' | TrimString - $ManifestName = $version + ".yaml" +$AppFolder = Join-Path $ManifestsFolder $PackageIdentifier.ToLower().Chars(0) $PackageIdentifierFolder $PackageVersion + +$VersionManifest = $AppFolder + "\$PackageIdentifier" + '.yaml' +$InstallerManifest = $AppFolder + "\$PackageIdentifier" + '.installer' + '.yaml' +$DefaultLocaleManifest = $AppFolder + "\$PackageIdentifier" + '.locale.en-US' + '.yaml' + +switch ($Option) { + 'New' { + while ([string]::IsNullOrWhiteSpace($URL)) { + Write-Host + Write-Host -ForegroundColor 'Green' -Object '[Required] Enter the URL to the installer.' + $URL = Read-Host -Prompt 'URL' | TrimString + } + Write-Host $NewLine + Write-Host 'Downloading URL. This will take awhile...' -ForegroundColor Blue + $WebClient = New-Object System.Net.WebClient + + try { + $Stream = $WebClient.OpenRead($URL) + $Hash = (Get-FileHash -InputStream $Stream -Algorithm SHA256).Hash + } + catch { + Write-Host 'Error downloading file. Please run the script again.' -ForegroundColor Red + exit 1 + } + finally { + $Stream.Close() + } + + Write-Host "Url: $URL" + Write-Host "Sha256: $Hash" + + Write-Host $NewLine + Write-Host 'File downloaded. Please Fill out required fields.' + + ###################################### + # Collect Metadata # + ###################################### + # Installer Manifest # + while ([string]::IsNullOrWhiteSpace($Publisher) -or $Publisher.Length -ge 128) { + Write-Host + Write-Host -ForegroundColor 'Green' -Object '[Required] Enter the full publisher name. For example: Microsoft Corporation' + $Publisher = Read-Host -Prompt 'Publisher' | TrimString + } + + while ([string]::IsNullOrWhiteSpace($PackageName) -or $PackageName.Length -ge 128) { + Write-Host + Write-Host -ForegroundColor 'Green' -Object '[Required] Enter the full application name. For example: Microsoft Teams' + $PackageName = Read-Host -Prompt 'PackageName' | TrimString + } + + while ($architecture -notin @('x86', 'x64', 'arm', 'arm64', 'neutral')) { + Write-Host + Write-Host -ForegroundColor 'Green' -Object '[Required] Enter the architecture (x86, x64, arm, arm64, neutral)' + $architecture = Read-Host -Prompt 'Architecture' | TrimString + } + + while ($InstallerType -notin @('exe', 'msi', 'msix', 'inno', 'nullsoft', 'appx', 'wix', 'zip')) { + Write-Host + Write-Host -ForegroundColor 'Green' -Object '[Required] Enter the InstallerType. For example: exe, msi, msix, inno, nullsoft' + $InstallerType = Read-Host -Prompt 'InstallerType' | TrimString + } + + if ($InstallerType -ieq 'exe') { + while ([string]::IsNullOrWhiteSpace($Silent) -or ([string]::IsNullOrWhiteSpace($SilentWithProgress))) { + Write-Host + Write-Host -ForegroundColor 'Green' -Object '[Required] Enter the silent install switch. For example: /s, -verysilent /qn' + $Silent = Read-Host -Prompt 'Silent switch' | TrimString + + Write-Host + Write-Host -ForegroundColor 'Green' -Object '[Required] Enter the silent with progress install switch. For example: /s, -silent /qb' + $SilentWithProgress = Read-Host -Prompt 'Silent with progress switch' | TrimString + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter any custom switches for the installer. For example: -norestart' + $Custom = Read-Host -Prompt 'Custom Switch' | TrimString + } while ($Custom.Length -gt '2048') + } + } else { + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the silent install switch. For example: /s, -verysilent /qn' + $Silent = Read-Host -Prompt 'Silent' | TrimString + + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the silent with progress install switch. For example: /s, -silent /qb' + $SilentWithProgress = Read-Host -Prompt 'SilentWithProgress' | TrimString + + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter any custom switches for the installer. For example: -norestart' + $Custom = Read-Host -Prompt 'CustomSwitch' | TrimString + } while ($Silent.Length -gt '2048' -or $SilentWithProgress.Lenth -gt '512' -or $Custom.Length -gt '2048') + } + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the application product code. Looks like {CF8E6E00-9C03-4440-81C0-21FACB921A6B}' + $ProductCode = Read-Host -Prompt 'ProductCode' | TrimString + } while (-not [string]::IsNullOrWhiteSpace($ProductCode) -and ($ProductCode.Length -lt 1 -or $ProductCode.Length -gt 255)) + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the upgrade method. install or uninstallPrevious' + $UpgradeBehavior = Read-Host -Prompt 'UpgradeBehavior' | TrimString + } until ([string]::IsNullOrWhiteSpace($UpgradeBehavior) -or ($UpgradeBehavior -eq 'install' -or $UpgradeBehavior -eq 'uninstallPrevious')) + if ([string]::IsNullOrWhiteSpace($UpgradeBehavior)) { + $UpgradeBehavior = 'install' + } + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter any File Extensions the application could support. For example: html, htm, url (Max 256)' + $FileExtensions = Read-Host -Prompt 'FileExtensions' | TrimString + } while ($FileExtensions.Split(", ").Count -gt '256') + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter any Protocols the application provides a handler for. For example: http, https (Max 16)' + $Protocols = Read-Host -Prompt 'Protocols' | TrimString + } while ($Protocols.Split(", ").Count -gt '16') + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter any Commands or aliases to run the application. For example: msedge (Max 16)' + $Commands = Read-Host -Prompt 'Commands' | TrimString + } while ($Commands.Split(", ").Count -gt '16') + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the Installer Scope. machine or user' + $Scope = Read-Host -Prompt 'Scope' | TrimString + } until ([string]::IsNullOrWhiteSpace($Scope) -or ($Scope -eq 'machine' -or $Scope -eq 'user')) + + # DefaultLocale Manifest # + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the Moniker (friendly name/alias). For example: vscode' + $Moniker = Read-Host -Prompt 'Moniker' | TrimString + } while ($Moniker.Length -gt 40) + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the Publisher Url.' + $PublisherUrl = Read-Host -Prompt 'Publisher Url' | TrimString + } while (-not [string]::IsNullOrWhiteSpace($PublisherUrl) -and ($PublisherUrl.Length -lt 5 -or $LicenseUrl.Length -gt 2000)) + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the Publisher Support Url.' + $PublisherSupportUrl = Read-Host -Prompt 'Publisher Support Url' | TrimString + } while (-not [string]::IsNullOrWhiteSpace($PublisherSupportUrl) -and ($PublisherSupportUrl.Length -lt 5 -or $PublisherSupportUrl.Length -gt 2000)) + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the Publisher Privacy Url.' + $PrivacyUrl = Read-Host -Prompt 'Privacy Url' | TrimString + } while (-not [string]::IsNullOrWhiteSpace($PrivacyUrl) -and ($PrivacyUrl.Length -lt 5 -or $PrivacyUrl.Length -gt 2000)) + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the application Author.' + $Author = Read-Host -Prompt 'Author' | TrimString + } while (-not [string]::IsNullOrWhiteSpace($Author) -and ($Author.Length -lt 2 -or $Author.Length -gt 256)) + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the Url to the homepage of the application.' + $PackageUrl = Read-Host -Prompt 'Homepage' | TrimString + } while (-not [string]::IsNullOrWhiteSpace($PackageUrl) -and ($PackageUrl.Length -lt 5 -or $PackageUrl.Length -gt 2000)) + + while ([string]::IsNullOrWhiteSpace($License) -or $License.Length -ge 512) { + Write-Host + Write-Host -ForegroundColor 'Green' -Object '[Required] Enter the application License. For example: MIT, GPL, Freeware, Proprietary or Copyright (c) Microsoft Corporation' + $License = Read-Host -Prompt 'License' | TrimString + } + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the application License URL.' + $LicenseUrl = Read-Host -Prompt 'License URL' | TrimString + } while (-not [string]::IsNullOrWhiteSpace($LicenseUrl) -and ($LicenseUrl.Length -lt 10 -or $LicenseUrl.Length -gt 2000)) + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the application Copyright.' + $Copyright = Read-Host -Prompt 'Copyright' | TrimString + } while (-not [string]::IsNullOrWhiteSpace($Copyright) -and ($Copyright.Length -lt 5 -or $Copyright.Length -gt 512)) + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the application Copyright Url.' + $CopyrightUrl = Read-Host -Prompt 'CopyrightUrl' | TrimString + } while (-not [string]::IsNullOrWhiteSpace($CopyrightUrl) -and ($LicenseUrl.Length -lt 10 -or $LicenseUrl.Length -gt 2000)) + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter any tags that would be useful to discover this tool. For example: zip, c++ (Max 16)' + $Tags = Read-Host -Prompt 'Tags' | TrimString + } while ($Tags.Split(", ").Count -gt '16') + + while ([string]::IsNullOrWhiteSpace($ShortDescription) -or $ShortDescription.Length -gt '256') { + Write-Host + Write-Host -ForegroundColor 'Green' -Object '[Required] Enter a short description of the application.' + $ShortDescription = Read-Host -Prompt 'Short description' | TrimString + } + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter a long description of the application.' + $Description = Read-Host -Prompt 'Long Description' | TrimString + } while (-not [string]::IsNullOrWhiteSpace($Description) -and ($Description.Length -lt 3 -or $Description.Length -gt 10000)) + + ###################################### + # Create Manifests # + ###################################### + New-Item -ItemType "Directory" -Force -Path $AppFolder | Out-Null + + ###################################### + # VersionManifest # + ###################################### + Write-Output '# yaml-language-server: $schema=https://aka.ms/winget-manifest.version.1.0.0.schema.json' | Out-File $VersionManifest + Write-Output "PackageIdentifier: $PackageIdentifier" | Out-File $VersionManifest -Append + Write-Output "PackageVersion: $PackageVersion" | Out-File $VersionManifest -Append + Write-Output "DefaultLocale: en-US" | Out-File $VersionManifest -Append + Write-Output "ManifestType: version" | Out-File $VersionManifest -Append + Write-Output "ManifestVersion: 1.0.0" | Out-File $VersionManifest -Append + + $FileOldEncoding = Get-Content -Raw $VersionManifest + Remove-Item -Path $VersionManifest + $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False + [System.IO.File]::WriteAllLines($VersionManifest, $FileOldEncoding, $Utf8NoBomEncoding) + + Write-Host + Write-Host "Yaml file created: $VersionManifest" + + ###################################### + # InstallerManifest # + ###################################### + Write-Output '# yaml-language-server: $schema=https://aka.ms/winget-manifest.installer.1.0.0.schema.json' | Out-File $InstallerManifest + Write-Output "PackageIdentifier: $PackageIdentifier" | Out-File $InstallerManifest -Append + Write-Output "PackageVersion: $PackageVersion" | Out-File $InstallerManifest -Append + Write-Output "FileExtensions:" | Out-File $InstallerManifest -Append + if (-not [string]::IsNullOrWhiteSpace($FileExtensions)) { + foreach ($FileExtension in $FileExtensions.Split(", ")) { + Write-Output " - $FileExtension" | Out-File $InstallerManifest -Append + } + } else { + Write-Output "# - " | Out-File $InstallerManifest -Append + } + Write-Output "Protocols:" | Out-File $InstallerManifest -Append + if (-not [string]::IsNullOrWhiteSpace($Protocols)) { + foreach ($Protocol in $Protocols.Split(", ")) { + Write-Output " - $Protocol" | Out-File $InstallerManifest -Append + } + } else { + Write-Output "# - " | Out-File $InstallerManifest -Append + } + Write-Output "Commands:" | Out-File $InstallerManifest -Append + if (-not [string]::IsNullOrWhiteSpace($Commands)) { + foreach ($Command in $Commands.Split(", ")) { + Write-Output " - $Command" | Out-File $InstallerManifest -Append + } + } else { + Write-Output "# - " | Out-File $InstallerManifest -Append + } + Write-Output "MinimumOSVersion: 10.0.0.0" | Out-File $InstallerManifest -Append + Write-Output "InstallModes:" | Out-File $InstallerManifest -Append + Write-Output " - interactive" | Out-File $InstallerManifest -Append + Write-Output " - silent" | Out-File $InstallerManifest -Append + Write-Output " - silentWithProgress" | Out-File $InstallerManifest -Append + Write-Output "Installers:" | Out-File $InstallerManifest -Append + Write-Output " - Architecture: $architecture" | Out-File $InstallerManifest -Append + Write-Output " InstallerType: $InstallerType" | Out-File $InstallerManifest -Append + Write-Output " InstallerUrl: $URL" | Out-File $InstallerManifest -Append + Write-Output " InstallerSha256: $Hash" | Out-File $InstallerManifest -Append + + if (-not [string]::IsNullOrWhiteSpace($Scope)) { + Write-Output " Scope: $Scope" | Out-File $InstallerManifest -Append } else { Write-Output "# Scope: " | Out-File $InstallerManifest -Append + } + + Write-Output " InstallerLocale: en-US" | Out-File $InstallerManifest -Append + + if (-not [string]::IsNullOrWhiteSpace($ProductCode)) { + Write-Output " ProductCode: `"$ProductCode`"" | Out-File $InstallerManifest -Append } else { Write-Output "# ProductCode: " | Out-File $InstallerManifest -Append + } + + if ((-not [string]::IsNullOrWhiteSpace($Silent)) -or (-not [string]::IsNullOrWhiteSpace($SilentWithProgress))) { + Write-Output " InstallerSwitches:" | Out-File $InstallerManifest -Append + Write-Output " Custom: $Custom" | Out-File $InstallerManifest -Append + Write-Output " Silent: $Silent" | Out-File $InstallerManifest -Append + Write-Output " SilentWithProgress: $SilentWithProgress" | Out-File $InstallerManifest -Append + } + + Write-Output " UpgradeBehavior: $UpgradeBehavior" | Out-File $InstallerManifest -Append + Write-Output "ManifestType: installer" | Out-File $InstallerManifest -Append + Write-Output "ManifestVersion: 1.0.0" | Out-File $InstallerManifest -Append + + $FileOldEncoding = Get-Content -Raw $InstallerManifest + Remove-Item -Path $InstallerManifest + $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False + [System.IO.File]::WriteAllLines($InstallerManifest, $FileOldEncoding, $Utf8NoBomEncoding) + + Write-Host + Write-Host "Yaml file created: $InstallerManifest" + + ###################################### + # DefaultLocaleManifest # + ###################################### + Write-Output '# yaml-language-server: $schema=https://aka.ms/winget-manifest.defaultlocale.1.0.0.schema.json' | Out-File $DefaultLocaleManifest + Write-Output "PackageIdentifier: $PackageIdentifier" | Out-File $DefaultLocaleManifest -Append + Write-Output "PackageVersion: $PackageVersion" | Out-File $DefaultLocaleManifest -Append + Write-Output "PackageLocale: en-US" | Out-File $DefaultLocaleManifest -Append + + if (-not [string]::IsNullOrWhiteSpace($Publisher)) { + Write-Output "Publisher: $Publisher" | Out-File $DefaultLocaleManifest -Append + } else { + Write-Output "#Publisher: " | Out-File $DefaultLocaleManifest -Append + } + + if (-not [string]::IsNullOrWhiteSpace($PublisherUrl)) { + Write-Output "PublisherUrl: $PublisherUrl" | Out-File $DefaultLocaleManifest -Append + } else { + Write-Output "#PublisherUrl: " | Out-File $DefaultLocaleManifest -Append + } + + if (-not [string]::IsNullOrWhiteSpace($PublisherSupportUrl)) { + Write-Output "PublisherSupportUrl: $PublisherSupportUrl" | Out-File $DefaultLocaleManifest -Append + } else { + Write-Output "#PublisherSupportUrl: " | Out-File $DefaultLocaleManifest -Append + } + + if (-not [string]::IsNullOrWhiteSpace($PrivacyUrl)) { + Write-Output "PrivacyUrl: $PrivacyUrl" | Out-File $DefaultLocaleManifest -Append + } else { + Write-Output "#PrivacyUrl: " | Out-File $DefaultLocaleManifest -Append + } + + if (-not [string]::IsNullOrWhiteSpace($Author)) { + Write-Output "Author: $Author" | Out-File $DefaultLocaleManifest -Append + } else { + Write-Output "#Author: " | Out-File $DefaultLocaleManifest -Append + } + + Write-Output "PackageName: $PackageName" | Out-File $DefaultLocaleManifest -Append + + if (-not [string]::IsNullOrWhiteSpace($PackageUrl)) { + Write-Output "PackageUrl: $PackageUrl" | Out-File $DefaultLocaleManifest -Append + } else { + Write-Output "#PackageUrl: " | Out-File $DefaultLocaleManifest -Append + } + + if (-not [string]::IsNullOrWhiteSpace($License)) { + Write-Output "License: $License" | Out-File $DefaultLocaleManifest -Append + } else { + Write-Output "#License: " | Out-File $DefaultLocaleManifest -Append + } + + if (-not [string]::IsNullOrWhiteSpace($LicenseUrl)) { + Write-Output "LicenseUrl: $LicenseUrl" | Out-File $DefaultLocaleManifest -Append + } else { + Write-Output "#LicenseUrl: " | Out-File $DefaultLocaleManifest -Append + } + + if (-not [string]::IsNullOrWhiteSpace($Copyright)) { + Write-Output "Copyright: $Copyright" | Out-File $DefaultLocaleManifest -Append + } else { + Write-Output "#Copyright: " | Out-File $DefaultLocaleManifest -Append + } + + if (-not [string]::IsNullOrWhiteSpace($CopyrightUrl)) { + Write-Output "CopyrightUrl: $CopyrightUrl" | Out-File $DefaultLocaleManifest -Append + } else { + Write-Output "#CopyrightUrl: " | Out-File $DefaultLocaleManifest -Append + } + + Write-Output "ShortDescription: $ShortDescription" | Out-File $DefaultLocaleManifest -Append + + if (-not [string]::IsNullOrWhiteSpace($Description)) { + Write-Output "Description: $Description" | Out-File $DefaultLocaleManifest -Append + } else { + Write-Output "#Description: " | Out-File $DefaultLocaleManifest -Append + } + + if (-not [string]::IsNullOrWhiteSpace($Moniker)) { + Write-Output "Moniker: $Moniker" | Out-File $DefaultLocaleManifest -Append + } else { + Write-Output "#Moniker: " | Out-File $DefaultLocaleManifest -Append + } + + Write-Output "Tags:" | Out-File $DefaultLocaleManifest -Append + + if (-not [string]::IsNullOrWhiteSpace($Tags)) { + foreach ($Tag in $Tags.Split(", ")) { + Write-Output " - $Tag" | Out-File $DefaultLocaleManifest -Append + } + } else { + Write-Output "# - " | Out-File $DefaultLocaleManifest -Append + } + + Write-Output "ManifestType: defaultLocale" | Out-File $DefaultLocaleManifest -Append + Write-Output "ManifestVersion: 1.0.0" | Out-File $DefaultLocaleManifest -Append + + $FileOldEncoding = Get-Content -Raw $DefaultLocaleManifest + Remove-Item -Path $DefaultLocaleManifest + $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False + [System.IO.File]::WriteAllLines($DefaultLocaleManifest, $FileOldEncoding, $Utf8NoBomEncoding) + + Write-Host + Write-Host "Yaml file created: $DefaultLocaleManifest" + } + + 'Update' { + $LastVersion = Get-ChildItem -Path "$AppFolder\..\" | Sort-Object | Select-Object -Last 1 -ExpandProperty 'Name' + $OldManifests = Get-ChildItem -Path "$AppFolder\..\$LastVersion" + + if ($OldManifests.Name -eq "$PackageIdentifier.installer.yaml" -and $OldManifests.Name -eq "$PackageIdentifier.locale.en-US.yaml" -and $OldManifests.Name -eq "$PackageIdentifier.yaml") { + while ([string]::IsNullOrWhiteSpace($URL)) { + Write-Host + Write-Host -ForegroundColor 'Green' -Object '[Required] Enter the URL to the installer.' + $URL = Read-Host -Prompt 'URL' | TrimString + } + Write-Host $NewLine + Write-Host 'Downloading URL. This will take awhile...' -ForegroundColor Blue + $WebClient = New-Object System.Net.WebClient + + try { + $Stream = $WebClient.OpenRead($URL) + $Hash = (Get-FileHash -InputStream $Stream -Algorithm SHA256).Hash + } + catch { + Write-Host 'Error downloading file. Please run the script again.' -ForegroundColor Red + exit 1 + } + finally { + $Stream.Close() + } + + Write-Host "Url: $URL" + Write-Host "Sha256: $Hash" + + Write-Host + + New-Item -ItemType "Directory" -Force -Path $AppFolder | Out-Null + Copy-Item -Path $OldManifests -Destination $AppFolder + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the application product code. Looks like {CF8E6E00-9C03-4440-81C0-21FACB921A6B}' + $ProductCode = Read-Host -Prompt 'ProductCode' | TrimString + } while (-not [string]::IsNullOrWhiteSpace($ProductCode) -and ($ProductCode.Length -lt 1 -or $ProductCode.Length -gt 255)) + + if (-not [string]::IsNullOrWhiteSpace($ProductCode)) { + ((Get-Content -Path $InstallerManifest) -replace '(?<=ProductCode: ).*',"`"$ProductCode`"") | Set-Content -Path $InstallerManifest + } else { + ((Get-Content -Path $InstallerManifest) -replace '( ProductCode: ).*',"# ProductCode: ") | Set-Content -Path $InstallerManifest + } + + ((Get-Content -Path $VersionManifest) -replace '(?<=PackageVersion: ).*',"$PackageVersion") | Set-Content -Path $VersionManifest + ((Get-Content -Path $InstallerManifest) -replace '(?<=PackageVersion: ).*',"$PackageVersion") | Set-Content -Path $InstallerManifest + ((Get-Content -Path $DefaultLocaleManifest) -replace '(?<=PackageVersion: ).*',"$PackageVersion") | Set-Content -Path $DefaultLocaleManifest + + ((Get-Content -Path $InstallerManifest) -replace '(?<=InstallerUrl: ).*',"$URL") | Set-Content -Path $InstallerManifest + ((Get-Content -Path $InstallerManifest) -replace '(?<=InstallerSha256: ).*',"$Hash") | Set-Content -Path $InstallerManifest + + ((Get-Content -Path $InstallerManifest) -replace '(?<=ProductCode: ).*',"`"$ProductCode`"") | Set-Content -Path $InstallerManifest + + $FileOldEncoding = Get-Content -Raw $VersionManifest + Remove-Item -Path $VersionManifest + $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False + [System.IO.File]::WriteAllLines($VersionManifest, $FileOldEncoding, $Utf8NoBomEncoding) + + $FileOldEncoding = Get-Content -Raw $InstallerManifest + Remove-Item -Path $InstallerManifest + $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False + [System.IO.File]::WriteAllLines($InstallerManifest, $FileOldEncoding, $Utf8NoBomEncoding) + + $FileOldEncoding = Get-Content -Raw $DefaultLocaleManifest + Remove-Item -Path $DefaultLocaleManifest + $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False + [System.IO.File]::WriteAllLines($DefaultLocaleManifest, $FileOldEncoding, $Utf8NoBomEncoding) + + Write-Host + Write-Host "Updated Yaml file: $VersionManifest" + Write-Host "Updated Yaml file: $InstallerManifest" + Write-Host "Updated Yaml file: $DefaultLocaleManifest" + } else { + $option = "New" + Write-Host "Error: The old manifest does not contain a multi manifest." + } + } + + 'NewLocale' { + New-Item -ItemType "Directory" -Force -Path $AppFolder | Out-Null + ###################################### + # Create Manifests # + ###################################### + while ([string]::IsNullOrWhiteSpace($Publisher) -or $Publisher.Length -ge 128) { + Write-Host + Write-Host -ForegroundColor 'Green' -Object '[Required] Enter the full publisher name. For example: Microsoft Corporation' + $Publisher = Read-Host -Prompt 'Publisher' | TrimString + } + + while ([string]::IsNullOrWhiteSpace($PackageName) -or $PackageName.Length -ge 128) { + Write-Host + Write-Host -ForegroundColor 'Green' -Object '[Required] Enter the full application name. For example: Microsoft Teams' + $PackageName = Read-Host -Prompt 'PackageName' | TrimString + } + + while ([string]::IsNullOrWhiteSpace($PackageLocale) -or $PackageLocale.Length -ge 20) { + Write-Host + Write-Host -ForegroundColor 'Green' -Object '[Required] Enter the locale. For example: en-US, en-CA' + $PackageLocale = Read-Host -Prompt 'PackageLocale' | TrimString + + $NewLocaleManifest = $AppFolder + "\$PackageIdentifier" + ".locale.$PackageLocale" + '.yaml' + } + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the Publisher Url' + $PublisherUrl = Read-Host -Prompt 'Publisher Url' | TrimString + } while (-not [string]::IsNullOrWhiteSpace($PublisherUrl) -and ($PublisherUrl.Length -lt 5 -or $LicenseUrl.Length -gt 2000)) + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the Publisher Support Url' + $PublisherSupportUrl = Read-Host -Prompt 'Publisher Support Url' | TrimString + } while (-not [string]::IsNullOrWhiteSpace($PublisherSupportUrl) -and ($PublisherSupportUrl.Length -lt 5 -or $PublisherSupportUrl.Length -gt 2000)) + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the Privacy Url' + $PrivacyUrl = Read-Host -Prompt 'Privacy Url' | TrimString + } while (-not [string]::IsNullOrWhiteSpace($PrivacyUrl) -and ($PrivacyUrl.Length -lt 5 -or $PrivacyUrl.Length -gt 2000)) + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the Application Author' + $Author = Read-Host -Prompt 'Author' | TrimString + } while (-not [string]::IsNullOrWhiteSpace($Author) -and ($Author.Length -lt 1 -or $Author.Length -gt 256)) + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the Url to the homepage of the application.' + $PackageUrl = Read-Host -Prompt 'Homepage' | TrimString + } while (-not [string]::IsNullOrWhiteSpace($PackageUrl) -and ($PackageUrl.Length -lt 5 -or $PackageUrl.Length -gt 2000)) + + while ([string]::IsNullOrWhiteSpace($License) -or $License.Length -ge 512) { + Write-Host + Write-Host -ForegroundColor 'Green' -Object '[Required] Enter the application License. For example: MIT, GPL, Freeware, Proprietary or Copyright (c) Microsoft Corporation' + $License = Read-Host -Prompt 'License' | TrimString + } + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the application License URL.' + $LicenseUrl = Read-Host -Prompt 'License URL' | TrimString + } while (-not [string]::IsNullOrWhiteSpace($LicenseUrl) -and ($LicenseUrl.Length -lt 10 -or $LicenseUrl.Length -gt 2000)) + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the application Copyright' + $Copyright = Read-Host -Prompt 'Copyright' | TrimString + } while (-not [string]::IsNullOrWhiteSpace($Copyright) -and ($Copyright.Length -lt 5 -or $Copyright.Length -gt 512)) + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter the application Copyright Url' + $CopyrightUrl = Read-Host -Prompt 'CopyrightUrl' | TrimString + } while (-not [string]::IsNullOrWhiteSpace($CopyrightUrl) -and ($LicenseUrl.Length -lt 10 -or $LicenseUrl.Length -gt 2000)) + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter any tags that would be useful to discover this tool. For example: zip, c++ (Max 16)' + $Tags = Read-Host -Prompt 'Tags' | TrimString + } while ($Tags.Split(", ").Count -gt '16') + + while ([string]::IsNullOrWhiteSpace($ShortDescription) -or $ShortDescription.Length -gt '256') { + Write-Host + Write-Host -ForegroundColor 'Green' -Object '[Required] Enter a short description of the application.' + $ShortDescription = Read-Host -Prompt 'Short description' | TrimString + } + + do { + Write-Host + Write-Host -ForegroundColor 'Yellow' -Object '[Optional] Enter a long description of the application.' + $Description = Read-Host -Prompt 'Long Description' | TrimString + } while (-not [string]::IsNullOrWhiteSpace($Description) -and ($Description.Length -lt 10 -or $Description.Length -gt 10000)) + + ###################################### + # Locale Manifests # + ###################################### + Write-Output '# yaml-language-server: $schema=https://aka.ms/winget-manifest.locale.1.0.0.schema.json' | Out-File $NewLocaleManifest + Write-Output "PackageIdentifier: $PackageIdentifier" | Out-File $NewLocaleManifest -Append + Write-Output "PackageVersion: $PackageVersion" | Out-File $NewLocaleManifest -Append + Write-Output "PackageLocale: $PackageLocale" | Out-File $NewLocaleManifest -Append + + if (-not [string]::IsNullOrWhiteSpace($Publisher)) { + Write-Output "Publisher: $Publisher" | Out-File $NewLocaleManifest -Append + } else { + Write-Output "#Publisher: " | Out-File $NewLocaleManifest -Append + } + + if (-not [string]::IsNullOrWhiteSpace($PublisherUrl)) { + Write-Output "PublisherUrl: $PublisherUrl" | Out-File $NewLocaleManifest -Append + } else { + Write-Output "#PublisherUrl: " | Out-File $NewLocaleManifest -Append + } + + if (-not [string]::IsNullOrWhiteSpace($PublisherSupportUrl)) { + Write-Output "PublisherSupportUrl: $PublisherSupportUrl" | Out-File $NewLocaleManifest -Append + } else { + Write-Output "#PublisherSupportUrl: " | Out-File $NewLocaleManifest -Append + } + + if (-not [string]::IsNullOrWhiteSpace($PrivacyUrl)) { + Write-Output "PrivacyUrl: $PrivacyUrl" | Out-File $NewLocaleManifest -Append + } else { + Write-Output "#PrivacyUrl: " | Out-File $NewLocaleManifest -Append + } + + if (-not [string]::IsNullOrWhiteSpace($Author)) { + Write-Output "Author: $Author" | Out-File $NewLocaleManifest -Append + } else { + Write-Output "#Author: " | Out-File $NewLocaleManifest -Append + } + + Write-Output "PackageName: $PackageName" | Out-File $NewLocaleManifest -Append + + if (-not [string]::IsNullOrWhiteSpace($PackageUrl)) { + Write-Output "PackageUrl: $PackageUrl" | Out-File $NewLocaleManifest -Append + } else { + Write-Output "#PackageUrl: " | Out-File $NewLocaleManifest -Append + } + + if (-not [string]::IsNullOrWhiteSpace($License)) { + Write-Output "License: $License" | Out-File $NewLocaleManifest -Append + } else { + Write-Output "#License: " | Out-File $NewLocaleManifest -Append + } + + if (-not [string]::IsNullOrWhiteSpace($LicenseUrl)) { + Write-Output "LicenseUrl: $LicenseUrl" | Out-File $NewLocaleManifest -Append + } else { + Write-Output "#LicenseUrl: " | Out-File $NewLocaleManifest -Append + } + + if (-not [string]::IsNullOrWhiteSpace($Copyright)) { + Write-Output "Copyright: $Copyright" | Out-File $NewLocaleManifest -Append + } else { + Write-Output "#Copyright: " | Out-File $NewLocaleManifest -Append + } + + if (-not [string]::IsNullOrWhiteSpace($CopyrightUrl)) { + Write-Output "CopyrightUrl: $CopyrightUrl" | Out-File $NewLocaleManifest -Append + } else { + Write-Output "#CopyrightUrl: " | Out-File $NewLocaleManifest -Append + } + + Write-Output "ShortDescription: $ShortDescription" | Out-File $NewLocaleManifest -Append + + if (-not [string]::IsNullOrWhiteSpace($Description)) { + Write-Output "Description: $Description" | Out-File $NewLocaleManifest -Append + } else { + Write-Output "#Description: " | Out-File $NewLocaleManifest -Append + } + + if (-not [string]::IsNullOrWhiteSpace($Moniker)) { + Write-Output "Moniker: $Moniker" | Out-File $NewLocaleManifest -Append + } else { + Write-Output "#Moniker: " | Out-File $NewLocaleManifest -Append + } + + Write-Output "Tags:" | Out-File $NewLocaleManifest -Append + + if (-not [string]::IsNullOrWhiteSpace($Tags)) { + foreach ($Tag in $Tags.Split(", ")) { + Write-Output " - $Tag" | Out-File $NewLocaleManifest -Append + } + } else { + Write-Output "# - " | Out-File $NewLocaleManifest -Append + } + + Write-Output "ManifestType: locale" | Out-File $NewLocaleManifest -Append + Write-Output "ManifestVersion: 1.0.0" | Out-File $NewLocaleManifest -Append + + $FileOldEncoding = Get-Content -Raw $NewLocaleManifest + Remove-Item -Path $NewLocaleManifest + $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False + [System.IO.File]::WriteAllLines($NewLocaleManifest, $FileOldEncoding, $Utf8NoBomEncoding) + + Write-Host + Write-Host "Yaml file created: $NewLocaleManifest" + } + + Default { + Exit + } } - -while ([string]::IsNullOrWhiteSpace($License) -or $License.Length -ge 40) { - $License = Read-Host -Prompt 'Enter the License, For example: MIT, or Copyright (c) Microsoft Corporation' | TrimString -} - -while ($InstallerType -notin @("exe", "msi", "msix", "inno", "nullsoft", "appx", "wix", "zip")) { - $InstallerType = Read-Host -Prompt 'Enter the InstallerType. For example: exe, msi, msix, inno, nullsoft' -} - -while ($architecture -notin @("x86", "x64", "arm", "arm64", "neutral")) { - $architecture = Read-Host -Prompt 'Enter the architecture (x86, x64, arm, arm64, Neutral)' -} - -do { - $LicenseUrl = Read-Host -Prompt '[OPTIONAL] Enter the license URL' | TrimString -} while (-not [string]::IsNullOrWhiteSpace($LicenseUrl) -and ($LicenseUrl.Length -lt 10 -or $LicenseUrl.Length -gt 2000)) - -do { - $AppMoniker = Read-Host -Prompt '[OPTIONAL] Enter the AppMoniker (friendly name/alias). For example: vscode' | TrimString -} while ($AppMoniker.Length -gt 40) - -do { - $Tags = Read-Host -Prompt '[OPTIONAL] Enter any tags that would be useful to discover this tool. For example: zip, c++' | TrimString -} while ($Tags.Length -gt 40) - -do { - $Homepage = Read-Host -Prompt '[OPTIONAL] Enter the Url to the homepage of the application' | TrimString -} while (-not [string]::IsNullOrWhiteSpace($LicenseUrl) -and ($Homepage.Length -lt 10 -or $Homepage.Length -gt 2000)) - -do { - $Description = Read-Host -Prompt '[OPTIONAL] Enter a description of the application' | TrimString -} while ($Description.Length -gt 500) - -# Only prompt for silent switches if $InstallerType is "exe" -if ($InstallerType -ieq "exe") { - $Silent = Read-Host -Prompt '[OPTIONAL] Enter the silent install switch'| TrimString - $SilentWithProgress = Read-Host -Prompt '[OPTIONAL] Enter the silent (with progress) install switch'| TrimString -} - -#endregion -########################################## - -########################################## -#region Write metadata - -# YAML files should always start with the document start separator "---" -# https://yaml.org/spec/1.2/spec.html#id2760395 -$string = "---$NewLine" -Write-Output $string | Out-File $ManifestName - -Write-Host $NewLine -$string = "Id: $ID" -Write-Output $string | Out-File $ManifestName -Append -Write-Host "Id: " -ForegroundColor Blue -NoNewline -Write-Host $ID -ForegroundColor White - -$string = "Version: $Version" -Write-Output $string | Out-File $ManifestName -Append -Write-Host "Version: " -ForegroundColor Blue -NoNewline -Write-Host $Version -ForegroundColor White - -$string = "Name: $AppName" -Write-Output $string | Out-File $ManifestName -Append -Write-Host "Name: " -ForegroundColor Blue -NoNewline -Write-Host $AppName -ForegroundColor White - -$string = "Publisher: $Publisher" -Write-Output $string | Out-File $ManifestName -Append -Write-Host "Publisher: " -ForegroundColor Blue -NoNewline -Write-Host $Publisher -ForegroundColor White - -$string = "License: $License" -Write-Output $string | Out-File $ManifestName -Append -Write-Host "License: " -ForegroundColor Blue -NoNewline -Write-Host $License -ForegroundColor White - -if (-not [string]::IsNullOrWhiteSpace($LicenseUrl)) { - $string = "LicenseUrl: $LicenseUrl" - Write-Output $string | Out-File $ManifestName -Append - Write-Host "LicenseUrl: " -ForegroundColor Blue -NoNewline - Write-Host $LicenseUrl -ForegroundColor White -} - -if (-not [string]::IsNullOrWhiteSpace($AppMoniker)) { - $string = "AppMoniker: $AppMoniker" - Write-Output $string | Out-File $ManifestName -Append - Write-Host "AppMoniker: " -ForegroundColor Blue -NoNewline - Write-Host $AppMoniker -ForegroundColor White -} - -if (-not [string]::IsNullOrWhiteSpace($Commands)) { - $string = "Commands: $Commands" - Write-Output $string | Out-File $ManifestName -Append - Write-Host "Commands: " -ForegroundColor Blue -NoNewline - Write-Host $Commands -ForegroundColor White -} - -if (-not [string]::IsNullOrWhiteSpace($Tags)) { - $string = "Tags: $Tags" - Write-Output $string | Out-File $ManifestName -Append - Write-Host "Tags: " -ForegroundColor Blue -NoNewline - Write-Host $Tags -ForegroundColor White -} - -if (-not [string]::IsNullOrWhiteSpace($Description)) { - $string = "Description: $Description" - Write-Output $string | Out-File $ManifestName -Append - Write-Host "Description: " -ForegroundColor Blue -NoNewline - Write-Host $Description -ForegroundColor White -} - -if (-not [string]::IsNullOrWhiteSpace($Homepage)) { - $string = "Homepage: $Homepage" - Write-Output $string | Out-File $ManifestName -Append - Write-Host "Homepage: " -ForegroundColor Blue -NoNewline - Write-Host $Homepage -ForegroundColor White -} - -Write-Output "Installers:" | Out-File $ManifestName -Append - -$string = " - Arch: $architecture" -Write-Output $string | Out-File $ManifestName -Append -Write-Host "Arch: " -ForegroundColor Blue -NoNewline -Write-Host $architecture -ForegroundColor White - -$string = " Url: $URL" -Write-Output $string | Out-File $ManifestName -Append -Write-Host "Url: " -ForegroundColor Blue -NoNewline -Write-Host $URL -ForegroundColor White - -$string = " Sha256: $Hash" -Write-Output $string | Out-File $ManifestName -Append -Write-Host "Sha256: " -ForegroundColor Blue -NoNewline -Write-Host $Hash -ForegroundColor White - -$string = " InstallerType: $InstallerType" -Write-Output $string | Out-File $ManifestName -Append -Write-Host "InstallerType: " -ForegroundColor Blue -NoNewline -Write-Host $InstallerType -ForegroundColor White - -if ((-not [string]::IsNullOrWhiteSpace($Silent)) -or - (-not [string]::IsNullOrWhiteSpace($SilentWithProgress))) { - $string = " Switches:" - Write-Output $string | Out-File $ManifestName -Append - Write-Host "Switches: " -ForegroundColor Blue -NoNewline -} - -if (-not [string]::IsNullOrWhiteSpace($Silent)) { - $string = " Silent: $Silent" - Write-Output $string | Out-File $ManifestName -Append - Write-Host "Silent: " -ForegroundColor Blue -NoNewline - Write-Host $Silent -ForegroundColor White -} - -if (-not [string]::IsNullOrWhiteSpace($SilentWithProgress)) { - $string = " SilentWithProgress: $SilentWithProgress" - Write-Output $string | Out-File $ManifestName -Append - Write-Host "SilentWithProgress: " -ForegroundColor Blue -NoNewline - Write-Host $SilentWithProgress -ForegroundColor White -} - -$ManifestsFolder = (Resolve-Path "$PSScriptRoot\..\manifests").Path -$PublisherFolder = Join-Path $ManifestsFolder $Publisher -$AppFolder = Join-Path $PublisherFolder $AppNameFolder -New-Item -ItemType "Directory" -Force -Path $AppFolder | Out-Null - -$FileOldEncoding = Get-Content -Raw $ManifestName -Remove-Item -Path $ManifestName -$ManifestPath = Join-Path $AppFolder $ManifestName -$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False -[System.IO.File]::WriteAllLines($ManifestPath, $FileOldEncoding, $Utf8NoBomEncoding) - -Write-Host $NewLine -Write-Host "Yaml file created: $ManifestPath" - -#endregion -##########################################