Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #INSTRUCTIONS
- # Place all add-ons to be fixed in a folder called "input".
- # Run this script from "input"'s parent directory.
- # They will be repaired and placed in "output".
- #REQUIRES
- # The "PowerShell Community Extensions": https://pscx.codeplex.com/
- #UNZIP ALL
- echo("1) Unzipping files.`n");
- Get-ChildItem ".\input\" -Filter *.zip | `
- Foreach-Object{
- $name = $_.BaseName
- if(!(Test-Path ".\temp\$name"))
- {
- mkdir ".\temp\$name"
- expand-archive -Path $_.FullName -OutputPath ".\temp\$name"
- }
- else
- {
- echo("Skip $name");
- }
- }
- #REPAIR
- echo("2) Repairing files.`n");
- $configFiles= Get-ChildItem .\temp *.cs -rec
- foreach ($file in $configFiles)
- {
- (Get-Content $file.PSPath) | Foreach-Object{$_ -replace "function disconnect\(\)", "function disconnect(%bool)"} | Set-Content $file.PSPath
- (Get-Content $file.PSPath) | Foreach-Object{$_ -replace "parent::disconnect\(\)", "parent::disconnect(%bool)"} | Set-Content $file.PSPath
- (Get-Content $file.PSPath) | Foreach-Object{$_ -replace "function disconnectedCleanup\(\)", "function disconnectedCleanup(%bool)"} | Set-Content $file.PSPath
- (Get-Content $file.PSPath) | Foreach-Object{$_ -replace "parent::disconnectedCleanup\(\)", "parent::disconnectedCleanup(%bool)"} | Set-Content $file.PSPath
- }
- #COMPRESS
- echo("3) Compressing files.`n")
- if(!(Test-Path ".\output"))
- {
- mkdir ".\output"
- }
- Get-ChildItem ".\temp\" | `
- Foreach-Object{
- $fullName = $_.FullName
- $baseName = $_.BaseName
- Write-Zip -Path "$fullName\*" -OutputPath ".\output\$baseName.zip"
- }
- #MAKE REPO
- echo("4) Creating repository file.`n")
- .\make-repository.ps1
- #CLEANUP
- echo("5. Removing temporary files.`n")
- Remove-Item ".\temp" -Recurse
Advertisement
Add Comment
Please, Sign In to add comment