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);
        }
예제 #2
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;
                        }
                    }
                }
            }
        }