Esempio n. 1
0
 public override void Serialize(LittleEndianOutput out1)
 {
     out1.WriteShort(_encryptionType);
     out1.WriteShort(_encryptionInfo);
     out1.WriteShort(_minorVersionNo);
     out1.Write(_docId);
     out1.Write(_saltData);
     out1.Write(_saltHash);
 }
Esempio n. 2
0
        public override void Serialize(LittleEndianOutput out1)
        {
            int field_4_name_length    = field_6_name_text.Length;
            int field_5_comment_length = field_7_comment_text.Length;

            out1.WriteShort(field_1_record_type);
            out1.WriteShort(field_2_frt_cell_ref_flag);
            out1.WriteLong(field_3_reserved);
            out1.WriteShort(field_4_name_length);
            out1.WriteShort(field_5_comment_length);

            out1.WriteByte(0);
            out1.Write(Encoding.UTF8.GetBytes(field_6_name_text));
            out1.WriteByte(0);
            out1.Write(Encoding.UTF8.GetBytes(field_7_comment_text));
        }
Esempio n. 3
0
 public override void Serialize(LittleEndianOutput out1)
 {
     out1.WriteShort(rt);
     out1.WriteShort(grbitFrt);
     out1.WriteShort(iObjectKind);
     // 6 bytes unused
     out1.Write(unused);
 }
Esempio n. 4
0
 public override void Serialize(LittleEndianOutput out1)
 {
     out1.WriteShort(rt);
     out1.WriteShort(grbitFrt);
     out1.WriteShort(iObjectKind);
     // 6 bytes unused
     out1.Write(unused);
 }
        public override void Serialize(LittleEndianOutput out1)
        {
            out1.WriteShort(rt);
            out1.WriteShort(grbitFrt);
            out1.Write(unused);
            out1.WriteInt(cts);

            out1.WriteShort(rgchDefListStyle.Length);
            out1.WriteShort(rgchDefPivotStyle.Length);

            StringUtil.PutUnicodeLE(rgchDefListStyle, out1);
            StringUtil.PutUnicodeLE(rgchDefPivotStyle, out1);
        }
        public override void Serialize(LittleEndianOutput out1)
        {
            out1.WriteShort(rt);
            out1.WriteShort(grbitFrt);
            out1.Write(unused);
            out1.WriteInt(cts);

            out1.WriteShort(rgchDefListStyle.Length);
            out1.WriteShort(rgchDefPivotStyle.Length);

            StringUtil.PutUnicodeLE(rgchDefListStyle, out1);
            StringUtil.PutUnicodeLE(rgchDefPivotStyle, out1);
        }
Esempio n. 7
0
 public static void PutUnicodeLE(String input, LittleEndianOutput out1)
 {
     byte[] bytes;
     try
     {
         bytes = Encoding.GetEncoding("UTF-16LE").GetBytes(input);
     }
     catch (EncoderFallbackException e)
     {
         throw;
     }
     out1.Write(bytes);
 }
Esempio n. 8
0
 public static void PutCompressedUnicode(String input, LittleEndianOutput out1)
 {
     byte[] bytes;
     try
     {
         bytes = Encoding.GetEncoding(ENCODING).GetBytes(input);
     }
     catch (EncoderFallbackException e)
     {
         throw;
     }
     out1.Write(bytes);
 }
 /**
  * Finishes writing the current record and updates 'ushort size' field.<br/>
  * After this method is called, only {@link #getTotalSize()} may be called.
  */
 public void Terminate()
 {
     if (_out == null)
     {
         throw new InvalidOperationException("Record already terminated");
     }
     _dataSizeOutput.WriteShort(_size);
     if (_byteBuffer != null)
     {
         _originalOut.Write(_byteBuffer, 0, _size);
         _out = null;
         return;
     }
     _out = null;
 }
Esempio n. 10
0
        public override void Serialize(LittleEndianOutput out1)
        {
            String username = Username;
            bool   is16bit  = StringUtil.HasMultibyte(username);

            out1.WriteShort(username.Length);
            out1.WriteByte(is16bit ? 0x01 : 0x00);
            if (is16bit)
            {
                StringUtil.PutUnicodeLE(username, out1);
            }
            else
            {
                StringUtil.PutCompressedUnicode(username, out1);
            }
            int encodedByteCount = 3 + username.Length * (is16bit ? 2 : 1);
            int paddingSize      = DATA_SIZE - encodedByteCount;

            out1.Write(PADDING, 0, paddingSize);
        }
Esempio n. 11
0
 /**
  * Serialize the record data into the supplied array of bytes
  *
  * @param offset offset in the <c>data</c>
  * @param data the data to Serialize into
  *
  * @return size of the record
  */
 public override void Serialize(LittleEndianOutput out1)
 {
     out1.WriteShort(sid);
     out1.WriteShort(reserved.Length);
     out1.Write(reserved);
 }
Esempio n. 12
0
 public override void Serialize(LittleEndianOutput out1)
 {
     out1.WriteShort(_sid);
      out1.WriteShort(_data.Length);
      out1.Write(_data);
 }
 public override void Serialize(LittleEndianOutput out1)
 {
     out1.WriteShort(rt);
     out1.WriteShort(grbitFrt);
     out1.Write(unused);
 }
Esempio n. 14
0
 //public void Serialize(byte[] data, int offset)
 //{
 //    System.Array.Copy(_variableData, 0, data, offset, VARIABLE_DATA_LENGTH);
 //    LittleEndian.PutUShort(data, offset + VARIABLE_DATA_LENGTH, 0xFFFF);
 //}
 public void Serialize(LittleEndianOutput out1)
 {
     out1.Write(_variableData);
     out1.WriteShort(0xFFFF);
 }
Esempio n. 15
0
 //public void Serialize(byte[] data, int offset)
 //{
 //    System.Array.Copy(_variableData, 0, data, offset, VARIABLE_DATA_LENGTH);
 //    LittleEndian.PutUShort(data, offset + VARIABLE_DATA_LENGTH, 0xFFFF);
 //}
 public void Serialize(LittleEndianOutput out1)
 {
     out1.Write(_variableData);
     out1.WriteShort(0xFFFF);
 }
Esempio n. 16
0
        public void SerializeArrayConstantData(LittleEndianOutput out1)
        {
            int len = _byteEncoding.Length - _encodedTokenLen;

            out1.Write(_byteEncoding, _encodedTokenLen, len);
        }
Esempio n. 17
0
 private static void WriteTail(byte[] tail, LittleEndianOutput out1)
 {
     out1.Write(tail);
 }
Esempio n. 18
0
 /**
  * spit the record out AS IS. no interpretation or identification
  */
 public override void Serialize(LittleEndianOutput out1)
 {
     out1.Write(_rawData);
 }
Esempio n. 19
0
 private static void WriteTail(byte[] tail, LittleEndianOutput out1)
 {
     out1.Write(tail);
 }
        public override void Serialize(LittleEndianOutput out1)
        {
            int formulaSize = field_2_refPtg == null ? field_2_unknownFormulaData.Length : field_2_refPtg.Size;
            int idOffset = GetStreamIDOffset(formulaSize);
            int dataSize = GetDataSize(idOffset);


		    out1.WriteShort(sid);
		    out1.WriteShort(dataSize);

		    out1.WriteShort(idOffset);
		    out1.WriteShort(formulaSize);
		    out1.WriteInt(field_1_unknown_int);

            int pos = 12;

            if (field_2_refPtg == null)
            {
                out1.Write(field_2_unknownFormulaData);
            }
            else
            {
                field_2_refPtg.Write(out1);
            }
            pos += formulaSize;

            int stringLen;
            if (field_4_ole_classname == null)
            {
                // don't write 0x03, stringLen, flag, text
                stringLen = 0;
            }
            else
            {
                out1.WriteByte(0x03);
                pos += 1;
                stringLen = field_4_ole_classname.Length;
                out1.WriteShort(stringLen);
                pos += 2;
                if (stringLen > 0)
                {
                    out1.WriteByte(field_3_unicode_flag ? 0x01 : 0x00);
                    pos += 1;

                    if (field_3_unicode_flag)
                    {
                        StringUtil.PutUnicodeLE(field_4_ole_classname, out1);
                        pos += stringLen * 2;
                    }
                    else
                    {
                        StringUtil.PutCompressedUnicode(field_4_ole_classname, out1);
                        pos += stringLen;
                    }
                }
            }

            // pad to next 2-byte boundary (requires 0 or 1 bytes)
            switch (idOffset - (pos - 6 ))
            { // 6 for 3 shorts: sid, dataSize, idOffset
                case 1:
                    out1.WriteByte(field_4_unknownByte == null ? 0x00 : Convert.ToByte(field_4_unknownByte));
                    pos++;
                    break;
                case 0:
                    break;
                default:
                    throw new InvalidOperationException("Bad padding calculation (" + idOffset + ", " + pos + ")");
            }

            if (field_5_stream_id != null)
            {
                out1.WriteInt(Convert.ToInt32(field_5_stream_id));
                pos += 4;
            }
            out1.Write(field_6_unknown);
        }
        public override void Serialize(LittleEndianOutput out1)
        {
            String username = Username;
            bool is16bit = StringUtil.HasMultibyte(username);

            out1.WriteShort(username.Length);
            out1.WriteByte(is16bit ? 0x01 : 0x00);
            if (is16bit)
            {
                StringUtil.PutUnicodeLE(username, out1);
            }
            else
            {
                StringUtil.PutCompressedUnicode(username, out1);
            }
            int encodedByteCount = 3 + username.Length * (is16bit ? 2 : 1);
            int paddingSize = DATA_SIZE - encodedByteCount;
            out1.Write(PADDING, 0, paddingSize);
        }
Esempio n. 22
0
 public void SerializeArrayConstantData(LittleEndianOutput out1)
 {
     int len = _byteEncoding.Length - _encodedTokenLen;
     out1.Write(_byteEncoding, _encodedTokenLen, len);
 }
Esempio n. 23
0
 public void SerializeTokens(LittleEndianOutput out1)
 {
     out1.Write(_byteEncoding, 0, _encodedTokenLen);
 }
Esempio n. 24
0
 public override void Write(LittleEndianOutput out1)
 {
     out1.WriteByte(sid + PtgClass);
     out1.Write(field_1_reserved);
 }
Esempio n. 25
0
 public override void Serialize(LittleEndianOutput out1)
 {
     out1.WriteShort(rt);
     out1.WriteShort(grbitFrt);
     out1.Write(unused);
 }
Esempio n. 26
0
 public void SerializeTokens(LittleEndianOutput out1)
 {
     out1.Write(_byteEncoding, 0, _encodedTokenLen);
 }
Esempio n. 27
0
 /**
  * Writes  The formula encoding is includes:
  * <ul>
  * <li>ushort tokenDataLen</li>
  * <li>tokenData</li>
  * <li>arrayConstantData (if present)</li>
  * </ul>
  */
 public void Serialize(LittleEndianOutput out1)
 {
     out1.WriteShort(_encodedTokenLen);
     out1.Write(_byteEncoding);
 }
 /**
  * Serialize the record data into the supplied array of bytes
  *
  * @param offset offset in the <c>data</c>
  * @param data the data to Serialize into
  *
  * @return size of the record
  */
 public override void Serialize(LittleEndianOutput out1)
 {
     out1.WriteShort(sid);
     out1.WriteShort(reserved.Length);
     out1.Write(reserved);
 }
Esempio n. 29
0
 /**
  * spit the record out AS IS. no interpretation or identification
  */
 public override void Serialize(LittleEndianOutput out1)
 {
     out1.Write(_rawData);
 }
Esempio n. 30
0
    public override void Write(LittleEndianOutput out1)
    {
   		out1.WriteByte(sid + PtgClass);
 		out1.Write(field_1_reserved);
    }
 public void Write(byte[] b)
 {
     _out.Write(b);
     _size += b.Length;
 }
Esempio n. 32
0
        public override void Serialize(LittleEndianOutput out1)
        {
            int field_4_name_length = field_6_name_text.Length;
            int field_5_comment_length = field_7_comment_text.Length;

            out1.WriteShort(field_1_record_type);
            out1.WriteShort(field_2_frt_cell_ref_flag);
            out1.WriteLong(field_3_reserved);
            out1.WriteShort(field_4_name_length);
            out1.WriteShort(field_5_comment_length);

            out1.WriteByte(0);
            out1.Write(Encoding.UTF8.GetBytes(field_6_name_text));
            out1.WriteByte(0);
            out1.Write(Encoding.UTF8.GetBytes(field_7_comment_text));
        }
Esempio n. 33
0
 public override void Serialize(LittleEndianOutput out1)
 {
     out1.WriteShort(_sid);
     out1.WriteShort(_data.Length);
     out1.Write(_data);
 }
Esempio n. 34
0
 /**
  * Writes  The formula encoding is includes:
  * <ul>
  * <li>ushort tokenDataLen</li>
  * <li>tokenData</li>
  * <li>arrayConstantData (if present)</li>
  * </ul>
  */
 public void Serialize(LittleEndianOutput out1)
 {
     out1.WriteShort(_encodedTokenLen);
     out1.Write(_byteEncoding);
 }
Esempio n. 35
0
        public override void Serialize(LittleEndianOutput out1)
        {
            int formulaSize = field_2_refPtg == null ? field_2_unknownFormulaData.Length : field_2_refPtg.Size;
            int idOffset    = GetStreamIDOffset(formulaSize);
            int dataSize    = GetDataSize(idOffset);


            out1.WriteShort(sid);
            out1.WriteShort(dataSize);

            out1.WriteShort(idOffset);
            out1.WriteShort(formulaSize);
            out1.WriteInt(field_1_unknown_int);

            int pos = 12;

            if (field_2_refPtg == null)
            {
                out1.Write(field_2_unknownFormulaData);
            }
            else
            {
                field_2_refPtg.Write(out1);
            }
            pos += formulaSize;

            int stringLen;

            if (field_4_ole_classname == null)
            {
                // don't write 0x03, stringLen, flag, text
                stringLen = 0;
            }
            else
            {
                out1.WriteByte(0x03);
                pos      += 1;
                stringLen = field_4_ole_classname.Length;
                out1.WriteShort(stringLen);
                pos += 2;
                if (stringLen > 0)
                {
                    out1.WriteByte(field_3_unicode_flag ? 0x01 : 0x00);
                    pos += 1;

                    if (field_3_unicode_flag)
                    {
                        StringUtil.PutUnicodeLE(field_4_ole_classname, out1);
                        pos += stringLen * 2;
                    }
                    else
                    {
                        StringUtil.PutCompressedUnicode(field_4_ole_classname, out1);
                        pos += stringLen;
                    }
                }
            }

            // pad to next 2-byte boundary (requires 0 or 1 bytes)
            switch (idOffset - (pos - 6))
            { // 6 for 3 shorts: sid, dataSize, idOffset
            case 1:
                out1.WriteByte(field_4_unknownByte == null ? 0x00 : (int)Convert.ToByte(field_4_unknownByte));
                pos++;
                break;

            case 0:
                break;

            default:
                throw new InvalidOperationException("Bad padding calculation (" + idOffset + ", " + pos + ")");
            }

            if (field_5_stream_id != null)
            {
                out1.WriteInt(Convert.ToInt32(field_5_stream_id));
                pos += 4;
            }
            out1.Write(field_6_unknown);
        }
Esempio n. 36
0
 public static void PutCompressedUnicode(String input, LittleEndianOutput out1)
 {
     byte[] bytes;
     try
     {
         bytes = Encoding.GetEncoding(ENCODING).GetBytes(input);
     }
     catch (EncoderFallbackException e)
     {
         throw;
     }
     out1.Write(bytes);
 }
Esempio n. 37
0
 public override void Serialize(LittleEndianOutput out1)
 {
     out1.WriteShort(_encryptionType);
     out1.WriteShort(_encryptionInfo);
     out1.WriteShort(_minorVersionNo);
     out1.Write(_docId);
     out1.Write(_saltData);
     out1.Write(_saltHash);
 }
Esempio n. 38
0
 public static void PutUnicodeLE(String input, LittleEndianOutput out1)
 {
     byte[] bytes;
     try
     {
         bytes = Encoding.GetEncoding("UTF-16LE").GetBytes(input);
     }
     catch (EncoderFallbackException e)
     {
         throw;
     }
     out1.Write(bytes);
 }