Skip to content

Commit

Permalink
Removed unnessacry try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
miragedmuk authored and Flachdachs committed Mar 3, 2020
1 parent 3eeb159 commit 8a89634
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions SavegameToolkit/ArkSavegame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,33 +95,30 @@ public void ReadBinary(ArkArchive archive, ReadingOptions options) {
//Now parse out cryo creature data
foreach (var cryo in this.Objects.Where(x => x.ClassName.ToString().Contains("Cryop")).ToList())
{
try
{
var contents = ((((((((Structs.StructPropertyList)((cryo.Properties[4] as Propertys.PropertyArray).Value as Arrays.ArkArrayStruct)[0]).Properties[6] as Propertys.PropertyStruct)
.Value as Structs.StructPropertyList).Properties[0] as Propertys.PropertyArray).Value as Arrays.ArkArrayStruct)[0] as Structs.StructPropertyList).Properties[0] as Propertys.PropertyArray).Value as Arrays.ArkArrayUInt8;

var contents = ((((((((Structs.StructPropertyList)((cryo.Properties[4] as Propertys.PropertyArray).Value as Arrays.ArkArrayStruct)[0]).Properties[6] as Propertys.PropertyStruct)
.Value as Structs.StructPropertyList).Properties[0] as Propertys.PropertyArray).Value as Arrays.ArkArrayStruct)[0] as Structs.StructPropertyList).Properties[0] as Propertys.PropertyArray).Value as Arrays.ArkArrayUInt8;

var cryoStream = new System.IO.MemoryStream(contents.ToArray<Byte>());
var cryoStream = new System.IO.MemoryStream(contents.ToArray<Byte>());

using (ArkArchive cryoArchive = new ArkArchive(cryoStream))
{
cryoArchive.ReadBytes(4);
var dino = new GameObject(cryoArchive);
var statusobject = new GameObject(cryoArchive);
dino.LoadProperties(cryoArchive, new GameObject(), 0);
statusobject.LoadProperties(cryoArchive, new GameObject(), 0);
dino.IsCryo = true;
using (ArkArchive cryoArchive = new ArkArchive(cryoStream))
{
cryoArchive.ReadBytes(4);
var dino = new GameObject(cryoArchive);
var statusobject = new GameObject(cryoArchive);
dino.LoadProperties(cryoArchive, new GameObject(), 0);
statusobject.LoadProperties(cryoArchive, new GameObject(), 0);
dino.IsCryo = true;

addObject(dino, true);
addObject(statusobject, true);
addObject(dino, true);
addObject(statusobject, true);

//hack the id's so that the dino points to the appropriate dinostatuscomponent
var statusComponentRef = dino.GetTypedProperty<PropertyObject>("MyCharacterStatusComponent");
statusComponentRef.Value.ObjectId = statusobject.Id;
//hack the id's so that the dino points to the appropriate dinostatuscomponent
var statusComponentRef = dino.GetTypedProperty<PropertyObject>("MyCharacterStatusComponent");
statusComponentRef.Value.ObjectId = statusobject.Id;

}
}
catch (Exception)
{ }

}


Expand Down

0 comments on commit 8a89634

Please sign in to comment.