mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-16 01:40:35 -06:00
Make Preprocessing more advanced
This commit is contained in:
parent
b5dffd671f
commit
1ed15a4040
16
Compile.ps1
16
Compile.ps1
@ -44,7 +44,18 @@ function Do-PreProcessing {
|
|||||||
|
|
||||||
for ($i = 0; $i -lt $numOfFiles; $i++) {
|
for ($i = 0; $i -lt $numOfFiles; $i++) {
|
||||||
$file = $files[$i]
|
$file = $files[$i]
|
||||||
(Get-Content "$file").TrimEnd() | Set-Content "$file"
|
# TODO:
|
||||||
|
# make more formatting rules, and document them in WinUtil Official Documentation
|
||||||
|
(Get-Content -Raw "$file").TrimEnd() `
|
||||||
|
-replace ('\t', ' ') `
|
||||||
|
-replace ('\)\{', ') {') `
|
||||||
|
-replace ('\)\r?\n\s*{', ') {') `
|
||||||
|
-replace ('Try \{', 'try {') `
|
||||||
|
-replace ('try\{', 'try {') `
|
||||||
|
-replace ('try\r?\n\s*\{', 'try {') `
|
||||||
|
-replace ('}\r?\n\s*catch', '} catch') `
|
||||||
|
-replace ('\} Catch', '} catch') `
|
||||||
|
| Set-Content "$file"
|
||||||
Write-Progress -Activity $ProgressActivity -Status "$ProgressStatusMessage - Finished $i out of $numOfFiles" -PercentComplete (($i/$numOfFiles)*100)
|
Write-Progress -Activity $ProgressActivity -Status "$ProgressStatusMessage - Finished $i out of $numOfFiles" -PercentComplete (($i/$numOfFiles)*100)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,8 +176,7 @@ Write-Progress -Activity "Compiling" -Completed
|
|||||||
if ($run) {
|
if ($run) {
|
||||||
try {
|
try {
|
||||||
Start-Process -FilePath "pwsh" -ArgumentList "$workingdir\$scriptname"
|
Start-Process -FilePath "pwsh" -ArgumentList "$workingdir\$scriptname"
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
Start-Process -FilePath "powershell" -ArgumentList "$workingdir\$scriptname"
|
Start-Process -FilePath "powershell" -ArgumentList "$workingdir\$scriptname"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user