-
Notifications
You must be signed in to change notification settings - Fork 468
/
Copy pathCodeSign_ExtractFilesToSign.ps1
32 lines (24 loc) · 1.1 KB
/
CodeSign_ExtractFilesToSign.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
param
(
[Parameter(Mandatory=$true)]
[string]$vsixFilePath,
[Parameter(Mandatory=$true)]
[string]$outputPath
)
Add-Type -Assembly System.IO.Compression.FileSystem
$vsix = [IO.Compression.ZipFile]::OpenRead($vsixFilePath)
Write-Output "Listing entries"
$entries=$vsix.Entries | Where-Object { $_.FullName -like '*.dll' -or $_.FullName -like '*.js' -and ($_.FullName.StartsWith('TemplateStudio') -or -not $_.FullName.StartsWith('Microsoft')) -and -not $_.FullName.StartsWith('System') }
Write-Output $entries.FullName
New-Item -ItemType Directory -Path $outputPath -Force
foreach ($entry in $entries)
{
$entryTargetFilePath = [System.IO.Path]::Combine($outputPath, $entry.FullName)
$entryDir = [System.IO.Path]::GetDirectoryName($entryTargetFilePath)
if(!(Test-Path $entryDir)) {
New-Item -ItemType Directory -Path $entryDir | Out-Null
}
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $entryTargetFilePath, $true);
Write-Host "<file src=""__INPATHROOT__\$entryTargetFilePath"" signType=""400"" dest=""__OUTPATHROOT__\$entryTargetFilePath"" />"
}
$vsix.Dispose()