public static void Write(this BinaryWriter writer, StructureData data) { writer.Write((EntityData)data); writer.Write(data.StructureId); writer.Write(data.EntityId); writer.Write(data.PilotId); writer.Write(data.posMinimum); writer.Write(data.posMaximum); writer.Write(data.IsReady); writer.Write(data.IsPowered); writer.Write(data.IsOfflineProtectable); writer.Write(data.DamageLevel); writer.Write(data.FuelTank); writer.Write(data.OxygenTank); writer.Write(data.PentaxidTank); writer.Write <int>(data.DockedVessels, (d) => writer.Write(d)); writer.Write <int>(data.Passengers, (d) => writer.Write(d)); writer.Write <SignalData>(data.Signals, (s) => writer.Write(s)); writer.Write <SignalFunctionData>(data.SignalReceivers, (s) => writer.Write(s)); }
public static StructureData ReadStructureData(this BinaryReader reader) { StructureData data = new StructureData(); reader.ReadEntityData(data); data.StructureId = reader.ReadInt32(); data.EntityId = reader.ReadInt32(); data.PilotId = reader.ReadInt32(); data.posMinimum = reader.ReadVectorInt3(); data.posMaximum = reader.ReadVectorInt3(); data.IsReady = reader.ReadBoolean(); data.IsPowered = reader.ReadBoolean(); data.IsOfflineProtectable = reader.ReadBoolean(); data.DamageLevel = reader.ReadSingle(); data.FuelTank = reader.ReadTankData(); data.OxygenTank = reader.ReadTankData(); data.PentaxidTank = reader.ReadTankData(); data.DockedVessels = reader.ReadList <int>(() => reader.ReadInt32()); data.Passengers = reader.ReadList <int>(() => reader.ReadInt32()); data.Signals = reader.ReadList <SignalData>(() => reader.ReadSignalData()); data.SignalReceivers = reader.ReadList <SignalFunctionData>(() => reader.ReadSignalFunctionData()); return(data); }