forked from igorkis-scrts/A3-Antistasi-Plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CompileAndCopyDevAltis.ps1
25 lines (17 loc) · 1.17 KB
/
CompileAndCopyDevAltis.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
$root = $PSScriptRoot;
$buildFolder = $env:userprofile + "\Documents\Arma 3 - Other Profiles\Socrates\missions";
$devFolderItem = Get-ChildItem -Path ".\Map-Templates\Antistasi-Altis.Altis" | Select-Object -First 1;
$devFolder = $devFolderItem.parent;
$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_plus_credits_generic_version_text"} | ForEach {$_.Original};
$formattedVersionId = $versionId.Split("\.") -join "-";
$folderName = $devFolder.Name;
$pair = $folderName.Split("\.");
$missionFolderName = $pair[0] + "-" + $formattedVersionId + "-" + "Plus" + "-" + "dev" + "." + $pair[1];
$destinationPath = $(Join-Path $buildFolder $missionFolderName);
Remove-Item $destinationPath -Recurse -ErrorAction Ignore;
Copy-Item -Path $mainDataPath -Destination $destinationPath -Recurse;
Copy-Item -Path $(Join-Path $devFolder.FullName "*") -Destination $destinationPath -Recurse -Force;