protected bool readBool(long pos) { object o = CachedPropertyValues == null ? null : CachedPropertyValues[pos]; if (o == null) { this.RecordInfo.Database.FileStream.Position = this.RecordInfo.Offset + pos; bool s = this.RecordInfo.Database.BinaryReader.ReadBoolean(); if (CachePropertyPositions != null && CachePropertyPositions.Contains(pos)) { CachedPropertyValues[pos] = s; } return(s); } else { return((bool)o); } }
protected string readString(long pos) { object o = CachedPropertyValues == null ? null : CachedPropertyValues[pos]; if (o == null) { this.RecordInfo.Database.FileStream.Position = this.RecordInfo.Offset + pos; string s = this.RecordInfo.Database.BinaryReader.ReadString(); if (CachePropertyPositions != null && CachePropertyPositions.Contains(pos)) { CachedPropertyValues[pos] = s; } return(s); } else { return(o as string); } }
protected virtual void StoreProperty(long pos, string name, object value) { if (pos >= 0 && value != null) { if (CachePropertyPositions != null && CachePropertyPositions.Contains(pos)) { CachedPropertyValues[pos] = value; } if (value.GetType() == typeof(string)) { this.RecordInfo.Database.FileStream.Position = this.RecordInfo.Offset + pos; this.RecordInfo.Database.BinaryWriter.Write(value as string); } else if (value.GetType() == typeof(DateTime)) { this.RecordInfo.Database.FileStream.Position = this.RecordInfo.Offset + pos; this.RecordInfo.Database.BinaryWriter.Write(Utils.Conversion.DateTimeToLong((DateTime)value)); } else if (value.GetType() == typeof(bool)) { this.RecordInfo.Database.FileStream.Position = this.RecordInfo.Offset + pos; this.RecordInfo.Database.BinaryWriter.Write((bool)value); } else if (value.GetType() == typeof(int)) { this.RecordInfo.Database.FileStream.Position = this.RecordInfo.Offset + pos; this.RecordInfo.Database.BinaryWriter.Write((int)value); } else if (value.GetType() == typeof(double)) { this.RecordInfo.Database.FileStream.Position = this.RecordInfo.Offset + pos; this.RecordInfo.Database.BinaryWriter.Write((double)value); } } }