由於使用Helium backup時,用第三方ROM有機會不能開啟使用Helium server進行restore。
正常人可能會copy PC/cloud上的backup file 入電話,希望可以重新restore ,但你會發現Helium是不能辨識你的backup file。
因為cloud上/PC上產生的backup file 同Internal storage 的backup file少少分別。
internal storage 的backup file 是由folder分開裝好的,當然你可以人手一個個重新開folder將file重新放回,不過一定是個非常煩擾的一項工作。
解決方法:
(http://forum.xda-developers.com/showthread.php?t=2324232&page=4)
打開windows上內置的Powershell , 把下面的code copy&paste 入程式上
PS: 把紅色粗字的地方改回你剛才解壓縮的地方。
完成後,解壓縮資料夾就會新增一堆整理好的資料夾lol , 再放回電話的folder , Helium就會成功辨認了......
$backuppath='E:\Desktop\backup\' #extract your backup.zip contents here (those are the .ab, png files in the zip you downloaded + a backup.json maniest the app generated for all the packages) $jsonFile=$backuppath+"backup.json" $jsonText=[System.IO.File]::ReadAllText($jsonFile) $files = Get-Item -Path ($backuppath + "*") [System.Reflection.Assembly]::LoadWithPartialName("System.Web.Extensions") $ser = New-Object System.Web.Script.Serialization.JavaScriptSerializer $jsonPackageDefs = $ser.DeserializeObject($jsonText) function getPackageDef([string]$pname, [Object]$packagesIn){ $ret = "" foreach($p in $packagesIn.packages){ if($p.packageName -eq $pname){ $ret = $ser.Serialize($p) break; } } return $ret } #for each file copy it to a subfolder with the package name, and find the json manifest in the manifest collection #and write it to the app folder foreach ($f in $files){ if($f.Attributes.ToString() -eq "Directory"){ #skip } elseif($f.basename[0] -eq "." -or ($f.basename+$f.Extension) -eq "backup.json"){ #skip } else{ $bn=$f.BaseName $bn if([System.IO.Directory]::Exists(($backuppath+$f.BaseName))-eq $false){ [System.IO.Directory]::CreateDirectory(($backuppath+$f.BaseName)); } if([System.IO.File]::Exists($backuppath+$f.BaseName+"\"+$f.BaseName+$f.Extension)){ [System.IO.File]::Delete($backuppath+$f.BaseName+"\"+$f.BaseName+$f.Extension) } if([System.IO.File]::Exists($backuppath+$f.BaseName+"\"+$f.BaseName +".json")){ [System.IO.File]::Delete($backuppath+$f.BaseName+"\"+$f.BaseName +".json") } $f.CopyTo(($backuppath+$f.BaseName+"\"+ $f.BaseName + $f.Extension)) $packageDetailsText=getPackageDef $f.BaseName $jsonPackageDefs; $jsonFileNameOut=$backuppath+$f.BaseName + "\" + $f.BaseName + ".json" [System.IO.File]::WriteAllText($jsonFileNameOut, $packageDetailsText) } }
沒有留言:
張貼留言