Skip to content

Commit

Permalink
change applications.json to powershell object list and refactor UI Cr…
Browse files Browse the repository at this point in the history
…eation logic
  • Loading branch information
Marterich committed Oct 10, 2024
1 parent 14584ce commit a8da4db
Show file tree
Hide file tree
Showing 4 changed files with 1,095 additions and 817 deletions.
12 changes: 1 addition & 11 deletions Compile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,11 @@ Get-ChildItem "config" | Where-Object {$psitem.extension -eq ".json"} | ForEach-
$json = (Get-Content $psitem.FullName).replace("'","''")
$jsonAsObject = $json | convertfrom-json

# Add 'WPFInstall' as a prefix to every entry-name in 'applications.json' file
if ($psitem.Name -eq "applications.json") {
foreach ($appEntryName in $jsonAsObject.PSObject.Properties.Name) {
$appEntryContent = $jsonAsObject.$appEntryName
$jsonAsObject.PSObject.Properties.Remove($appEntryName)
$jsonAsObject | Add-Member -MemberType NoteProperty -Name "WPFInstall$appEntryName" -Value $appEntryContent
}
}

# The replace at the end is required, as without it the output of 'converto-json' will be somewhat weird for Multiline Strings
# Most Notably is the scripts in some json files, making it harder for users who want to review these scripts, which're found in the compiled script
$json = ($jsonAsObject | convertto-json -Depth 3).replace('\r\n',"`r`n")

$sync.configs.$($psitem.BaseName) = $json | convertfrom-json
$script_content.Add($(Write-output "`$sync.configs.$($psitem.BaseName) = '$json' `| convertfrom-json" ))
$script_content.Add($(Write-output "`$sync.configs.$($psitem.BaseName) = '$json' | ConvertFrom-Json"))
}

# Read the entire XAML file as a single string, preserving line breaks
Expand Down
Loading

0 comments on commit a8da4db

Please sign in to comment.