public override void Serialize(ILittleEndianOutput out1) { out1.WriteShort(field_1_numcf); out1.WriteShort(field_2_need_recalculation); field_3_enclosing_cell_range.Serialize(out1); field_4_cell_ranges.Serialize(out1); }
public void TestStore() { CellRangeAddress cref = new CellRangeAddress(0, 0, 0, 0); byte[] recordBytes; //ByteArrayOutputStream baos = new ByteArrayOutputStream(); MemoryStream baos = new MemoryStream(); LittleEndianOutputStream output = new LittleEndianOutputStream(baos); try { // With nothing set cref.Serialize(output); recordBytes = baos.ToArray(); Assert.AreEqual(recordBytes.Length, data.Length); for (int i = 0; i < data.Length; i++) { Assert.AreEqual(0, recordBytes[i], "At offset " + i); } // Now set the flags cref.FirstRow = ((short)2); cref.LastRow = ((short)4); cref.FirstColumn = ((short)0); cref.LastColumn = ((short)3); // Re-test //baos.reset(); baos.Seek(0, SeekOrigin.Begin); cref.Serialize(output); recordBytes = baos.ToArray(); Assert.AreEqual(recordBytes.Length, data.Length); for (int i = 0; i < data.Length; i++) { Assert.AreEqual(data[i], recordBytes[i], "At offset " + i); } } finally { //output.Close(); } }
/** * @return byte array containing instance data */ public override int Serialize(int offset, byte[] data) { int dataSize = DataSize; LittleEndian.PutUShort(data, 0 + offset, sid); LittleEndian.PutUShort(data, 2 + offset, dataSize); LittleEndian.PutUShort(data, 4 + offset, field_1_numcf); LittleEndian.PutUShort(data, 6 + offset, field_2_need_recalculation); field_3_enclosing_cell_range.Serialize(8 + offset, data); field_4_cell_ranges.Serialize(16 + offset, data); return(4 + dataSize); }
public override void Serialize(ILittleEndianOutput out1) { _range.Serialize(out1); _guid.Serialize(out1); out1.WriteInt(0x00000002); // TODO const out1.WriteInt(_linkOpts); if ((_linkOpts & HLINK_LABEL) != 0) { out1.WriteInt(_label.Length); StringUtil.PutUnicodeLE(_label, out1); } if ((_linkOpts & HLINK_TARGET_FRAME) != 0) { out1.WriteInt(_targetFrame.Length); StringUtil.PutUnicodeLE(_targetFrame, out1); } if ((_linkOpts & HLINK_URL) != 0 && (_linkOpts & HLINK_UNC_PATH) != 0) { out1.WriteInt(_address.Length); StringUtil.PutUnicodeLE(_address, out1); } if ((_linkOpts & HLINK_URL) != 0 && (_linkOpts & HLINK_UNC_PATH) == 0) { _moniker.Serialize(out1); if (_moniker != null && URL_MONIKER.Equals(_moniker)) { if (_uninterpretedTail == null) { out1.WriteInt(_address.Length * 2); StringUtil.PutUnicodeLE(_address, out1); } else { out1.WriteInt(_address.Length * 2 + TAIL_SIZE); StringUtil.PutUnicodeLE(_address, out1); WriteTail(_uninterpretedTail, out1); } } else if (_moniker != null && FILE_MONIKER.Equals(_moniker)) { out1.WriteShort(_fileOpts); out1.WriteInt(_shortFilename.Length); StringUtil.PutCompressedUnicode(_shortFilename, out1); WriteTail(_uninterpretedTail, out1); if (string.IsNullOrEmpty(_address)) { out1.WriteInt(0); } else { int addrLen = _address.Length * 2; out1.WriteInt(addrLen + 6); out1.WriteInt(addrLen); out1.WriteShort(0x0003); // TODO const StringUtil.PutUnicodeLE(_address, out1); } } } if ((_linkOpts & HLINK_PLACE) != 0) { out1.WriteInt(_textMark.Length); StringUtil.PutUnicodeLE(_textMark, out1); } }
public void Serialize(ILittleEndianOutput out1) { out1.WriteShort(recordType); out1.WriteShort(grbitFrt); associatedRange.Serialize(out1); }