Files
maat/obfuscate.ps1
Samuele Locatelli e01ae501aa Maat: ok compilazione
- aggiunta file accessori
- fix nuget.config x publish (locale)
2024-04-04 09:25:30 +02:00

49 lines
1.4 KiB
PowerShell

param([string]$CurrConfig);
#verifico se encessario installare come global tool
$testString = dotnet tool list -g | Select-String -Pattern "obfuscar.globaltool"
if($testString -eq $null)
{
Write-Output("Installing obfuscar as global tool")
dotnet tool install --global Obfuscar.GlobalTool --version 2.2.33
}
else
{
Write-Output("Obfuscar already installed!")
#dotnet tool update --global Obfuscar.GlobalTool --version 2.2.33
}
# fix folder obf
$FolderName = "\bin\Debug\net6.0_obf\"
if (Test-Path $FolderName) {
Write-Host "Folder Exists"
}
else {
#PowerShell Create directory if not exists
New-Item $FolderName -ItemType Directory
Write-Host "Folder Created successfully"
}
# sistemo XML x usare la conf corrente
$OrigConfPath = "obfuscar.orig.xml"
$ConfigPath = "obfuscar.xml"
$configFile = Get-Content $OrigConfPath
$find = "{{CURR_CONFIG}}";
$configFileUpd = $configFile -replace $find, $CurrConfig
Set-Content -Path $ConfigPath -Value $configFileUpd
Write-Output("Config File set:")
Write-Output($configFileUpd)
# chiamo script principale
#C:\Users\samuele.steamw\.dotnet\tools\obfuscar.console.exe obfuscar.xml
obfuscar.console.exe obfuscar.xml
#obfuscar.console obfuscar.xml
Write-Output("Obfuscar completed!")
# sovrascrivo dll originali con i file elaborati
Copy-Item .\bin\$CurrConfig\net6.0_obf\*.dll .\bin\$CurrConfig\net6.0\
Write-Output("Obfuscated dll copy completed!")