Improved parsing of Appslist.txt for App Selection Form

This commit is contained in:
Raphire
2024-08-19 21:27:53 +02:00
parent 8871f69111
commit 50e92337ad

View File

@@ -165,23 +165,22 @@ function ShowAppSelectionForm {
}
# Go through appslist and add items one by one to the selectionBox
Foreach ($app in (Get-Content -Path $appsFile | Where-Object { $_ -notmatch '^\s*$' } )) {
Foreach ($app in (Get-Content -Path $appsFile | Where-Object { $_ -notmatch '^\s*$' -and $_ -notmatch '^# .*' -and $_ -notmatch '^# -* #' } )) {
$appChecked = $true
# Remove first # if it exists and set AppChecked to false
# Remove first # if it exists and set appChecked to false
if ($app.StartsWith('#')) {
$app = $app.TrimStart("#")
$appChecked = $false
}
# Remove any comments from the Appname
if (-not ($app.IndexOf('#') -eq -1)) {
$app = $app.Substring(0, $app.IndexOf('#'))
}
# Remove any remaining spaces from the Appname
if (-not ($app.IndexOf(' ') -eq -1)) {
$app = $app.Substring(0, $app.IndexOf(' '))
}
# Remove leading and trailing spaces and `*` characters from Appname
$app = $app.Trim()
$appString = $app.Trim('*')
# Make sure appString is not empty