-
Notifications
You must be signed in to change notification settings - Fork 0
/
Build.ps1
39 lines (33 loc) · 1.46 KB
/
Build.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
28
29
30
31
32
33
34
35
36
37
38
39
$modFolder = "C:\Users\Dale\Desktop\Code\membtvtauntpack\"
# Clean up the previous build.
Remove-Item "$modFolder\Compiled" -Recurse
# Loop over the aoe2 languages, copy the sounds into the correct language folder structure.
foreach($language in [System.IO.File]::ReadLines("$modFolder\Languages.txt"))
{
New-Item -ItemType Directory -Force -Path "$modFolder\Compiled\resources\$language\sound\taunt"
Copy-Item -Path "$modFolder\Source\Audio\*" -Destination "$modFolder\Compiled\resources\$language\sound\taunt" -Recurse
}
# Compress the resources into a .zip file.
$compressResources = @{
Path = "$modFolder\Compiled\resources"
CompressionLevel = "Fastest"
DestinationPath = "$modFolder\Compiled\resources.zip"
}
Compress-Archive @compressResources
#Modify the readme.
$readme = "C:\Users\Dale\Desktop\Code\membtvtauntpack\readme.md"
$readmeContent = Get-Content $readme -Raw
$startText = "# Taunts"
$endText = "# Credits"
$startTextIndex = $readmeContent.IndexOf($startText) + $startText.Length + 2
$endTextIndex = $readmeContent.IndexOf($endText) -1
$readmeContent.Remove($startTextIndex, ($endTextIndex - $startTextIndex )) | Set-Content $readme
$readmeContent = Get-Content $readme -Raw
$tauntList = @()
Get-ChildItem "$modFolder\Source\Audio" -Filter *.wem |
Foreach-Object {
$tauntList += $_.name.Insert(3, ".").Replace(".wem", "");
}
$tauntsJoined = $tauntList -join "`n"
$tauntsJoined += "`n"
$readmeContent.Insert($startTextIndex, $tauntsJoined) | Set-Content $readme