Beispiel #1
0
 public static String ReadCompressedUnicode(ILittleEndianInput in1, int nChars)
 {
     char[] buf = new char[nChars];
     for (int i = 0; i < buf.Length; i++)
     {
         buf[i] = (char)in1.ReadUByte();
     }
     return(new String(buf));
 }
Beispiel #2
0
        /** Create a StringPtg from a stream */
        public StringPtg(ILittleEndianInput in1)
        {
            int field_1_length = in1.ReadUByte();
			field_2_options = (byte)in1.ReadByte();
            _is16bitUnicode = (field_2_options & 0x01) != 0;
            if (_is16bitUnicode)
            {
                field_3_string = StringUtil.ReadUnicodeLE(in1, field_1_length);
            }
            else
            {
                field_3_string = StringUtil.ReadCompressedUnicode(in1, field_1_length);
            }
        }
Beispiel #3
0
        /** Create a StringPtg from a stream */
        public StringPtg(ILittleEndianInput in1)
        {
            int field_1_length = in1.ReadUByte();

            field_2_options = (byte)in1.ReadByte();
            _is16bitUnicode = (field_2_options & 0x01) != 0;
            if (_is16bitUnicode)
            {
                field_3_string = StringUtil.ReadUnicodeLE(in1, field_1_length);
            }
            else
            {
                field_3_string = StringUtil.ReadCompressedUnicode(in1, field_1_length);
            }
        }
Beispiel #4
0
            /**
             * Read in the actual token (array) values. This occurs
             * AFTER the last Ptg in the expression.
             * See page 304-305 of Excel97-2007BinaryFileFormat(xls)Specification.pdf
             */
            public ArrayPtg FinishReading(ILittleEndianInput in1)
            {
                int   nColumns = in1.ReadUByte();
                short nRows    = in1.ReadShort();

                //The token_1_columns and token_2_rows do not follow the documentation.
                //The number of physical rows and columns is actually +1 of these values.
                //Which is not explicitly documented.
                nColumns++;
                nRows++;

                int totalCount = nRows * nColumns;

                Object[] arrayValues = ConstantValueParser.Parse(in1, totalCount);

                ArrayPtg result = new ArrayPtg(_reserved0, _reserved1, _reserved2, nColumns, nRows, arrayValues);

                result.PtgClass = this.PtgClass;
                return(result);
            }
Beispiel #5
0
            /**
             * Read in the actual token (array) values. This occurs
             * AFTER the last Ptg in the expression.
             * See page 304-305 of Excel97-2007BinaryFileFormat(xls)Specification.pdf
             */
            public ArrayPtg FinishReading(ILittleEndianInput in1)
            {
                int nColumns = in1.ReadUByte();
                short nRows = in1.ReadShort();
                //The token_1_columns and token_2_rows do not follow the documentation.
                //The number of physical rows and columns is actually +1 of these values.
                //Which is not explicitly documented.
                nColumns++;
                nRows++;

                int totalCount = nRows * nColumns;
                Object[] arrayValues = ConstantValueParser.Parse(in1, totalCount);

                ArrayPtg result = new ArrayPtg(_reserved0, _reserved1, _reserved2, nColumns, nRows, arrayValues);
                result.PtgClass = this.PtgClass;
                return result;
            }
Beispiel #6
0
 public Initial(ILittleEndianInput in1)
 {
     _reserved0 = in1.ReadInt();
     _reserved1 = in1.ReadUShort();
     _reserved2 = in1.ReadUByte();
 }
Beispiel #7
0
 public int ReadUByte()
 {
     return(_rc4.XorByte(_le.ReadUByte()));
 }
Beispiel #8
0
 public Initial(ILittleEndianInput in1)
 {
     _reserved0 = in1.ReadInt();
     _reserved1 = in1.ReadUShort();
     _reserved2 = in1.ReadUByte();
 }
Beispiel #9
0
 public static String ReadCompressedUnicode(ILittleEndianInput in1, int nChars)
 {
     char[] buf = new char[nChars];
     for (int i = 0; i < buf.Length; i++)
     {
         buf[i] = (char)in1.ReadUByte();
     }
     return new String(buf);
 }