Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. using namespace System.Collections.Generic
  2. using namespace System.IO
  3. using namespace System.Linq
  4. using namespace System.Reflection
  5. using namespace Newtonsoft.Json
  6. using namespace Newtonsoft.Json.Serialization
  7.  
  8.  
  9.  
  10.  
  11.  
  12. $ErrorActionPreference = "SilentlyContinue"
  13. $sbpath = "C:\temp\ark-backup\smartbreed"
  14. $arkpath = "C:\temp\ark-backup\currArk\TheIsland.ark"
  15.  
  16.  
  17. [System.Reflection.Assembly]::LoadFile("$sbpath\Newtonsoft.Json.dll")
  18. [System.Reflection.Assembly]::LoadFile("$sbpath\SavegameToolkit.dll")
  19. [System.Reflection.Assembly]::LoadFile("$sbpath\SavegameToolkitAdditions.dll")
  20. [System.Reflection.Assembly]::LoadFile("$sbpath\System.Collections.Immutable.dll")
  21.  
  22.  
  23.  
  24. $arkdata = [SavegameToolkitAdditions.ArkDataReader]::ReadFromFile("$sbpath\json\ark_data.json")
  25.  
  26. $bytes = [System.IO.File]::ReadAllBytes($arkpath)
  27. $stream = [System.IO.MemoryStream]::new($bytes)
  28.  
  29. $arkSavegame = [SavegameToolkit.ArkSavegame]::new()
  30. $archive = [SavegameToolkit.ArkArchive]::new($stream)
  31. $ro = [SavegameToolkit.ReadingOptions]::Create()
  32. $ro.WithDatafiles($false)
  33. $ro.WithEmbeddedData($false)
  34. $ro.WithDataFilesObjectMap($false)
  35. $ro.WithBuildComponentTree($true)
  36.  
  37. $arkSavegame.ReadBinary($archive, $ro)
  38. $cryos = ($arkSavegame.Objects | where-object {$_.ClassName -like "*CryoP*"})
  39.  
  40. foreach ($cryo in $cryos)
  41. {
  42. Write-Host $cryo.properties[4].value.properties[1].value[1]
  43. $cryobytes = $cryo.properties[4].value.properties[6].value.properties[0].value[0].properties.value
  44. $outpath = (split-path $arkpath) + "\" + ($cryo.properties[4].value.properties[1].value[1])
  45. [System.IO.File]::WriteAllBytes($outpath, $cryobytes)
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement