public override object ReadValue(IStreamReader reader, ISerializeContext context) { return(NullableRead(reader, () => { var guidBytes = reader.ReadBytes(16); Guid guid = new Guid(guidBytes.ToArray()); return guid; })); }
public GelFrame(IStreamReader reader, RecordType id, UInt16 length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // copy data to a memory stream to cope with Continue records using (MemoryStream ms = new MemoryStream()) { byte[] buffer = reader.ReadBytes(length); ms.Write(buffer, 0, length); if (BiffRecord.GetNextRecordType(reader) == RecordType.GelFrame) { RecordType nextId = (RecordType)reader.ReadUInt16(); UInt16 nextLength = reader.ReadUInt16(); buffer = reader.ReadBytes(nextLength); ms.Write(buffer, 0, nextLength); } while (BiffRecord.GetNextRecordType(reader) == RecordType.Continue) { RecordType nextId = (RecordType)reader.ReadUInt16(); UInt16 nextLength = reader.ReadUInt16(); buffer = reader.ReadBytes(nextLength); ms.Write(buffer, 0, nextLength); } ms.Position = 0; // initialize class members from stream this.OPT1 = Record.ReadRecord(ms); if (ms.Position < ms.Length) { this.OPT2 = Record.ReadRecord(ms); } } // assert that the correct number of bytes has been read from the stream //Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public SheetExtOptional(IStreamReader reader) { UInt32 field = reader.ReadUInt32(); this.icvPlain = Utils.BitmaskToUInt32(field, 0x003F); this.fCondFmtCalc = Utils.BitmaskToBool(field, 0x0040); this.fNotPublished = Utils.BitmaskToBool(field, 0x0080); this.color = reader.ReadBytes(16); }
public PtgRefErr(IStreamReader reader, PtgNumber ptgid) : base(reader, ptgid) { Debug.Assert(this.Id == ID); this.Length = 5; this.Data = "#REF!"; this.type = PtgType.Operand; reader.ReadBytes(4); }
public ObjectParsedFormula(IStreamReader reader) { this.cce = Utils.BitmaskToUInt16(reader.ReadUInt16(), 0x7FFF); reader.ReadBytes(4); if (this.cce > 0) { this.formula = ExcelHelperClass.getFormulaStack(reader, this.cce); } }
//public ObjectParsedFormula fmla; //public PictFmlaEmbedInfo embedInfo; public ObjFmla(IStreamReader reader) { this.cbFmla = reader.ReadUInt16(); //this.fmla = new ObjectParsedFormula(reader); // TODO: place implemenation here // read padding bytes reader.ReadBytes(this.cbFmla); }
public PtgArray(IStreamReader reader, PtgNumber ptgid) : base(reader, ptgid) { Debug.Assert(this.Id == ID); this.Length = 4; this.Data = "ARRAY"; this.type = PtgType.Operand; this.popSize = 1; DataBytes = reader.ReadBytes(3); }
public FtCblsData(IStreamReader reader) { this.ft = reader.ReadUInt16(); this.cb = reader.ReadUInt16(); // TODO: place implemenation here // skip remaining bytes until implementation is not completed reader.ReadBytes(this.cb); }
public RichTextStream(IStreamReader reader, RecordType id, UInt16 length) : base(reader, id, length) { this.frtHeader = new FrtHeader(reader); this.dwCheckSum = reader.ReadUInt32(); this.cb = reader.ReadUInt32(); Encoding codepage = Encoding.GetEncoding(1252); this.rgb = codepage.GetString(reader.ReadBytes((int)this.cb)); }
public PtgAreaErr(IStreamReader reader, PtgNumber ptgid) : base(reader, ptgid) { Debug.Assert(this.Id == ID); this.Length = 9; this.Data = ""; this.type = PtgType.Operand; reader.ReadBytes(8); }
public RichTextStream(IStreamReader reader, RecordType id, ushort length) : base(reader, id, length) { this.frtHeader = new FrtHeader(reader); this.dwCheckSum = reader.ReadUInt32(); this.cb = reader.ReadUInt32(); var codepage = Encoding.GetEncoding("ISO-8859-1"); // windows-1252 not supported by platform this.rgb = codepage.GetString(reader.ReadBytes((int)this.cb)); }
public Window2Graph(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 // ignore reserved bytes reader.ReadBytes(5); this.rowFirst = reader.ReadUInt16(); this.colFirst = reader.ReadUInt16(); // ignore reserved bytes reader.ReadBytes(5); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public PtgAreaErr3d(IStreamReader reader, PtgNumber ptgid) : base(reader, ptgid) { Debug.Assert(this.Id == ID); this.Length = 11; this.Data = "#REF!"; this.type = PtgType.Operand; this.ixti = reader.ReadUInt16(); reader.ReadBytes(8); }
public TxO(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 ushort flags = reader.ReadUInt16(); this.hAlignment = (HorizontalAlignment)Utils.BitmaskToInt(flags, 0xE); this.vAlignment = (VerticalAlignment)Utils.BitmaskToInt(flags, 0x70); this.rot = (TextRotation)reader.ReadUInt16(); reader.ReadBytes(6); // reserved this.cchText = reader.ReadUInt16(); this.cbRuns = reader.ReadUInt16(); this.ifntEmpty = reader.ReadUInt16(); 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 Units(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 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 CrtMlFrt(IStreamReader reader, RecordType id, ushort length) : base(reader, id, length) { long pos = reader.BaseStream.Position; this.frtHeader = new FrtHeader(reader); this.cb = reader.ReadUInt32(); this.xmltkChain = new XmlTkChain(reader); reader.ReadBytes(4); // unused reader.BaseStream.Position = pos + length; }
public MaxStatus(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 reader.ReadBytes(2); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public Pos(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.mdTopLt = (PositionMode)reader.ReadInt16(); this.mdBotRt = (PositionMode)reader.ReadInt16(); this.x1 = reader.ReadInt16(); reader.ReadBytes(2); // skip 2 bytes this.y1 = reader.ReadInt16(); reader.ReadBytes(2); // skip 2 bytes this.x2 = reader.ReadInt16(); reader.ReadBytes(2); // skip 2 bytes this.y2 = reader.ReadInt16(); reader.ReadBytes(2); // skip 2 bytes // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
//public Byte[] ToByteArray() //{ // MemoryStream ms // = new MemoryStream(128); // BinaryWriter bw = new BinaryWriter(ms); // byte[] paddedName = new byte[64]; // Array.Copy(entryName, paddedName, entryName.Length); // bw.Write(paddedName); // bw.Write(nameLength); // bw.Write((byte)stgType); // bw.Write((byte)stgColor); // bw.Write(leftSibling); // bw.Write(rightSibling); // bw.Write(child); // bw.Write(storageCLSID.ToByteArray()); // bw.Write(stateBits); // bw.Write(creationDate); // bw.Write(modifyDate); // bw.Write(startSetc); // bw.Write(size); // return ms.ToArray(); //} public void Read(Stream stream, CFSVersion ver = CFSVersion.Ver_3) { IStreamReader rw = stream.ToStreamReader(); entryName = rw.ReadBytes(64); nameLength = rw.ReadUInt16(); stgType = (StgType)rw.ReadByte(); //rw.ReadByte();//Ignore color, only black tree stgColor = (StgColor)rw.ReadByte(); leftSibling = rw.ReadInt32(); rightSibling = rw.ReadInt32(); child = rw.ReadInt32(); // Thanks to bugaccount (BugTrack id 3519554) if (stgType == StgType.StgInvalid) { leftSibling = NOSTREAM; rightSibling = NOSTREAM; child = NOSTREAM; } storageCLSID = new Guid(rw.ReadBytes(16)); stateBits = rw.ReadInt32(); CreationDate = rw.ReadBytes(8); ModifyDate = rw.ReadBytes(8); startSetc = rw.ReadInt32(); if (ver == CFSVersion.Ver_3) { // avoid dirty read for version 3 files (max size: 32bit integer) // where most significant bits are not initialized to zero size = rw.ReadInt32(); rw.ReadInt32(); //rw.ReadBytes(4); //discard most significant 4 (possibly) dirty bytes } else { size = rw.ReadInt64(); } }
public Obj(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 // TODO: place code here reader.ReadBytes(length); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public ChartNumNillable(IStreamReader reader) { //read the nullable double value byte[] b = reader.ReadBytes(8); if (b[6] == 0xFF && b[7] == 0xFF) { this.value = null; } else { this.value = System.BitConverter.ToDouble(b, 0); } }
public CrtLink(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 record is written but unused. reader.ReadBytes(10); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public Country(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 // content is completely ignored reader.ReadBytes(4); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public Pls(IStreamReader reader, RecordType id, ushort length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); using (var ms = new MemoryStream()) { var buffer = reader.ReadBytes(length); ms.Write(buffer, 0, length); while (BiffRecord.GetNextRecordType(reader) == RecordType.Pls) { var nextId = (RecordType)reader.ReadUInt16(); ushort nextLength = reader.ReadUInt16(); buffer = reader.ReadBytes(nextLength); ms.Write(buffer, 0, nextLength); } while (BiffRecord.GetNextRecordType(reader) == RecordType.Continue) { var nextId = (RecordType)reader.ReadUInt16(); ushort nextLength = reader.ReadUInt16(); buffer = reader.ReadBytes(nextLength); ms.Write(buffer, 0, nextLength); } ms.Position = 0; // initialize class members from stream this.rgb = new byte[ms.Length]; ms.Read(this.rgb, 0, (int)ms.Length); // assert that the correct number of bytes has been read from the stream //Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); } }
public Radar(IStreamReader reader, RecordType id, UInt16 length) : base(reader, id, length) { // initialize class members from stream UInt16 flags = reader.ReadUInt16(); this.fRdrAxLab = Utils.BitmaskToBool(flags, 0x1); this.fHasShadow = Utils.BitmaskToBool(flags, 0x2); 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); }
/// <summary> /// This method reads x bytes from a IStreamReader to get a hyperlink string from this /// </summary> /// <param name="reader"></param> /// <param name="cch"></param> /// <param name="grbit"></param> /// <returns></returns> public static string getHyperlinkStringFromBiffRecord(IStreamReader reader) { string value = ""; uint length = reader.ReadUInt32(); for (int i = 0; i < length; i++) { value += System.BitConverter.ToChar(reader.ReadBytes(2), 0); } return(value.Remove(value.Length - 1));; }
public SeriesText(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 reader.ReadBytes(2); // reserved this.stText = Utils.ReadShortXlUnicodeString(reader.BaseStream); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public ControlInfo(IStreamReader reader) { ushort flags = reader.ReadUInt16(); this.fDefault = Utils.BitmaskToBool(flags, 0x0001); this.fHelp = Utils.BitmaskToBool(flags, 0x0002); this.fCancel = Utils.BitmaskToBool(flags, 0x0004); this.fDismiss = Utils.BitmaskToBool(flags, 0x0008); this.accel1 = reader.ReadInt16(); reader.ReadBytes(2); }
public BOFDatasheet(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 // the content of this record is to be ignored reader.ReadBytes(4); // 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 RK(IStreamReader reader, RecordType 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(); this.ixfe = reader.ReadUInt16(); this.num = ExcelHelperClass.NumFromRK(reader.ReadBytes(4)); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public static async Task<IHttpPost> Create(IStreamReader reader, int postContentLength, ILog logger) { byte[] raw = await reader.ReadBytes(postContentLength).ConfigureAwait(false); return new HttpPost(raw, postContentLength); }