{"id":921,"date":"2024-12-15T01:56:28","date_gmt":"2024-12-14T17:56:28","guid":{"rendered":"https:\/\/keyi.eu.org\/?p=921"},"modified":"2024-12-15T01:58:32","modified_gmt":"2024-12-14T17:58:32","slug":"%e6%ae%ad%e6%af%80%e5%9c%b0%e5%9c%96%e5%82%99%e4%bb%bd%e8%85%b3%e6%9c%ac-2","status":"publish","type":"post","link":"https:\/\/keyi.eu.org\/?p=921","title":{"rendered":"\u6bad\u6bc0\u5730\u5716\u5099\u4efd\u8173\u672c"},"content":{"rendered":"<p><img src=\"https:\/\/keyi.eu.org\/wp-content\/uploads\/2024\/12\/blog\u50f5\u6bc0\u5730\u5716\u5099\u4efd\u8173\u672c-2.png\" alt=\"\u50f5\u6bc0\u5730\u5716\u5099\u4efd\u8173\u672c\"><br \/>\n\u628a\u8981\u5099\u4efd\u7684\u5730\u5716\u5340\u57df\uff0c\u5beb\u5230\u201cbackmap.txt\u201d\u4e2d\u3002\u6bcf\u884c\u4e00\u500b\u4f4d\u7f6e\uff0c\u4ee5\u958b\u59cb\u4f4d\u7f6e\u548c\u7d50\u675f\u4f4d\u7f6e\u7684X.Y\u7232\u5167\u5bb9\uff0c\u9017\u865f\u5206\u9694\uff0c#\u5beb\u8a3b\u91cb\u3002<br \/>\n\u8173\u672c\u653e\u5230\u50f5\u6bc0\u5b58\u6a94\u76ee\u9304\u4e2d\uff0c\u57f7\u884c\u7684\u6642\u5019\uff0c\u6703\u5148\u8b80\u53d6\u7576\u524d\u76ee\u9304\u7684\u201cbackmap.txt\u201d\uff0c\u518d\u5efa\u7acb\u4e00\u500b\u4ee5\u57f7\u884c\u6642\u9593\u547d\u540d\u7684\u4e0b\u7d1a\u76ee\u9304\u4f5c\u7232\u5099\u4efd\u76ee\u9304\uff0c\u628a\u8b80\u53d6\u5230\u9700\u8981\u5099\u4efd\u7684\u76ee\u9304\u7bc4\u570d\u5167\u7684bin\u6587\u4ef6\uff0c\u90fd\u62f7\u8c9d\u5230\u5099\u4efd\u76ee\u9304\u4e2d\u3002<\/p>\n<p>1\u3001backupmap.txt\u6a23\u672c\uff1a<\/p>\n<blockquote>\n<p><small>1537,124,1552,140 # \u8ecd\u4e8b\u8981\u585e<\/small><br \/>\n<small>578,538,586,544 # \u6cb3\u7554\u5ee2\u8eca\u5ee0<\/small><br \/>\n<small>625,517,641,528 # \u6cb3\u7554\u9152\u9928\u548c\u65c5\u9928<\/small><br \/>\n<small>803,1169,819,1177 # \u7f85\u65af\u4f0d\u5fb7\u8b66\u5c40\u548c\u6d88\u9632\u5c40<\/small><br \/>\n<small>1187,677,1192,683 # \u897f\u9ede\u4fee\u8eca\u5ee0<\/small><br \/>\n<small>1199,254,1206,264 # \u6cb3\u7554\u6709\u8eca\u5eab\u8c6a\u5b85\u53ca\u5176\u9031\u908a2\u9593<\/small><\/p>\n<\/blockquote>\n<p>2\u3001backmap.ps1\u7a0b\u5f0f\u8173\u672c\uff1a<\/p>\n<blockquote>\n<p y=\"\"><small> # \u5099\u4efdbackmap.txt\u4e2d\u6307\u5b9a\u7684\u4f4d\u7f6e\u7684\u5730\u5716\u5230\u4ee5\u5099\u4efd\u6642\u9593\u547d\u540d\u7684\u76ee\u9304<\/small><br \/>\n<small> # \u8a2d\u7f6e\u5b58\u6a94\u76ee\u9304\u548c\u7576\u524d\u76ee\u9304<\/small><br \/>\n<small> $SaveDir = Get-Location  # \u9ed8\u8a8d\u70ba\u8173\u672c\u6240\u5728\u76ee\u9304<\/small><br \/>\n<small> $CurrentDir = Get-Location<\/small><br \/>\n<small><\/small><br \/>\n<small> # \u5275\u5efa\u5099\u4efd\u76ee\u9304<\/small><br \/>\n<small> $Timestamp = Get-Date -Format &quot;yyyyMMddHHmm&quot;<\/small><br \/>\n<small> $BackupDir = Join-Path $CurrentDir &quot;Backup_$Timestamp&quot;<\/small><br \/>\n<small> New-Item -ItemType Directory -Path $BackupDir | Out-Null<\/small><br \/>\n<small><\/small><br \/>\n<small> # \u62f7\u8c9d backmap.txt \u6587\u4ef6\u5230\u5099\u4efd\u76ee\u9304<\/small><br \/>\n<small> $MapBackFile = Join-Path $CurrentDir &quot;backmap.txt&quot;<\/small><br \/>\n<small> If (Test-Path $MapBackFile) {<\/small><br \/>\n<small> Copy-Item -Path $MapBackFile -Destination $BackupDir<\/small><br \/>\n<small> } Else {<\/small><br \/>\n<small> Write-Host &quot;backmap.txt \u6587\u4ef6\u672a\u627e\u5230\uff0c\u8acb\u78ba\u4fdd\u6587\u4ef6\u4f4d\u65bc\u7576\u524d\u76ee\u9304\u3002&quot; -ForegroundColor Red<\/small><br \/>\n<small> Exit 1<\/small><br \/>\n<small> }<\/small><br \/>\n<small><\/small><br \/>\n<small> # \u8b80\u53d6 backmap.txt \u4e26\u89e3\u6790\u7bc4\u570d<\/small><br \/>\n<small> $MapRanges = Get-Content $MapBackFile<\/small><br \/>\n<small><\/small><br \/>\n<small> # \u904d\u6b77\u7bc4\u570d\u4e26\u62f7\u8c9d\u5c0d\u61c9\u7684\u5730\u5716\u6587\u4ef6<\/small><br \/>\n<small> Foreach ($Range in $MapRanges) {<\/small><br \/>\n<small> # \u53bb\u9664\u8a3b\u91cb\u90e8\u5206<\/small><br \/>\n<small> $Range = <span class=\"math\">\\(Range -replace &quot;#.*\\)<\/span>&quot;, &quot;&quot;.Trim()<\/small><br \/>\n<small><\/small><br \/>\n<small> # \u89e3\u6790\u6bcf\u884c\u7684\u8d77\u9ede\u548c\u7d42\u9ede (X1, Y1, X2, Y2)<\/small><br \/>\n<small> $Coords = $Range -split &quot;,&quot;<\/small><br \/>\n<small> If ($Coords.Count -ne 4) {<\/small><br \/>\n<small> If ($Range -ne &quot;&quot;) {<\/small><br \/>\n<small> Write-Host &quot;\u7121\u6548\u7684\u7bc4\u570d\u683c\u5f0f\uff1a$Range&quot; -ForegroundColor Yellow<\/small><br \/>\n<small> }<\/small><br \/>\n<small> Continue<\/small><br \/>\n<small> }<\/small><br \/>\n<small><\/small><br \/>\n<small> $X1, $Y1, $X2, $Y2 = <span class=\"math\">\\(Coords | ForEach-Object { [int]\\)<\/span>_ }<\/small><br \/>\n<small><\/small><br \/>\n<small> # \u8a08\u7b97\u9700\u8981\u5099\u4efd\u7684\u5340\u57df\u7bc4\u570d<\/small><br \/>\n<small> For ($X = [Math]::Min($X1, $X2); $X -le [Math]::Max($X1, $X2); $X++) {<\/small><br \/>\n<small> For ($Y = [Math]::Min($Y1, $Y2); $Y -le [Math]::Max($Y1, $Y2); $Y++) {<\/small><br \/>\n<small> # \u5099\u4efd map_X_Y.bin \u6587\u4ef6<\/small><br \/>\n<small> <span class=\"math\" x=\"\">\\(MapFileName = &quot;map_\\)<\/span>_$.bin&quot;<\/small><br \/>\n<small> $SourceMapFile = Join-Path $SaveDir $MapFileName<\/small><br \/>\n<small><\/small><br \/>\n<small> If (Test-Path $SourceMapFile) {<\/small><br \/>\n<small> Copy-Item -Path $SourceMapFile -Destination $BackupDir<\/small><br \/>\n<small> Write-Host &quot;\u5df2\u5099\u4efd\u5730\u5716\u6587\u4ef6\uff1a$MapFileName&quot; -ForegroundColor Green<\/small><br \/>\n<small> } Else {<\/small><br \/>\n<small> Write-Host &quot;\u627e\u4e0d\u5230\u5730\u5716\u6587\u4ef6\uff1a$MapFileName (\u8df3\u904e)&quot; -ForegroundColor Yellow<\/small><br \/>\n<small> }<\/small><br \/>\n<small> }<\/small><br \/>\n<small> }<\/small><br \/>\n<small> }<\/small><br \/>\n<small><\/small><br \/>\n<small> Write-Host &quot;\u5099\u4efd\u5b8c\u6210\uff0c\u6240\u6709\u6587\u4ef6\u5b58\u5132\u65bc\uff1a$BackupDir&quot; -ForegroundColor Cyan<\/small><\/p>\n<\/blockquote>\n<p>\u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1a<a href=\"https:\/\/keyi.eu.org\">\u5218\u592a\u76d1\u7684\u79c1\u85cf<\/a> &raquo; <a href=\"https:\/\/keyi.eu.org\/?p=921\">\u6bad\u6bc0\u5730\u5716\u5099\u4efd\u8173\u672c<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>\u628a\u8981\u5099\u4efd\u7684\u5730\u5716\u5340\u57df\uff0c\u5beb\u5230\u201cbackmap.txt\u201d\u4e2d\u3002\u6bcf\u884c\u4e00\u500b\u4f4d\u7f6e\uff0c\u4ee5\u958b\u59cb\u4f4d\u7f6e\u548c\u7d50\u675f\u4f4d\u7f6e\u7684X.Y\u7232\u5167\u5bb9\uff0c\u9017\u865f\u5206 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/keyi.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/921"}],"collection":[{"href":"https:\/\/keyi.eu.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/keyi.eu.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/keyi.eu.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/keyi.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=921"}],"version-history":[{"count":2,"href":"https:\/\/keyi.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/921\/revisions"}],"predecessor-version":[{"id":924,"href":"https:\/\/keyi.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/921\/revisions\/924"}],"wp:attachment":[{"href":"https:\/\/keyi.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=921"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/keyi.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=921"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/keyi.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=921"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}