mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-17 10:17:44 -06:00
Re-formate Comments to be a bit Clear-er
This commit is contained in:
parent
9be030a4e2
commit
37b4706ae7
13
Compile.ps1
13
Compile.ps1
@ -37,16 +37,17 @@ Get-ChildItem .\config | Where-Object {$psitem.extension -eq ".json"} | ForEach-
|
|||||||
|
|
||||||
# Replace every XML Special Character so it'll render correctly in final build
|
# Replace every XML Special Character so it'll render correctly in final build
|
||||||
# Only do so if json files has content to be displayed (for example the applications, tweaks, features json files)
|
# Only do so if json files has content to be displayed (for example the applications, tweaks, features json files)
|
||||||
# Some Type Convertion using Casting and Cleaning Up of the convertion result using 'Replace' Method
|
# Some Type Convertion using Casting and Cleaning Up of the convertion result using 'Replace' Method
|
||||||
$jsonAsObject = $json | convertfrom-json
|
$jsonAsObject = $json | convertfrom-json
|
||||||
$firstLevelJsonList = ([System.String]$jsonAsObject).split('=;') | ForEach-Object {
|
$firstLevelJsonList = ([System.String]$jsonAsObject).split('=;') | ForEach-Object {
|
||||||
$_.Replace('=}','').Replace('@{','').Replace(' ','')
|
$_.Replace('=}','').Replace('@{','').Replace(' ','')
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($i = 0; $i -lt $firstLevelJsonList.Count; $i += 1) {
|
# Note:
|
||||||
|
# Avoid using HTML Entity Codes, for example '”' (stands for "Right Double Quotation Mark"),
|
||||||
|
# Use **HTML decimal/hex codes instead**, as using HTML Entity Codes will result in XML parse Error when running the compiled script.
|
||||||
|
for ($i = 0; $i -lt $firstLevelJsonList.Count; $i += 1) {
|
||||||
$firstLevelName = $firstLevelJsonList[$i]
|
$firstLevelName = $firstLevelJsonList[$i]
|
||||||
# Note: Avoid using HTML Entity Codes (for example '”' (stands for "Right Double Quotation Mark")), and use HTML decimal/hex codes instead.
|
|
||||||
# as using HTML Entity Codes will result in XML parse Error when running the compiled script.
|
|
||||||
if ($jsonAsObject.$firstLevelName.content -ne $null) {
|
if ($jsonAsObject.$firstLevelName.content -ne $null) {
|
||||||
$jsonAsObject.$firstLevelName.content = $jsonAsObject.$firstLevelName.content.replace('&','&').replace('“','“').replace('”','”').replace("'",''').replace('<','<').replace('>','>')
|
$jsonAsObject.$firstLevelName.content = $jsonAsObject.$firstLevelName.content.replace('&','&').replace('“','“').replace('”','”').replace("'",''').replace('<','<').replace('>','>')
|
||||||
$jsonAsObject.$firstLevelName.content = $jsonAsObject.$firstLevelName.content.replace('''',"'") # resolves the Double Apostrophe caused by the first replace function in the main loop
|
$jsonAsObject.$firstLevelName.content = $jsonAsObject.$firstLevelName.content.replace('''',"'") # resolves the Double Apostrophe caused by the first replace function in the main loop
|
||||||
@ -56,8 +57,8 @@ Get-ChildItem .\config | Where-Object {$psitem.extension -eq ".json"} | ForEach-
|
|||||||
$jsonAsObject.$firstLevelName.description = $jsonAsObject.$firstLevelName.description.replace('''',"'") # resolves the Double Apostrophe caused by the first replace function in the main loop
|
$jsonAsObject.$firstLevelName.description = $jsonAsObject.$firstLevelName.description.replace('''',"'") # resolves the Double Apostrophe caused by the first replace function in the main loop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# The replace at the end is required, as without it the output of converto-json will be somewhat weird for Multiline String
|
# 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 json files, making it harder for users who want to review these scripts that are found in the final compiled script
|
# 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")
|
$json = ($jsonAsObject | convertto-json -Depth 3).replace('\r\n',"`r`n")
|
||||||
|
|
||||||
$sync.configs.$($psitem.BaseName) = $json | convertfrom-json
|
$sync.configs.$($psitem.BaseName) = $json | convertfrom-json
|
||||||
|
Loading…
Reference in New Issue
Block a user