forked from igorkis-scrts/A3-Antistasi-Plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PrepareMissionForPackingNoSqfc.ps1
27 lines (20 loc) · 1.5 KB
/
PrepareMissionForPackingNoSqfc.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$root = $PSScriptRoot;
$folderForPreparedMissions = New-Item -Path $root -Name "PreparedMissions" -ItemType "directory" -Force;
Remove-Item $folderForPreparedMissions -Recurse;
$missionTemplateFolders = Get-ChildItem -Path ".\Map-Templates" ;
$mainDataPath = Join-Path $root 'A3-Antistasi';
$stringTablePath = Join-Path $root 'A3-Antistasi\Stringtable.xml';
$stringTable = New-Object -TypeName XML;
$stringTable.Load($stringTablePath);
$versionId = $stringTable.Project.Package.Container | Where-Object { $_.name -eq "credits_generic" } | ForEach-Object {$_.Key} | Where-Object {$_.ID -eq "STR_antistasi_credits_generic_version_text"} | ForEach {$_.Original};
$plusVersionId = $stringTable.Project.Package.Container | Where-Object { $_.name -eq "credits_generic" } | ForEach-Object {$_.Key} | Where-Object {$_.ID -eq "STR_antistasi_plus_credits_generic_version_text"} | ForEach {$_.Original};
$formattedVersionId = $versionId.Split("\.") -join "-";
$formattedPlusVersionId = $plusVersionId.Split("\.") -join "-";
ForEach ($templateFolder in $missionTemplateFolders) {
$folderName = $templateFolder.Name;
$pair = $folderName.Split("\.");
$missionFolderName = $pair[0] + "-" + $formattedVersionId + "-" + "Plus" + "-" + $formattedPlusVersionId + "." + $pair[1];
$destinationPath = $(Join-Path $folderForPreparedMissions.FullName $missionFolderName);
Copy-Item -Path $mainDataPath -Destination $destinationPath -Recurse;
Copy-Item -Path $(Join-Path $templateFolder.FullName "*") -Destination $destinationPath -Recurse -Force;
}