public override object Read(BinaryReader reader, byte version) { var dateTime = new DateTime(reader.ReadInt64()); OnSubscribe os = new OnSubscribe(reader.ReadString()); os.dateTime = dateTime; if (version >= 1 && reader.ReadBoolean()) { os.Subscription = new Subscription { SourceId = reader.ReadInt32(), ProviderId = reader.ReadInt32(), RouteId = reader.ReadInt32(), RequestId = reader.ReadInt32(), Symbol = reader.ReadString(), Instrument = (Instrument)this.StreamerManager.Deserialize(reader) }; } return(os); }
public override void Write(BinaryWriter writer, object obj) { OnSubscribe os = (OnSubscribe)obj; writer.Write(os.DateTime.Ticks); writer.Write(os.Symbol); if (this.version >= 1) { writer.Write(os.Subscription != null); if (os.Subscription != null) { writer.Write(os.Subscription.SourceId); writer.Write(os.Subscription.ProviderId); writer.Write(os.Subscription.RouteId); writer.Write(os.Subscription.RequestId); writer.Write(os.Subscription.Symbol); this.StreamerManager.Serialize(writer, os.Subscription.Instrument); } } }
public override object Read(BinaryReader reader, byte version) { var dateTime = new DateTime(reader.ReadInt64()); OnSubscribe os = new OnSubscribe(reader.ReadString()); os.dateTime = dateTime; if (version >= 1 && reader.ReadBoolean()) { os.Subscription = new Subscription { SourceId = reader.ReadInt32(), ProviderId = reader.ReadInt32(), RouteId = reader.ReadInt32(), RequestId = reader.ReadInt32(), Symbol = reader.ReadString(), Instrument = (Instrument)this.StreamerManager.Deserialize(reader) }; } return os; }