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" $ErrorActionPreference = "Stop"
$owner = "hackrobot"
$repo = "newmindjet"
$tag = "mmap-current"
$outFile = Join-Path $PSScriptRoot "nomad_27 copy.mmap" $outFile = Join-Path $PSScriptRoot "nomad_27 copy.mmap"
$chunkDir = Join-Path $PSScriptRoot "chunks" $api = "https://git.nomadro.cn/api/v1/repos/$owner/$repo/releases/tags/$tag"
function Join-Parts($parts, $outFile) {
if (Test-Path $outFile) { Remove-Item $outFile -Force } Write-Host "Fetching release $tag ..."
$fs = [IO.File]::Create($outFile) $rel = Invoke-RestMethod -Uri $api -Method Get
try { foreach ($p in $parts) { $b=[IO.File]::ReadAllBytes($p.FullName); $fs.Write($b,0,$b.Length) } } $assets = $rel.assets | Sort-Object name
finally { $fs.Close() } if (-not $assets -or $assets.Count -eq 0) { throw "No assets found on release $tag" }
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
$tmp = Join-Path $env:TEMP ("mmap-restore-" + [guid]::NewGuid().ToString("n")) $tmp = Join-Path $env:TEMP ("mmap-restore-" + [guid]::NewGuid().ToString("n"))
New-Item -ItemType Directory -Path $tmp | Out-Null New-Item -ItemType Directory -Path $tmp | Out-Null
try { 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 } $i = 0
Join-Parts (Get-ChildItem $tmp -File | Sort-Object Name) $outFile foreach ($a in $assets) {
} finally { Remove-Item $tmp -Recurse -Force -ErrorAction SilentlyContinue } $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
}