public virtual void Read(BinaryReader reader) { reader.BaseStream.Seek(0, SeekOrigin.Begin); FileVersion = reader.ReadString(); reader.BaseStream.Position = FileVersionSize; Market = (EnumMarket)reader.ReadInt32(); BarType = (EnumBarType)reader.ReadInt32(); Period = reader.ReadInt32(); BeginTime = new DateTime(reader.ReadInt64()); EndTime = new DateTime(reader.ReadInt64()); BeginTradingDay = new DateTime(reader.ReadInt64()); EndTradingDay = new DateTime(reader.ReadInt64()); BarCount = reader.ReadInt32(); reader.BaseStream.Position = FILE_HEADER_SIZE; TradingDayIndices.Read(reader); NaturalDayIndices.Read(reader); MarkAsDirty(false); }
public virtual void Write(BinaryWriter writer) { if (_isDirty) { writer.BaseStream.Seek(0, SeekOrigin.Begin); writer.Write(FileVersion); writer.BaseStream.Position = FileVersionSize; writer.Write((int)Market); writer.Write((int)BarType); writer.Write(Period); writer.Write(BeginTime.Ticks); writer.Write(EndTime.Ticks); writer.Write(BeginTradingDay.Ticks); writer.Write(EndTradingDay.Ticks); writer.Write(BarCount); writer.BaseStream.Position = FILE_HEADER_SIZE; TradingDayIndices.Write(writer); NaturalDayIndices.Write(writer); MarkAsDirty(false); } }