コード例 #1
0
        private void StartRecord(Stream aOut, short aRecordType)
        {
            LittleEndianHelper.WriteShortU(aOut, aRecordType);
            int aVal = this.m_recordSize[this.m_count++] - 4;

            LittleEndianHelper.WriteShortU(aOut, aVal);
        }
コード例 #2
0
 public static void WriteIntU(long aVal, byte[] aBuf, int aOff)
 {
     if (aVal > LittleEndianHelper.UINT_MAX)
     {
         throw new IOException(ExcelRenderRes.MaxValueExceeded(LittleEndianHelper.UINT_MAX.ToString(CultureInfo.InvariantCulture)));
     }
     LittleEndianHelper.WriteInt((int)(aVal & -1), aBuf, aOff);
 }
コード例 #3
0
 public static void WriteShortU(int aVal, byte[] aBuf, int aOff)
 {
     if (aVal > LittleEndianHelper.USHORT_MAX)
     {
         throw new IOException(ExcelRenderRes.MaxValueExceeded(LittleEndianHelper.USHORT_MAX.ToString(CultureInfo.InvariantCulture)));
     }
     LittleEndianHelper.WriteShort((short)(aVal & 0xFFFF), aBuf, aOff);
 }
コード例 #4
0
        public static double ReadFixed32U(byte[] aBuff, int aOff)
        {
            long   num  = LittleEndianHelper.ReadIntU(aBuff, aOff);
            double num2 = (double)LittleEndianHelper.URShift(num, 16);

            num &= 0xFFFF;
            return(num2 + (double)num / 65536.0);
        }
コード例 #5
0
        public static void WriteFixed32U(double aVal, byte[] aBuff, int aOff)
        {
            double num  = Math.Floor(aVal);
            double num2 = aVal - num;

            num2 *= 65536.0;
            long num3 = (long)num << 16;

            num3 += (long)num2;
            LittleEndianHelper.WriteIntU(num3, aBuff, aOff);
        }
コード例 #6
0
        public static double ReadFixed32(byte[] aBuff, int aOff)
        {
            int  num  = LittleEndianHelper.ReadInt(aBuff, aOff);
            bool flag = false;

            if (num < 0)
            {
                num *= -1;
                flag = true;
            }
            double num2 = (double)LittleEndianHelper.URShift(num, 16);

            num  &= 0xFFFF;
            num2 += (double)num / 65536.0;
            if (flag)
            {
                num2 *= -1.0;
            }
            return(num2);
        }
コード例 #7
0
        public static void WriteFixed32(double aVal, byte[] aBuff, int aOff)
        {
            bool flag = false;

            if (aVal < 0.0)
            {
                aVal *= -1.0;
                flag  = true;
            }
            double num  = Math.Floor(aVal);
            double num2 = aVal - num;

            num2 *= 65536.0;
            int num3 = (int)num << 16;

            num3 += (int)num2;
            if (flag)
            {
                num3 *= -1;
            }
            LittleEndianHelper.WriteInt(num3, aBuff, aOff);
        }
コード例 #8
0
 public void WriteHeaderData(Stream aOut, bool aCompressed)
 {
     if (aCompressed)
     {
         this.m_grbit &= 254;
     }
     else
     {
         this.m_grbit |= 1;
     }
     LittleEndianHelper.WriteShortU(aOut, this.m_rgb.Length);
     aOut.WriteByte(this.m_grbit);
     if (this.m_runsList != null)
     {
         if ((this.m_grbit & 8) != 0)
         {
             LittleEndianHelper.WriteShortU(aOut, this.m_runsList.Count);
         }
     }
     else if ((this.m_grbit & 8) != 0)
     {
         LittleEndianHelper.WriteShortU(aOut, 0);
     }
 }
コード例 #9
0
        private void WriteMaskedValue(int offset, short mask, short value)
        {
            short aVal = BitField16.PutValue(LittleEndianHelper.ReadShort(this.m_data, offset), mask, value);

            LittleEndianHelper.WriteShort(aVal, this.m_data, offset);
        }
コード例 #10
0
 public static long ReadIntU(byte[] aBuf, int aOff)
 {
     return((long)LittleEndianHelper.ReadInt(aBuf, aOff) & -1L);
 }
コード例 #11
0
 public static int ReadShortU(byte[] aBuf, int aOff)
 {
     return(LittleEndianHelper.ReadShort(aBuf, aOff) & 0xFFFF);
 }
コード例 #12
0
 public static void WriteFloat(float aVal, byte[] aBuf, int aOff)
 {
     LittleEndianHelper.WriteInt(Convert.ToInt32(aVal), aBuf, aOff);
 }
コード例 #13
0
        private void SetValue16(int offset, short mask, int value)
        {
            short aVal = BitField16.PutValue(LittleEndianHelper.ReadShort(this.m_xfData, offset), mask, (short)value);

            LittleEndianHelper.WriteShort(aVal, this.m_xfData, offset);
        }
コード例 #14
0
 public static char readChar(byte[] aBuf, int aOff)
 {
     return((char)(ushort)LittleEndianHelper.ReadShort(aBuf, aOff));
 }
コード例 #15
0
 public static long URShift(long number, long bits)
 {
     return(LittleEndianHelper.URShift(number, (int)bits));
 }
コード例 #16
0
 public static void WriteDouble(double aVal, byte[] aBuf, int aOff)
 {
     LittleEndianHelper.WriteLong(Convert.ToInt64(aVal), aBuf, aOff);
 }
コード例 #17
0
        public void Write(Stream aOut)
        {
            this.CalcSize();
            this.m_count = 0;
            int num  = 8228;
            int num2 = 12;

            this.StartRecord(aOut, 252);
            LittleEndianHelper.WriteIntU(aOut, this.m_totalStrings);
            LittleEndianHelper.WriteIntU(aOut, this.UniqueStrings);
            int             num3            = num - num2;
            StringChunkInfo stringChunkInfo = new StringChunkInfo();

            foreach (StringWrapperBIFF8 item in this.m_stringOrder)
            {
                stringChunkInfo.CharsTotal = item.Cch;
                int headerSize = item.HeaderSize;
                int num4       = num3 - headerSize;
                if (num4 < 0 || (num4 == 0 && item.Cch != 0))
                {
                    this.StartRecord(aOut, 60);
                    num2 = 4;
                    num3 = num - num2;
                }
                int aBytesAvailable = num3 - headerSize;
                num2 += headerSize;
                item.PrepareWriteCharacterData(stringChunkInfo, aBytesAvailable);
                item.WriteHeaderData(aOut, stringChunkInfo.Compressed);
                num2 += item.WriteCharacterData(aOut, stringChunkInfo, aBytesAvailable);
                num3  = ((!stringChunkInfo.HasMore) ? (num - num2) : 0);
                while (stringChunkInfo.HasMore)
                {
                    aBytesAvailable = num3;
                    int charPos           = stringChunkInfo.CharPos;
                    int characterDataSize = item.GetCharacterDataSize(stringChunkInfo, aBytesAvailable);
                    stringChunkInfo.CharPos = charPos;
                    if (characterDataSize == 0)
                    {
                        this.StartRecord(aOut, 60);
                        num2            = 5;
                        aBytesAvailable = 8223;
                        item.PrepareWriteCharacterData(stringChunkInfo, aBytesAvailable);
                        aOut.WriteByte((byte)((!stringChunkInfo.Compressed) ? 1 : 0));
                    }
                    else
                    {
                        item.PrepareWriteCharacterData(stringChunkInfo, aBytesAvailable);
                    }
                    num2 += item.WriteCharacterData(aOut, stringChunkInfo, aBytesAvailable);
                    num3  = ((!stringChunkInfo.HasMore) ? (num - num2) : 0);
                }
                int num5 = item.FormatRunsDataSize;
                if (num5 > 0)
                {
                    byte[] formatRunsData = item.FormatRunsData;
                    while (num5 > 0)
                    {
                        if (num3 == 0)
                        {
                            this.StartRecord(aOut, 60);
                            num2 = 4;
                            num3 = num - num2;
                        }
                        int num6 = (num3 < num5) ? num3 : num5;
                        num6 -= num6 % 4;
                        if (num6 > 0)
                        {
                            aOut.Write(formatRunsData, formatRunsData.Length - num5, num6);
                            num3 -= num6;
                            num5 -= num6;
                            num2 += num6;
                        }
                        else
                        {
                            num3 = 0;
                        }
                    }
                }
            }
        }
コード例 #18
0
 public static float ReadFloat(byte[] aBuf, int aOff)
 {
     return(Convert.ToSingle(LittleEndianHelper.ReadInt(aBuf, aOff)));
 }
コード例 #19
0
        private void SetValue32(int offset, int mask, int value)
        {
            int aVal = BitField32.PutValue(LittleEndianHelper.ReadInt(this.m_xfData, offset), mask, value);

            LittleEndianHelper.WriteInt(aVal, this.m_xfData, offset);
        }
コード例 #20
0
 public static double ReadDouble(byte[] aBuf, int aOff)
 {
     return(Convert.ToDouble(LittleEndianHelper.ReadLong(aBuf, aOff)));
 }