-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecrypt.ps1
More file actions
28 lines (20 loc) · 908 Bytes
/
Copy pathdecrypt.ps1
File metadata and controls
28 lines (20 loc) · 908 Bytes
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
# Decrypt input data and problem information
$7ZipExecutablePath = 'C:\Program Files\7-Zip\7z.exe'
$ZipPassword = $Env:AoCZipPassword
$parallelProcesses = [System.Collections.Generic.List[System.Diagnostics.Process]]::new()
if ($false -eq (Test-Path $7ZipExecutablePath)) { Write-Error "7zip not found." }
if ([string]::IsNullOrEmpty($ZipPassword)) { Write-Error "Zip password not defined" }
$filesToUnzip = Get-ChildItem -Include ('input.zip', 'problem.zip') -r
foreach ($fileToUnzip in $filesToUnzip) {
$7ZipArgs = @(
"e",
"-o`"$($fileToUnzip.DirectoryName)`""
"`"$($fileToUnzip.FullName)`"",
"-aoa"
"-p$($ZipPassword)"
)
$p = Start-Process $7ZipExecutablePath -ArgumentList $7ZipArgs -PassThru -WindowStyle 'Hidden'
$parallelProcesses.Add($p)
}
$parallelProcesses | Wait-Process -Timeout 300
# TODO check exit code of each process for errors