public SerAuxTrend(IStreamReader reader, GraphRecordNumber id, ushort length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.regt = (TrendlineType)reader.ReadByte(); this.ordUser = reader.ReadByte(); //read the nullable double value (ChartNumNillable) var b = reader.ReadBytes(4); if (b[2] == 0xFF && b[3] == 0xFF) { this.numIntercept = null; } else { this.numIntercept = System.BitConverter.ToDouble(b, 0); } this.fEquation = Utils.ByteToBool(reader.ReadByte()); this.fRSquared = Utils.ByteToBool(reader.ReadByte()); this.numForecast = reader.ReadDouble(); this.numBackcast = reader.ReadDouble(); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public CrtLayout12(IStreamReader reader, RecordType id, ushort length) : base(reader, id, length) { this.frtHeader = new FrtHeader(reader); this.dwCheckSum = reader.ReadUInt32(); ushort flags = reader.ReadUInt16(); this.fLayoutTargetInner = Utils.BitmaskToBool(flags, 0x1); this.autolayouttype = (AutoLayoutType)Utils.BitmaskToInt(flags, 0xE); if (id == RecordType.CrtLayout12A) { this.xTL = reader.ReadInt16(); this.yTL = reader.ReadInt16(); this.xBR = reader.ReadInt16(); this.yBR = reader.ReadInt16(); } this.wXMode = (CrtLayout12Mode)reader.ReadUInt16(); this.wYMode = (CrtLayout12Mode)reader.ReadUInt16(); this.wWidthMode = (CrtLayout12Mode)reader.ReadUInt16(); this.wHeightMode = (CrtLayout12Mode)reader.ReadUInt16(); this.x = reader.ReadDouble(); this.y = reader.ReadDouble(); this.dx = reader.ReadDouble(); this.dy = reader.ReadDouble(); reader.ReadBytes(2); //reserved // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public ValueRange(IStreamReader reader, GraphRecordNumber id, ushort length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.numMin = reader.ReadDouble(); this.numMax = reader.ReadDouble(); this.numMajor = reader.ReadDouble(); this.numMinor = reader.ReadDouble(); this.numCross = reader.ReadDouble(); ushort flags = reader.ReadUInt16(); this.fAutoMin = Utils.BitmaskToBool(flags, 0x0001); this.fAutoMax = Utils.BitmaskToBool(flags, 0x0002); this.fAutoMajor = Utils.BitmaskToBool(flags, 0x0004); this.fAutoMinor = Utils.BitmaskToBool(flags, 0x0008); this.fAutoCross = Utils.BitmaskToBool(flags, 0x0010); this.fLog = Utils.BitmaskToBool(flags, 0x0020); this.fReversed = Utils.BitmaskToBool(flags, 0x0040); this.fMaxCross = Utils.BitmaskToBool(flags, 0x0080); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public Setup(IStreamReader reader, RecordType id, ushort length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); this.iPaperSize = reader.ReadUInt16(); this.iScale = reader.ReadUInt16(); this.iPageStart = reader.ReadUInt16(); this.iFitWidth = reader.ReadUInt16(); this.iFitHeight = reader.ReadUInt16(); this.grbit = reader.ReadUInt16(); this.iRes = reader.ReadUInt16(); this.iVRes = reader.ReadUInt16(); this.numHdr = reader.ReadDouble(); this.numFtr = reader.ReadDouble(); this.iCopies = reader.ReadUInt16(); // set flags this.fLeftToRight = Utils.BitmaskToBool(this.grbit, 0x01); this.fPortrait = Utils.BitmaskToBool(this.grbit, 0x02); this.fNoPls = Utils.BitmaskToBool(this.grbit, 0x04); this.fNoColor = Utils.BitmaskToBool(this.grbit, 0x08); this.fDraft = Utils.BitmaskToBool(this.grbit, 0x010); this.fNotes = Utils.BitmaskToBool(this.grbit, 0x020); this.fNoOrient = Utils.BitmaskToBool(this.grbit, 0x040); this.fUsePage = Utils.BitmaskToBool(this.grbit, 0x080); this.fEndNotes = Utils.BitmaskToBool(this.grbit, 0x080); this.iErrors = (this.grbit & 0x0C00) << 0x0A; }
public override object ReadValue(IStreamReader reader, ISerializeContext context) { return(NullableRead(reader, () => { return reader.ReadDouble(); })); }
public RightMargin(IStreamReader reader, RecordType id, UInt16 length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); this.value = reader.ReadDouble(); }
public XmlTkDouble(IStreamReader reader) { this.xtHeader = new XmlTkHeader(reader); //unused reader.ReadBytes(4); this.dValue = reader.ReadDouble(); }
public SerAuxTrend(IStreamReader reader, RecordType id, ushort length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.regt = (TrendlineType)reader.ReadByte(); this.ordUser = reader.ReadByte(); //read the nullable double value (ChartNumNillable) this.numIntercept = new ChartNumNillable(reader).value; this.fEquation = Utils.ByteToBool(reader.ReadByte()); this.fRSquared = Utils.ByteToBool(reader.ReadByte()); this.numForecast = reader.ReadDouble(); this.numBackcast = reader.ReadDouble(); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
/// <summary> /// Ctor /// </summary> /// <param name="reader">Streamreader</param> /// <param name="id">Record ID - Recordtype</param> /// <param name="length">The recordlegth</param> public Number(IStreamReader reader, GraphRecordNumber id, UInt16 length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); this.rw = reader.ReadUInt16(); this.col = reader.ReadUInt16(); reader.ReadByte(); this.ixfe = reader.ReadUInt16(); this.num = reader.ReadDouble(); // assert that the correct number of bytes has been read from the stream // Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public SerAuxErrBar(IStreamReader reader, RecordType id, UInt16 length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.sertm = (ErrorBarDirection)reader.ReadByte(); this.ebsrc = (ErrorAmoutType)reader.ReadByte(); this.fTeeTop = Utils.ByteToBool(reader.ReadByte()); reader.ReadByte(); // reserved this.numValue = reader.ReadDouble(); reader.ReadBytes(2); //unused // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public YMult(IStreamReader reader, RecordType id, ushort length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.frtHeaderOld = new FrtHeaderOld(reader); this.axmid = (AxisMultiplier)reader.ReadInt16(); this.numLabelMultiplier = reader.ReadDouble(); ushort flags = reader.ReadUInt16(); this.fAutoShowMultiplier = Utils.BitmaskToBool(flags, 0x0002); this.fBeingEdited = Utils.BitmaskToBool(flags, 0x0004); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public PicF(IStreamReader reader, RecordType id, ushort length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.ptyp = (LayoutType)reader.ReadInt16(); reader.ReadBytes(2); //unused ushort flags = reader.ReadUInt16(); // first 9 bits are reserved this.fTopBottom = Utils.BitmaskToBool(flags, 0x200); this.fBackFront = Utils.BitmaskToBool(flags, 0x400); this.fSide = Utils.BitmaskToBool(flags, 0x800); this.numScale = reader.ReadDouble(); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public BopPop(IStreamReader reader, GraphRecordNumber id, UInt16 length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.pst = (Subtype)reader.ReadByte(); this.fAutoSplit = !(reader.ReadByte() == 0x0); this.split = (SplitType)reader.ReadUInt16(); this.iSplitPos = reader.ReadInt16(); this.pcSplitPercent = reader.ReadInt16(); this.pcPie2Size = reader.ReadInt16(); this.pcGap = reader.ReadInt16(); this.numSplitValue = reader.ReadDouble(); this.fHasShadow = Utils.BitmaskToBool(reader.ReadUInt16(), 0x0001); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
private void ReadData(int dataTypeCd, WireMessage message, IStreamReader reader) { switch ((TypeCode)dataTypeCd) { case TypeCode.Boolean: message.Data = reader.ReadBoolean(); break; case TypeCode.Byte: message.Data = reader.ReadByte(); break; case TypeCode.Char: message.Data = reader.ReadChar(); break; case TypeCode.DateTime: message.Data = new DateTime(reader.ReadInt64()); break; case TypeCode.DBNull: reader.ReadByte(); message.Data = DBNull.Value; break; case TypeCode.Decimal: message.Data = reader.ReadDecimal(); break; case TypeCode.Double: message.Data = reader.ReadDouble(); break; case TypeCode.Empty: reader.ReadByte(); break; case TypeCode.Int16: message.Data = reader.ReadInt16(); break; case TypeCode.Int32: message.Data = reader.ReadInt32(); break; case TypeCode.Int64: message.Data = reader.ReadInt64(); break; case TypeCode.SByte: message.Data = reader.ReadSByte(); break; case TypeCode.Single: message.Data = reader.ReadSingle(); break; case TypeCode.String: message.Data = ReadString(reader); break; case TypeCode.UInt16: message.Data = reader.ReadUInt16(); break; case TypeCode.UInt32: message.Data = reader.ReadUInt32(); break; case TypeCode.UInt64: message.Data = reader.ReadUInt64(); break; default: { var len = reader.ReadInt32(); if (len > 0) { using (var tempStream = new ChunkedStream()) { var chunkSize = tempStream.ChunkSize; while (len > 0) { var bytes = reader.ReadBytes(chunkSize); var readLen = bytes?.Length ?? 0; if (readLen == 0) { throw new Exception(SerializationErrors.StreamNotContainingValidWireMessage); } len -= readLen; tempStream.Write(bytes, 0, readLen); } tempStream.Position = 0; message.Data = GetSerializer().Deserialize(tempStream); } } } break; } }
public Formula(IStreamReader reader, RecordType id, ushort length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); this.val = new byte[8]; this.rw = reader.ReadUInt16(); this.col = reader.ReadUInt16(); this.ixfe = reader.ReadUInt16(); this.boolValueSet = false; long oldStreamPosition = this.Reader.BaseStream.Position; this.val = reader.ReadBytes(8); // read 8 bytes for the value of the formular if (this.val[6] == 0xFF && this.val[7] == 0xFF) { // this value is a string, an error or a boolean value byte firstOffset = this.val[0]; if (firstOffset == 1) { // this is a boolean value this.boolValue = this.val[2]; this.boolValueSet = true; } if (firstOffset == 2) { // this is a error value this.errorValue = (int)this.val[2]; } } else { this.Reader.BaseStream.Seek(oldStreamPosition, System.IO.SeekOrigin.Begin); this.calculatedValue = reader.ReadDouble(); } this.grbit = reader.ReadUInt16(); this.chn = reader.ReadUInt32(); // this is used for performance reasons only this.cce = reader.ReadUInt16(); this.ptgStack = new Stack <AbstractPtg>(); // reader.ReadBytes(this.cce); // check always calc mode this.fAlwaysCalc = Utils.BitmaskToBool((int)this.grbit, 0x01); // check if shared formula this.fShrFmla = Utils.BitmaskToBool((int)this.grbit, 0x08); oldStreamPosition = this.Reader.BaseStream.Position; if (!this.fShrFmla) { try { this.ptgStack = ExcelHelperClass.getFormulaStack(this.Reader, this.cce); } catch (Exception ex) { this.Reader.BaseStream.Seek(oldStreamPosition, System.IO.SeekOrigin.Begin); this.Reader.BaseStream.Seek(this.cce, System.IO.SeekOrigin.Current); TraceLogger.Error("Formula parse error in Row {0} Column {1}", this.rw, this.col); TraceLogger.Debug(ex.StackTrace); TraceLogger.Debug("Inner exception: {0}", ex.InnerException.StackTrace); } } else { reader.ReadBytes(this.cce); } // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }