Compare commits

..

No commits in common. "0a8be92fe574e4207f7853ab12e86d8e71adc4d9" and "b2ebad564effa0b787f0efb5761514e767861ce8" have entirely different histories.

76 changed files with 31 additions and 19 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,24 +1,36 @@
# Restore nomad_27 copy.mmap from ./chunks or Release mmap-current
# Restores "nomad_27 copy.mmap" from Release mmap-current assets.
$ErrorActionPreference = "Stop"
$owner = "hackrobot"
$repo = "newmindjet"
$tag = "mmap-current"
$outFile = Join-Path $PSScriptRoot "nomad_27 copy.mmap"
$chunkDir = Join-Path $PSScriptRoot "chunks"
function Join-Parts($parts, $outFile) {
if (Test-Path $outFile) { Remove-Item $outFile -Force }
$fs = [IO.File]::Create($outFile)
try { foreach ($p in $parts) { $b=[IO.File]::ReadAllBytes($p.FullName); $fs.Write($b,0,$b.Length) } }
finally { $fs.Close() }
Write-Host "Wrote $outFile ($((Get-Item $outFile).Length) bytes)"
}
if (Test-Path $chunkDir) {
$parts = Get-ChildItem $chunkDir -File -Filter "part.*" | Sort-Object Name
if ($parts.Count -gt 0) { Write-Host "Joining $($parts.Count) local chunks ..."; Join-Parts $parts $outFile; exit 0 }
}
Write-Host "No local chunks; downloading Release mmap-current ..."
$api = "https://git.nomadro.cn/api/v1/repos/hackrobot/newmindjet/releases/tags/mmap-current"
$rel = Invoke-RestMethod -Uri $api
$api = "https://git.nomadro.cn/api/v1/repos/$owner/$repo/releases/tags/$tag"
Write-Host "Fetching release $tag ..."
$rel = Invoke-RestMethod -Uri $api -Method Get
$assets = $rel.assets | Sort-Object name
if (-not $assets -or $assets.Count -eq 0) { throw "No assets found on release $tag" }
$tmp = Join-Path $env:TEMP ("mmap-restore-" + [guid]::NewGuid().ToString("n"))
New-Item -ItemType Directory -Path $tmp | Out-Null
try {
$n=0; foreach ($a in ($rel.assets | Sort-Object name)) { $n++; Write-Host "[$n/$($rel.assets.Count)] $($a.name)"; Invoke-WebRequest -Uri $a.browser_download_url -OutFile (Join-Path $tmp $a.name) -UseBasicParsing }
Join-Parts (Get-ChildItem $tmp -File | Sort-Object Name) $outFile
} finally { Remove-Item $tmp -Recurse -Force -ErrorAction SilentlyContinue }
$i = 0
foreach ($a in $assets) {
$i++
$dest = Join-Path $tmp $a.name
Write-Host "[$i/$($assets.Count)] $($a.name) ($($a.size) bytes)"
Invoke-WebRequest -Uri $a.browser_download_url -OutFile $dest -UseBasicParsing
}
if (Test-Path $outFile) { Remove-Item $outFile -Force }
$parts = Get-ChildItem $tmp -File | Sort-Object Name
$fs = [IO.File]::Create($outFile)
try {
foreach ($p in $parts) {
$bytes = [IO.File]::ReadAllBytes($p.FullName)
$fs.Write($bytes, 0, $bytes.Length)
}
} finally { $fs.Close() }
Write-Host "Wrote $outFile ($((Get-Item $outFile).Length) bytes)"
} finally {
Remove-Item $tmp -Recurse -Force -ErrorAction SilentlyContinue
}