public virtual void Deserialize(BinaryReader reader) { ObjectID = reader.ReadInt16(); PersistID = reader.ReadUInt32(); if (this is VMGameObjectMarshal) { PlatformState = new VMTSOObjectState(Version); } else { PlatformState = new VMTSOAvatarState(Version); } PlatformState.Deserialize(reader); var datas = reader.ReadInt32(); ObjectData = new short[datas]; for (int i = 0; i < datas; i++) { ObjectData[i] = reader.ReadInt16(); } var listLen = reader.ReadInt32(); MyList = new short[listLen]; for (int i = 0; i < listLen; i++) { MyList[i] = reader.ReadInt16(); } if (reader.ReadBoolean()) { Headline = new VMRuntimeHeadlineMarshal(); Headline.Deserialize(reader); } GUID = reader.ReadUInt32(); MasterGUID = reader.ReadUInt32(); MainParam = reader.ReadInt16(); MainStackOBJ = reader.ReadInt16(); var contN = reader.ReadInt32(); Contained = new short[contN]; for (int i = 0; i < contN; i++) { Contained[i] = reader.ReadInt16(); } Container = reader.ReadInt16(); ContainerSlot = reader.ReadInt16(); var attrN = reader.ReadInt32(); Attributes = new short[attrN]; for (int i = 0; i < attrN; i++) { Attributes[i] = reader.ReadInt16(); } var relN = reader.ReadInt32(); MeToObject = new VMEntityRelationshipMarshal[relN]; for (int i = 0; i < relN; i++) { MeToObject[i] = new VMEntityRelationshipMarshal(); MeToObject[i].Deserialize(reader); } if (Version > 7) { var prelN = reader.ReadInt32(); MeToPersist = new VMEntityPersistRelationshipMarshal[prelN]; for (int i = 0; i < prelN; i++) { MeToPersist[i] = new VMEntityPersistRelationshipMarshal(); MeToPersist[i].Deserialize(reader); } } else { MeToPersist = new VMEntityPersistRelationshipMarshal[0]; } DynamicSpriteFlags = reader.ReadUInt64(); if (Version > 2) { DynamicSpriteFlags2 = reader.ReadUInt64(); } Position = new LotTilePos(); Position.Deserialize(reader); if (Version > 16) { TimestampLockoutCount = reader.ReadUInt32(); } if (Version > 19) { LightColor = new Color(reader.ReadUInt32()); } }
public void Deserialize(BinaryReader reader) { if (new string(reader.ReadChars(4)) != "FSOv") { return; } Version = reader.ReadInt32(); Compressed = reader.ReadBoolean(); var uReader = reader; if (Compressed) { var length = reader.ReadInt32(); var cStream = new MemoryStream(reader.ReadBytes(length)); var zipStream = new GZipStream(cStream, CompressionMode.Decompress); var decompStream = new MemoryStream(); zipStream.CopyTo(decompStream); decompStream.Seek(0, SeekOrigin.Begin); reader = new BinaryReader(decompStream); cStream.Close(); zipStream.Close(); } Context = new VMContextMarshal(Version); Context.Deserialize(reader); int ents = reader.ReadInt32(); Entities = new VMEntityMarshal[ents]; for (int i = 0; i < ents; i++) { var type = reader.ReadByte(); var ent = (type == 1) ? (VMEntityMarshal) new VMAvatarMarshal(Version) : new VMGameObjectMarshal(Version); ent.Deserialize(reader); Entities[i] = ent; } int thrN = reader.ReadInt32(); Threads = new VMThreadMarshal[thrN]; for (int i = 0; i < thrN; i++) { Threads[i] = new VMThreadMarshal(Version); Threads[i].Deserialize(reader); } int mtgN = reader.ReadInt32(); MultitileGroups = new VMMultitileGroupMarshal[mtgN]; for (int i = 0; i < mtgN; i++) { MultitileGroups[i] = new VMMultitileGroupMarshal(Version); MultitileGroups[i].Deserialize(reader); } int globs = reader.ReadInt32(); GlobalState = new short[globs]; for (int i = 0; i < globs; i++) { GlobalState[i] = reader.ReadInt16(); } //assume TSO for now PlatformState = new VMTSOLotState(Version); PlatformState.Deserialize(reader); ObjectId = reader.ReadInt16(); if (Compressed) { reader.BaseStream.Close(); } }