コード例 #1
0
ファイル: Ptg.cs プロジェクト: JnS-Software-LLC/npoi
 /**
  * Reads <c>size</c> bytes of the input stream, to Create an array of <c>Ptg</c>s.
  * Extra data (beyond <c>size</c>) may be Read if and <c>ArrayPtg</c>s are present.
  */
 public static Ptg[] ReadTokens(int size, ILittleEndianInput in1)
 {
     ArrayList temp = new ArrayList(4 + size / 2);
     int pos = 0;
     bool hasArrayPtgs = false;
     while (pos < size)
     {
         Ptg ptg = Ptg.CreatePtg(in1);
         if (ptg is ArrayPtg.Initial)
         {
             hasArrayPtgs = true;
         }
         pos += ptg.Size;
         temp.Add(ptg);
     }
     if (pos != size)
     {
         throw new Exception("Ptg array size mismatch");
     }
     if (hasArrayPtgs)
     {
         Ptg[] result = ToPtgArray(temp);
         for (int i = 0; i < result.Length; i++)
         {
             if (result[i] is ArrayPtg.Initial)
             {
                 result[i] = ((ArrayPtg.Initial)result[i]).FinishReading(in1);
             }
         }
         return result;
     }
     return ToPtgArray(temp);
 }
コード例 #2
0
ファイル: SubRecord.cs プロジェクト: ctddjyds/npoi
        public static SubRecord CreateSubRecord(ILittleEndianInput in1, CommonObjectType cmoOt)
        {
            int sid = in1.ReadUShort();
            int secondUShort = in1.ReadUShort(); // Often (but not always) the datasize for the sub-record


            switch (sid)
            {
                case CommonObjectDataSubRecord.sid:
                    return new CommonObjectDataSubRecord(in1, secondUShort);
                case EmbeddedObjectRefSubRecord.sid:
                    return new EmbeddedObjectRefSubRecord(in1, secondUShort);
                case GroupMarkerSubRecord.sid:
                    return new GroupMarkerSubRecord(in1, secondUShort);
                case EndSubRecord.sid:
                    return new EndSubRecord(in1, secondUShort);
                case NoteStructureSubRecord.sid:
                    return new NoteStructureSubRecord(in1, secondUShort);
                case LbsDataSubRecord.sid:
                    return new LbsDataSubRecord(in1, secondUShort, (int)cmoOt);
                case FtCblsSubRecord.sid:
                    return new FtCblsSubRecord(in1, secondUShort);
            }
            return new UnknownSubRecord(in1, sid, secondUShort);
        }
コード例 #3
0
ファイル: EndSubRecord.cs プロジェクト: ctddjyds/npoi
        /**
         * Constructs a End record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public EndSubRecord(ILittleEndianInput in1, int size)
        {
            if ((size & 0xFF) != ENCODED_SIZE)
            { // mask out random crap in upper byte
                throw new RecordFormatException("Unexpected size (" + size + ")");
            }

        }
コード例 #4
0
ファイル: FtCfSubRecord.cs プロジェクト: Reinakumiko/npoi
 public FtCfSubRecord(ILittleEndianInput in1, int size)
 {
     if (size != length)
     {
         throw new RecordFormatException("Unexpected size (" + size + ")");
     }
     flags = in1.ReadShort();
 }
コード例 #5
0
ファイル: ConstantValueParser.cs プロジェクト: xoposhiy/npoi
 public static object[] Parse(ILittleEndianInput in1, int nValues)
 {
     object[] result = new Object[nValues];
     for (int i = 0; i < result.Length; i++)
     {
         result[i]=ReadAConstantValue(in1);
     }
     return result;
 }
コード例 #6
0
 /**
  * Constructs a NoteStructureSubRecord and Sets its fields appropriately.
  *
  */
 public NoteStructureSubRecord(ILittleEndianInput in1, int size)
 {
     if (size != ENCODED_SIZE) {
         throw new RecordFormatException("Unexpected size (" + size + ")");
     }
     //just grab the raw data
     byte[] buf = new byte[size];
     in1.ReadFully(buf);
     reserved = buf;
 }
コード例 #7
0
 private static Object ReadBoolean(ILittleEndianInput in1)
 {
     byte val = (byte)in1.ReadLong(); // 7 bytes 'not used'
     switch (val)
     {
         case FALSE_ENCODING:
             return false;
         case TRUE_ENCODING:
             return true;
     }
     // Don't tolerate Unusual bool encoded values (unless it becomes evident that they occur)
     throw new Exception("unexpected bool encoding (" + val + ")");
 }
コード例 #8
0
ファイル: StringPtg.cs プロジェクト: Johnnyfly/source20131023
        /** 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);
            }
        }
コード例 #9
0
        public Biff8DecryptingStream(Stream in1, int InitialOffSet, Biff8EncryptionKey key)
        {
            _rc4 = new Biff8RC4(InitialOffSet, key);

            if (in1 is ILittleEndianInput)
            {
                // accessing directly is an optimisation
                _le = (ILittleEndianInput)in1;
            }
            else
            {
                // less optimal, but should work OK just the same. Often occurs in junit tests.
                _le = new LittleEndianInputStream(in1);
            }
        }
コード例 #10
0
 public ScrollableObjectSubRecord(ILittleEndianInput in1, int size)
 {
     if (size !=this.DataSize)
     {
         throw new RecordFormatException(string.Format(CultureInfo.CurrentCulture, "Expected size {0} but got ({1})", this.DataSize, size));
     }
     in1.ReadInt();
     field_1_iVal=in1.ReadShort();
     field_2_iMin=in1.ReadShort();
     field_3_iMax=in1.ReadShort();
     field_4_dInc=in1.ReadShort();
     field_5_dPage=in1.ReadShort();
     field_6_fHoriz = in1.ReadShort();
     field_7_dxScroll = in1.ReadShort();
     field_8_options = in1.ReadShort();
 }
コード例 #11
0
ファイル: AttrPtg.cs プロジェクト: 89sos98/npoi
        public AttrPtg(ILittleEndianInput in1)
        {
            field_1_options =(byte)in1.ReadByte();
            field_2_data = in1.ReadShort();
            if (IsOptimizedChoose)
            {
                int nCases = field_2_data;
                int[] jumpTable = new int[nCases];
                for (int i = 0; i < jumpTable.Length; i++)
                {
                    jumpTable[i] = in1.ReadUShort();
                }
                _jumpTable = jumpTable;
                _chooseFuncOffset = in1.ReadUShort();
            }
            else
            {
                _jumpTable = null;
                _chooseFuncOffset = -1;
            }

        }
コード例 #12
0
ファイル: ConstantValueParser.cs プロジェクト: xoposhiy/npoi
 private static object ReadAConstantValue(ILittleEndianInput in1)
 {
     byte grbit = (byte)in1.ReadByte();
     switch (grbit)
     {
         case TYPE_EMPTY:
             in1.ReadLong(); // 8 byte 'not used' field
             return EMPTY_REPRESENTATION;
         case TYPE_NUMBER:
             return in1.ReadDouble();
         case TYPE_STRING:
             return StringUtil.ReadUnicodeString(in1);
         case TYPE_BOOLEAN:
             return ReadBoolean(in1);
         case TYPE_ERROR_CODE:
             int errCode = in1.ReadUShort();
             // next 6 bytes are Unused
             in1.ReadUShort();
             in1.ReadInt();
             return ErrorConstant.ValueOf(errCode);
     }
     throw new Exception("Unknown grbit value (" + grbit + ")");
 }
コード例 #13
0
ファイル: MemAreaPtg.cs プロジェクト: xoposhiy/npoi
 public MemAreaPtg(ILittleEndianInput in1)
 {
     field_1_reserved = in1.ReadInt();
     field_2_subex_len = in1.ReadShort();
 }
コード例 #14
0
        /**
         * Constructs an EmbeddedObjectRef record and Sets its fields appropriately.
         *
         * @param in the record input stream.
         */
        public EmbeddedObjectRefSubRecord(ILittleEndianInput in1, int size)
        {
            // Much guess-work going on here due to lack of any documentation.
            // See similar source code in OOO:
            // http://lxr.go-oo.org/source/sc/sc/source/filter/excel/xiescher.cxx
            // 1223 void XclImpOleObj::ReadPictFmla( XclImpStream& rStrm, sal_uInt16 nRecSize )

            int streamIdOffset = in1.ReadShort(); // OOO calls this 'nFmlaLen'
            int remaining = size - LittleEndianConsts.SHORT_SIZE;

            int dataLenAfterFormula = remaining - streamIdOffset;
            int formulaSize = in1.ReadUShort();

            remaining -= LittleEndianConsts.SHORT_SIZE;
            field_1_unknown_int = in1.ReadInt();
            remaining -= LittleEndianConsts.INT_SIZE;
            byte[] formulaRawBytes = ReadRawData(in1, formulaSize);
            remaining -= formulaSize;
            field_2_refPtg = ReadRefPtg(formulaRawBytes);
            if (field_2_refPtg == null)
            {
                // common case
                // field_2_n16 seems to be 5 here
                // The formula almost looks like tTbl but the row/column values seem like garbage.
                field_2_unknownFormulaData = formulaRawBytes;
            }
            else
            {
                field_2_unknownFormulaData = null;
            }


            int stringByteCount;
            if (remaining >= dataLenAfterFormula + 3)
            {
                int tag = in1.ReadByte();
                stringByteCount = LittleEndianConsts.BYTE_SIZE;
                if (tag != 0x03)
                {
                    throw new RecordFormatException("Expected byte 0x03 here");
                }
                int nChars = in1.ReadUShort();
                stringByteCount += LittleEndianConsts.SHORT_SIZE;
                if (nChars > 0)
                {
                    // OOO: the 4th way Xcl stores a unicode string: not even a Grbit byte present if Length 0
                    field_3_unicode_flag = (in1.ReadByte() & 0x01) != 0;
                    stringByteCount += LittleEndianConsts.BYTE_SIZE;
                    if (field_3_unicode_flag)
                    {
                        field_4_ole_classname = StringUtil.ReadUnicodeLE(in1,nChars);
                        stringByteCount += nChars * 2;
                    }
                    else
                    {
                        field_4_ole_classname = StringUtil.ReadCompressedUnicode(in1,nChars);
                        stringByteCount += nChars;
                    }
                }
                else
                {
                    field_4_ole_classname = "";
                }
            }
            else
            {
                field_4_ole_classname = null;
                stringByteCount = 0;
            }
            remaining -= stringByteCount;
            // Pad to next 2-byte boundary
            if (((stringByteCount + formulaSize) % 2) != 0)
            {
                int b = in1.ReadByte();
                remaining -= LittleEndianConsts.BYTE_SIZE;
                if (field_2_refPtg != null && field_4_ole_classname == null)
                {
                    field_4_unknownByte = (byte)b;
                }
            }
            int nUnexpectedPadding = remaining - dataLenAfterFormula;

            if (nUnexpectedPadding > 0)
            {
                logger.Log(POILogger.ERROR, "Discarding " + nUnexpectedPadding + " unexpected padding bytes ");
                ReadRawData(in1, nUnexpectedPadding);
                remaining -= nUnexpectedPadding;
            }

            // Fetch the stream ID
            if (dataLenAfterFormula >= 4)
            {
                field_5_stream_id = in1.ReadInt();
                remaining -= LittleEndianConsts.INT_SIZE;
            }
            else
            {
                field_5_stream_id = null;
            }

            field_6_unknown = ReadRawData(in1, remaining);
        }
コード例 #15
0
ファイル: AreaPtgBase.cs プロジェクト: hanwangkun/npoi
 protected void ReadCoordinates(ILittleEndianInput in1)
 {
     field_1_first_row = in1.ReadUShort();
     field_2_last_row = in1.ReadUShort();
     field_3_first_column = in1.ReadUShort();
     field_4_last_column = in1.ReadUShort();
 }
コード例 #16
0
ファイル: MemAreaPtg.cs プロジェクト: sunpinganlaw/webgis
 public MemAreaPtg(ILittleEndianInput in1)
 {
     field_1_reserved  = in1.ReadInt();
     field_2_subex_len = in1.ReadShort();
 }
コード例 #17
0
ファイル: ErrPtg.cs プロジェクト: huangming771314520/HBHC
 public ErrPtg(ILittleEndianInput in1)
     : this(in1.ReadByte())
 {
 }
コード例 #18
0
ファイル: RefPtgBase.cs プロジェクト: FilRip/IMDEV.Commun
 protected void ReadCoordinates(ILittleEndianInput in1)
 {
     field_1_row = in1.ReadUShort();
     field_2_col = in1.ReadUShort();
 }
コード例 #19
0
 public AreaErrPtg(ILittleEndianInput in1)
 {
     // 8 bytes unused:
     unused1 = in1.ReadInt();
     unused2 = in1.ReadInt();
 }
コード例 #20
0
 public ExpPtg(ILittleEndianInput in1)
 {
     field_1_first_row = in1.ReadShort();
     field_2_first_col = in1.ReadShort();
 }
コード例 #21
0
ファイル: RefPtgBase.cs プロジェクト: FilRip/IMDEV.Commun
 protected RefPtgBase(ILittleEndianInput in1)
 {
     field_1_row = in1.ReadUShort();
     field_2_col = in1.ReadUShort();
 }
コード例 #22
0
ファイル: Ptg.cs プロジェクト: huangdonghai/titan3d
        private static Ptg CreateBasePtg(byte id, ILittleEndianInput in1)
        {
            switch (id)
            {
            case 0x00: return(new UnknownPtg());                        // TODO - not a real Ptg

            case ExpPtg.sid: return(new ExpPtg(in1));                   // 0x01

            case TblPtg.sid: return(new TblPtg(in1));                   // 0x02

            case AddPtg.sid: return(AddPtg.instance);                   // 0x03

            case SubtractPtg.sid: return(SubtractPtg.instance);         // 0x04

            case MultiplyPtg.sid: return(MultiplyPtg.instance);         // 0x05

            case DividePtg.sid: return(DividePtg.instance);             // 0x06

            case PowerPtg.sid: return(PowerPtg.instance);               // 0x07

            case ConcatPtg.sid: return(ConcatPtg.instance);             // 0x08

            case LessThanPtg.sid: return(LessThanPtg.instance);         // 0x09

            case LessEqualPtg.sid: return(LessEqualPtg.instance);       // 0x0a

            case EqualPtg.sid: return(EqualPtg.instance);               // 0x0b

            case GreaterEqualPtg.sid: return(GreaterEqualPtg.instance); // 0x0c

            case GreaterThanPtg.sid: return(GreaterThanPtg.instance);   // 0x0d

            case NotEqualPtg.sid: return(NotEqualPtg.instance);         // 0x0e

            case IntersectionPtg.sid: return(IntersectionPtg.instance); // 0x0f

            case UnionPtg.sid: return(UnionPtg.instance);               // 0x10

            case RangePtg.sid: return(RangePtg.instance);               // 0x11

            case UnaryPlusPtg.sid: return(UnaryPlusPtg.instance);       // 0x12

            case UnaryMinusPtg.sid: return(UnaryMinusPtg.instance);     // 0x13

            case PercentPtg.sid: return(PercentPtg.instance);           // 0x14

            case ParenthesisPtg.sid: return(ParenthesisPtg.instance);   // 0x15

            case MissingArgPtg.sid: return(MissingArgPtg.instance);     // 0x16

            case StringPtg.sid: return(new StringPtg(in1));             // 0x17

            case AttrPtg.sid: return(new AttrPtg(in1));                 // 0x19

            case ErrPtg.sid: return(new ErrPtg(in1));                   // 0x1c

            case BoolPtg.sid: return(new BoolPtg(in1));                 // 0x1d

            case IntPtg.sid: return(new IntPtg(in1));                   // 0x1e

            case NumberPtg.sid: return(new NumberPtg(in1));             // 0x1f
            }
            throw new Exception("Unexpected base token id (" + id + ")");
        }
コード例 #23
0
 public NameXPtg(ILittleEndianInput in1)
     : this(in1.ReadUShort(), in1.ReadUShort(), in1.ReadUShort())
 {
 }
コード例 #24
0
ファイル: GroupMarkerSubRecord.cs プロジェクト: zhgl7688/-
        /**
         * Constructs a Group marker record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public GroupMarkerSubRecord(ILittleEndianInput in1, int size)
        {
            byte[] buf = new byte[size];
            in1.ReadFully(buf);
            reserved = buf;
        }
コード例 #25
0
ファイル: RefPtg.cs プロジェクト: hanwangkun/npoi
        public RefPtg(ILittleEndianInput in1)
            : base(in1)
        {

        }
コード例 #26
0
ファイル: FuncPtg.cs プロジェクト: purehzj/npoi-1
 // not used: private int numParams = 0;
 public static FuncPtg Create(ILittleEndianInput in1)
 {
     return(Create(in1.ReadUShort()));
 }
コード例 #27
0
ファイル: NameXPtg.cs プロジェクト: newlysoft/npoi
        public NameXPtg(ILittleEndianInput in1)
            :this(in1.ReadUShort(), in1.ReadUShort(), in1.ReadUShort())
        {

        }
コード例 #28
0
ファイル: Ref3DPtg.cs プロジェクト: FilRip/IMDEV.Commun
 public Ref3DPtg(ILittleEndianInput in1)
 {
     field_1_index_extern_sheet = in1.ReadShort();
     ReadCoordinates(in1);
 }
コード例 #29
0
ファイル: GUID.cs プロジェクト: JnS-Software-LLC/npoi
		public GUID(ILittleEndianInput in1) 
            :this(in1.ReadInt(), in1.ReadUShort(), in1.ReadUShort(), in1.ReadLong())
        {
			
		}
コード例 #30
0
ファイル: NumberPtg.cs プロジェクト: xewn/Npoi.Core
 /** Create a NumberPtg from a byte array Read from disk */
 public NumberPtg(ILittleEndianInput in1)
 {
     field_1_value = in1.ReadDouble();
 }
コード例 #31
0
ファイル: LbsDataSubRecord.cs プロジェクト: okevin/chama
        /**
         * @param in the stream to read data from
         * @param cbFContinued the seconf short in the record header
         * @param cmoOt the Containing Obj's {@link CommonObjectDataSubRecord#field_1_objectType}
         */
        public LbsDataSubRecord(ILittleEndianInput in1, int cbFContinued, int cmoOt)
        {
            _cbFContinued = cbFContinued;

            int encodedTokenLen = in1.ReadUShort();

            if (encodedTokenLen > 0)
            {
                int formulaSize = in1.ReadUShort();
                _unknownPreFormulaInt = in1.ReadInt();

                Ptg[] ptgs = Ptg.ReadTokens(formulaSize, in1);
                if (ptgs.Length != 1)
                {
                    throw new RecordFormatException("Read " + ptgs.Length
                                                    + " tokens but expected exactly 1");
                }
                _linkPtg = ptgs[0];
                switch (encodedTokenLen - formulaSize - 6)
                {
                case 1:
                    _unknownPostFormulaByte = (byte)in1.ReadByte();
                    break;

                case 0:
                    _unknownPostFormulaByte = null;
                    break;

                default:
                    throw new RecordFormatException("Unexpected leftover bytes");
                }
            }

            _cLines = in1.ReadUShort();
            _iSel   = in1.ReadUShort();
            _flags  = in1.ReadUShort();
            _idEdit = in1.ReadUShort();

            // From [MS-XLS].pdf 2.5.147 FtLbsData:
            // This field MUST exist if and only if the Containing Obj?s cmo.ot is equal to 0x14.
            if (cmoOt == 0x14)
            {
                _dropData = new LbsDropData(in1);
            }

            // From [MS-XLS].pdf 2.5.147 FtLbsData:
            // This array MUST exist if and only if the fValidPlex flag (0x2) is set
            if ((_flags & 0x2) != 0)
            {
                _rgLines = new String[_cLines];
                for (int i = 0; i < _cLines; i++)
                {
                    _rgLines[i] = StringUtil.ReadUnicodeString(in1);
                }
            }

            // bits 5-6 in the _flags specify the type
            // of selection behavior this list control is expected to support

            // From [MS-XLS].pdf 2.5.147 FtLbsData:
            // This array MUST exist if and only if the wListType field is not equal to 0.
            if (((_flags >> 4) & 0x2) != 0)
            {
                _bsels = new bool[_cLines];
                for (int i = 0; i < _cLines; i++)
                {
                    _bsels[i] = in1.ReadByte() == 1;
                }
            }
        }
コード例 #32
0
ファイル: AreaNPtg.cs プロジェクト: leo0530/Zephyr
 public AreaNPtg(ILittleEndianInput in1)
     : base(in1)
 {
 }
コード例 #33
0
ファイル: ArrayPtg.cs プロジェクト: missxiaohuang/Weekly
 public Initial(ILittleEndianInput in1)
 {
     _reserved0 = in1.ReadInt();
     _reserved1 = in1.ReadUShort();
     _reserved2 = in1.ReadUByte();
 }
コード例 #34
0
 public static String ReadCompressedUnicode(ILittleEndianInput in1, int nChars)
 {
     byte[] buf = new byte[nChars];
     in1.ReadFully(buf);
     return(ISO_8859_1.GetString(buf));
 }
コード例 #35
0
ファイル: MemFuncPtg.cs プロジェクト: purehzj/npoi-1
 /**Creates new function pointer from a byte array
  * usually called while Reading an excel file.
  */
 public MemFuncPtg(ILittleEndianInput in1)
     : this(in1.ReadUShort())
 {
 }
コード例 #36
0
 public static String ReadUnicodeLE(ILittleEndianInput in1, int nChars)
 {
     byte[] bytes = new byte[nChars * 2];
     in1.ReadFully(bytes);
     return(UTF16LE.GetString(bytes));
 }
コード例 #37
0
ファイル: Formula.cs プロジェクト: purehzj/npoi-1
 /**
  * Convenience method for {@link #read(int, LittleEndianInput, int)}
  */
 public static Formula Read(int encodedTokenLen, ILittleEndianInput in1)
 {
     return(Read(encodedTokenLen, in1, encodedTokenLen));
 }
コード例 #38
0
 protected Ref2DPtgBase(ILittleEndianInput in1)
 {
     ReadCoordinates(in1);
 }
コード例 #39
0
ファイル: ArrayPtg.cs プロジェクト: missxiaohuang/Weekly
            /**
             * 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;
            }
コード例 #40
0
 public SimpleHeaderInput(Stream in1)
 {
     _lei = GetLEI(in1);
 }
コード例 #41
0
 private static byte[] ReadRawData(ILittleEndianInput in1, int size)
 {
     if (size < 0)
     {
         throw new ArgumentException("Negative size (" + size + ")");
     }
     if (size == 0)
     {
         return EMPTY_BYTE_ARRAY;
     }
     byte[] result = new byte[size];
     in1.ReadFully(result);
     return result;
 }
コード例 #42
0
            internal ExtRst(ILittleEndianInput in1, int expectedLength)
            {
                reserved = in1.ReadShort();

                // Old style detection (Reserved = 0xFF)
                if (reserved == -1)
                {
                    populateEmpty();
                    return;
                }

                // Spot corrupt records
                if (reserved != 1)
                {
                    _logger.Log(POILogger.WARN, "Warning - ExtRst has wrong magic marker, expecting 1 but found " + reserved + " - ignoring");
                    // Grab all the remaining data, and ignore it
                    for (int i = 0; i < expectedLength - 2; i++)
                    {
                        in1.ReadByte();
                    }
                    // And make us be empty
                    populateEmpty();
                    return;
                }

                // Carry on Reading in as normal
                short stringDataSize = in1.ReadShort();

                formattingFontIndex = in1.ReadShort();
                formattingOptions   = in1.ReadShort();

                // RPHSSub
                numberOfRuns = in1.ReadUShort();
                short length1 = in1.ReadShort();
                // No really. Someone Clearly forgot to read
                //  the docs on their datastructure...
                short length2 = in1.ReadShort();

                // And sometimes they write out garbage :(
                if (length1 == 0 && length2 > 0)
                {
                    length2 = 0;
                }
                if (length1 != length2)
                {
                    throw new InvalidOperationException(
                              "The two length fields of the Phonetic Text don't agree! " +
                              length1 + " vs " + length2
                              );
                }
                phoneticText = StringUtil.ReadUnicodeLE(in1, length1);

                int RunData = stringDataSize - 4 - 6 - (2 * phoneticText.Length);
                int numRuns = (RunData / 6);

                phRuns = new PhRun[numRuns];
                for (int i = 0; i < phRuns.Length; i++)
                {
                    phRuns[i] = new PhRun(in1);
                }

                int extraDataLength = RunData - (numRuns * 6);

                if (extraDataLength < 0)
                {
                    //System.err.Println("Warning - ExtRst overran by " + (0-extraDataLength) + " bytes");
                    extraDataLength = 0;
                }
                extraData = new byte[extraDataLength];
                for (int i = 0; i < extraData.Length; i++)
                {
                    extraData[i] = (byte)in1.ReadByte();
                }
            }
コード例 #43
0
ファイル: NumberPtg.cs プロジェクト: Johnnyfly/source20131023
 /** Create a NumberPtg from a byte array Read from disk */
 public NumberPtg(ILittleEndianInput in1)
 {
     field_1_value = in1.ReadDouble();
 }
コード例 #44
0
 internal PhRun(ILittleEndianInput in1)
 {
     phoneticTextFirstCharacterOffset = in1.ReadUShort();
     realTextFirstCharacterOffset     = in1.ReadUShort();
     realTextLength = in1.ReadUShort();
 }
コード例 #45
0
ファイル: AreaNPtg.cs プロジェクト: 89sos98/npoi
        public AreaNPtg(ILittleEndianInput in1)
            : base(in1)
        {

        }
コード例 #46
0
 public FormatRun(ILittleEndianInput in1) :
     this(in1.ReadShort(), in1.ReadShort())
 {
 }
コード例 #47
0
ファイル: GUID.cs プロジェクト: purehzj/npoi-1
 public GUID(ILittleEndianInput in1)
     : this(in1.ReadInt(), in1.ReadUShort(), in1.ReadUShort(), in1.ReadLong())
 {
 }
コード例 #48
0
ファイル: ArrayPtg.cs プロジェクト: huangming771314520/HBHC
 public Initial(ILittleEndianInput in1)
 {
     _reserved0 = in1.ReadInt();
     _reserved1 = in1.ReadUShort();
     _reserved2 = in1.ReadUByte();
 }
コード例 #49
0
ファイル: RefErrorPtg.cs プロジェクト: missxiaohuang/Weekly
        public RefErrorPtg(ILittleEndianInput in1)
        {
            field_1_reserved = in1.ReadInt();

        }
コード例 #50
0
ファイル: SubRecord.cs プロジェクト: ctddjyds/npoi
 public UnknownSubRecord(ILittleEndianInput in1, int sid, int size)
 {
     _sid = sid;
     byte[] buf = new byte[size];
     in1.ReadFully(buf);
     _data = buf;
 }
コード例 #51
0
ファイル: TblPtg.cs プロジェクト: hanwangkun/npoi
 public TblPtg(ILittleEndianInput in1)
 {
     field_1_first_row = in1.ReadUShort();
     field_2_first_col = in1.ReadUShort();
 }
コード例 #52
0
ファイル: RecordInputStream.cs プロジェクト: 89sos98/npoi
 public RecordInputStream(Stream in1, Biff8EncryptionKey key, int initialOffset)
 {
     if (key == null)
     {
         _dataInput = SimpleHeaderInput.GetLEI(in1);
         _bhi = new SimpleHeaderInput(in1);
     }
     else
     {
         Biff8DecryptingStream bds = new Biff8DecryptingStream(in1, initialOffset, key);
         _bhi = bds;
         _dataInput = bds;
     }
     _nextSid = ReadNextSid();
 }
コード例 #53
0
ファイル: FuncVarPtg.cs プロジェクト: huangming771314520/HBHC
 /**Creates new function pointer from a byte array
  * usually called while reading an excel file.
  */
 public static FuncVarPtg Create(ILittleEndianInput in1)
 {
     return(Create(in1.ReadByte(), in1.ReadShort()));
 }
コード例 #54
0
ファイル: Formula.cs プロジェクト: purehzj/npoi-1
 /**
  * When there are no array constants present, <c>encodedTokenLen</c>==<c>totalEncodedLen</c>
  * @param encodedTokenLen number of bytes in the stream taken by the plain formula tokens
  * @param totalEncodedLen the total number of bytes in the formula (includes trailing encoding
  * for array constants, but does not include 2 bytes for initial <c>ushort encodedTokenLen</c> field.
  * @return A new formula object as read from the stream.  Possibly empty, never <code>null</code>.
  */
 public static Formula Read(int encodedTokenLen, ILittleEndianInput in1, int totalEncodedLen)
 {
     byte[] byteEncoding = new byte[totalEncodedLen];
     in1.ReadFully(byteEncoding);
     return(new Formula(byteEncoding, encodedTokenLen));
 }
コード例 #55
0
ファイル: Ref2DPtgBase.cs プロジェクト: missxiaohuang/Weekly
 protected Ref2DPtgBase(ILittleEndianInput in1)
 {
     ReadCoordinates(in1);
 }
コード例 #56
0
ファイル: DeletedRef3DPtg.cs プロジェクト: xewn/Npoi.Core
 /** Creates new DeletedRef3DPtg */
 public DeletedRef3DPtg(ILittleEndianInput in1)
 {
     field_1_index_extern_sheet = in1.ReadUShort();
     unused1 = in1.ReadInt();
 }
コード例 #57
0
ファイル: RecordInputStream.cs プロジェクト: 89sos98/npoi
 public SimpleHeaderInput(Stream in1)
 {
     _lei = GetLEI(in1);
 }
コード例 #58
0
ファイル: RefPtg.cs プロジェクト: zhongshuiyuan/Npoi.Core
 public RefPtg(ILittleEndianInput in1)
     : base(in1)
 {
 }
コード例 #59
0
ファイル: MemFuncPtg.cs プロジェクト: JnS-Software-LLC/npoi
        /**Creates new function pointer from a byte array
         * usually called while Reading an excel file.
         */
        public MemFuncPtg(ILittleEndianInput in1)
            : this(in1.ReadUShort())
        {

        }
コード例 #60
0
ファイル: IntPtg.cs プロジェクト: huangming771314520/HBHC
 public IntPtg(ILittleEndianInput in1)
     : this(in1.ReadUShort())
 {
 }