Skip to content

Commit

Permalink
Move the Xaml Generation of the panels to the main script
Browse files Browse the repository at this point in the history
  • Loading branch information
Marterich committed Jun 18, 2024
1 parent 827398b commit 225441b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
24 changes: 8 additions & 16 deletions Compile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -71,29 +71,21 @@ Get-ChildItem .\config | Where-Object {$PSItem.Extension -eq ".cfg"} | ForEach-O
$script_content.Add($(Write-output "`$sync.configs.$($psitem.BaseName) = '$(Get-Content $PSItem.FullName)'"))
}

Write-Progress -Activity "Compiling" -Status "Writing xaml"
$xaml = (Get-Content .\xaml\inputXML.xaml).replace("'","''")

# Dot-source the Get-TabXaml function
. .\functions\private\Get-TabXaml.ps1

Write-Progress -Activity "Compiling" -Status "Building: Xaml " -PercentComplete 75
$appXamlContent = Get-TabXaml "applications" 5
$tweaksXamlContent = Get-TabXaml "tweaks"
$featuresXamlContent = Get-TabXaml "feature"


Write-Progress -Activity "Compiling" -Status "Adding: Xaml " -PercentComplete 90
# Replace the placeholder in $inputXML with the content of inputApp.xaml
$xaml = $xaml -replace "{{InstallPanel_applications}}", $appXamlContent
$xaml = $xaml -replace "{{InstallPanel_tweaks}}", $tweaksXamlContent
$xaml = $xaml -replace "{{InstallPanel_features}}", $featuresXamlContent

$script_content.Add($(Write-output "`$inputXML = '$xaml'"))

$script_content.Add($(Get-Content .\scripts\main.ps1))

if ($Debug){
Write-Progress -Activity "Compiling" -Status "Writing debug files" -PercentComplete 95
# Dot-source the Get-TabXaml function
. .\functions\private\Get-TabXaml.ps1

$appXamlContent = Get-TabXaml "applications" 5
$tweaksXamlContent = Get-TabXaml "tweaks"
$featuresXamlContent = Get-TabXaml "feature"

$appXamlContent | Out-File -FilePath ".\xaml\inputApp.xaml" -Encoding ascii
$tweaksXamlContent | Out-File -FilePath ".\xaml\inputTweaks.xaml" -Encoding ascii
$featuresXamlContent | Out-File -FilePath ".\xaml\inputFeatures.xaml" -Encoding ascii
Expand Down
9 changes: 9 additions & 0 deletions scripts/main.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ $sync.runspace.Open()

$inputXML = $inputXML -replace 'mc:Ignorable="d"', '' -replace "x:N", 'N' -replace '^<Win.*', '<Window'

# Dynamically Generate the xaml code for the different panels at Runtime
$appXamlContent = Get-TabXaml "applications" 5
$tweaksXamlContent = Get-TabXaml "tweaks"
$featuresXamlContent = Get-TabXaml "feature"

$inputXML = $inputXML -replace "{{InstallPanel_applications}}", $appXamlContent
$inputXML = $inputXML -replace "{{InstallPanel_tweaks}}", $tweaksXamlContent
$inputXML = $inputXML -replace "{{InstallPanel_features}}", $featuresXamlContent

if ((Get-WinUtilToggleStatus WPFToggleDarkMode) -eq $True) {
if (Invoke-WinUtilGPU -eq $True) {
$ctttheme = 'Matrix'
Expand Down

0 comments on commit 225441b

Please sign in to comment.