24. Juli 2014 17:23
function CreateSortedNAVObjectPackage{
param ([Boolean]$DeleteSeparateObjectFiles)
BEGIN{}
PROCESS {
Write-Host "Deleting old object files…"
IF (Test-Path .\allobjects.txt) {Remove-Item .\allobjects.txt}
IF (Test-Path .\alltables.txt) {Remove-Item .\alltables.txt}
IF (Test-Path .\allreports.txt) {Remove-Item .\allreports.txt}
IF (Test-Path .\allcodeunits.txt) {Remove-Item .\allcodeunits.txt}
IF (Test-Path .\allxmlports.txt) {Remove-Item .\allxmlports.txt}
IF (Test-Path .\allmenusuites.txt) {Remove-Item .\allmenusuites.txt}
IF (Test-Path .\allpages.txt) {Remove-Item .\allpages.txt}
IF (Test-Path .\allqueries.txt) {Remove-Item .\allqueries.txt}
Write-Host "Joining discrete NAV object files…"
Join-NAVApplicationObjectFile -Source .\TAB*.txt -Destination alltables.txt
Join-NAVApplicationObjectFile -Source .\REP*.txt -Destination allreports.txt
Join-NAVApplicationObjectFile -Source .\COD*.txt -Destination allcodeunits.txt
Join-NAVApplicationObjectFile -Source .\XML*.txt -Destination allxmlports.txt
Join-NAVApplicationObjectFile -Source .\MEN*.txt -Destination allmenusuites.txt
Join-NAVApplicationObjectFile -Source .\PAG*.txt -Destination allpages.txt
Join-NAVApplicationObjectFile -Source .\QUE*.txt -Destination allqueries.txt
Write-Host "Concatenating object files into the AllObjects.txt…"
IF (Test-Path .\alltables.txt) {Add-Content -path AllObjects.txt -value(Get-Content alltables.txt)}
IF (Test-Path .\allreports.txt) {Add-Content -path AllObjects.txt -value(Get-Content allreports.txt)}
IF (Test-Path .\allcodeunits.txt) {Add-Content -path AllObjects.txt -value(Get-Content allcodeunits.txt)}
IF (Test-Path .\allxmlports.txt) {Add-Content -path AllObjects.txt -value(Get-Content allxmlports.txt)}
IF (Test-Path .\allmenusuites.txt) {Add-Content -path AllObjects.txt -value(Get-Content allmenusuites.txt)}
IF (Test-Path .\allpages.txt) {Add-Content -path AllObjects.txt -value(Get-Content allpages.txt)}
IF (Test-Path .\allqueries.txt) {Add-Content -path AllObjects.txt -value(Get-Content allqueries.txt)}
IF (($DeleteSeparateObjectFiles -and (Test-Path alltables.txt))) {Remove-Item alltables.txt}
IF (($DeleteSeparateObjectFiles -and (Test-Path allreports.txt))) {Remove-Item allreports.txt}
IF (($DeleteSeparateObjectFiles -and (Test-Path allcodeunits.txt))) {Remove-Item allcodeunits.txt}
IF (($DeleteSeparateObjectFiles -and (Test-Path allxmlports.txt))) {Remove-Item allxmlports.txt}
IF (($DeleteSeparateObjectFiles -and (Test-Path allmenusuites.txt))) {Remove-Item allmenusuites.txt}
IF (($DeleteSeparateObjectFiles -and (Test-Path allpages.txt))) {Remove-Item allpages.txt}
IF (($DeleteSeparateObjectFiles -and (Test-Path allqueries.txt))) {Remove-Item allqueries.txt}
}
END{}
}
Set-Alias csnop CreateSortedNAVObjectPackage