$currentDir = $MyInvocation.MyCommand.Definition | Split-Path -Parent
$outFile = "{0}\ToggleButtonsGenerator.txt"-f $currentDir
if (Test-Path -Path $outFile) {
Remove-Item -Path $outFile -Force -Confirm:$false
Write-Warning -Message "File ""ToggleButtonsGenerator.txt"" deleted!"
}
"Privacy", "Ui", "System", "Edge", "Game", "Task", "Defender", "Menu" | ForEach-Object {
$categoryName = $_
$categoryFile = "{0}\Settings-{1}-Eng.txt"-f $currentDir, $categoryName
if (Test-Path -Path $categoryFile) {
#region Write Header
@"
######################### $categoryName #########################
"@ | Out-File -FilePath $outFile -Append
#endregion Write Header
$text = Get-Content -Path $categoryFile
for ($i = 0; $i -lt $text.Count; $i++) {
$string = $text[$i]
if ($string.Contains("""")) {
$string = $text[$i].Replace("""", """)
}
if ($string.Contains("&")) {
$string = $text[$i].Replace("&", "&")
}
$toggleName = "ToggleSwitch_{0}_{1}"-f $categoryName, $i
$textBlockName = "TextBlock_{0}_{1}"-f $categoryName, $i
#region Write Toggle Buttons
@"
"@ | Out-File -FilePath $outFile -Append
#endregion Write Toggle Buttons
}
Write-Warning -Message "File ""ToggleButtonsGenerator.txt"" created!"
}
else {
Write-Warning -Message "File ""$categoryFile"" not found!"
}
}