private void ProcessPageItemToken(byte token, BinaryReader reader, long offsetEndPage)
        {
            RSTrace.RenderingTracer.Assert(reader != null, "The pagination stream is null.");
            RSTrace.RenderingTracer.Assert(offsetEndPage > 0, "The pagination stream is corrupt.");
            switch (token)
            {
            case 1:
                m_itemPageSizes = new ItemSizes();
                if (m_itemPageSizes.ReadPaginationInfo(reader, offsetEndPage) != 0)
                {
                    throw new InvalidDataException(SPBRes.InvalidPaginationStream);
                }
                break;

            case 2:
                m_itemPageSizes = new PaddItemSizes();
                if (m_itemPageSizes.ReadPaginationInfo(reader, offsetEndPage) != 0)
                {
                    throw new InvalidDataException(SPBRes.InvalidPaginationStream);
                }
                break;

            case 3:
                m_state = (PageItem.State)reader.ReadByte();
                break;

            case 21:
                m_defLeftValue = reader.ReadDouble();
                break;

            case 4:
                m_pageItemsAbove = ReadIntList(reader, offsetEndPage);
                break;

            case 5:
                m_pageItemsLeft = ReadIntList(reader, offsetEndPage);
                break;

            default:
                throw new InvalidDataException(SPBRes.InvalidTokenPaginationProperties(token.ToString(CultureInfo.InvariantCulture)));
            }
            if (reader.BaseStream.Position > offsetEndPage)
            {
                throw new InvalidDataException(SPBRes.InvalidPaginationStream);
            }
        }
        private static void ReadSubReportProperties(PageItemHelper item, BinaryReader reader, long offsetEndPage)
        {
            RSTrace.RenderingTracer.Assert(item != null, "The item helper is null.");
            RSTrace.RenderingTracer.Assert(reader != null, "The pagination stream is null.");
            RSTrace.RenderingTracer.Assert(offsetEndPage > 0, "The pagination stream is corrupt.");
            byte b = reader.ReadByte();

            while (b != byte.MaxValue && reader.BaseStream.Position <= offsetEndPage)
            {
                switch (b)
                {
                case 23:
                    item.BodyIndex = reader.ReadInt32();
                    break;

                case 11:
                    item.PrevPageEnd = reader.ReadDouble();
                    break;

                case 19:
                {
                    byte b2 = reader.ReadByte();
                    if (b2 != 7)
                    {
                        throw new InvalidDataException(SPBRes.InvalidTokenPaginationItems(b2.ToString("x", CultureInfo.InvariantCulture)));
                    }
                    PageItemContainerHelper pageItemContainerHelper = new PageItemContainerHelper(b2);
                    ReadPageItemContainerProperties(pageItemContainerHelper, reader, offsetEndPage);
                    item.ChildPage = pageItemContainerHelper;
                    break;
                }

                default:
                    item.ProcessPageItemToken(b, reader, offsetEndPage);
                    break;
                }
                b = reader.ReadByte();
            }
            if (reader.BaseStream.Position > offsetEndPage)
            {
                throw new InvalidDataException(SPBRes.InvalidPaginationStream);
            }
        }
예제 #3
0
        internal static ReportSectionHelper ReadReportSection(BinaryReader reader, long offsetEndPage)
        {
            if (reader == null || offsetEndPage <= 0)
            {
                return(null);
            }
            _ = reader.BaseStream.Position;
            ReportSectionHelper reportSectionHelper = null;
            byte b = reader.ReadByte();

            if (b == 16)
            {
                reportSectionHelper = new ReportSectionHelper();
                ReadReportSectionProperties(reportSectionHelper, reader, offsetEndPage);
                if (reader.BaseStream.Position > offsetEndPage)
                {
                    throw new InvalidDataException(SPBRes.InvalidPaginationStream);
                }
                return(reportSectionHelper);
            }
            throw new InvalidDataException(SPBRes.InvalidTokenPaginationItems(b.ToString("x", CultureInfo.InvariantCulture)));
        }
        private static void ReadTablixProperties(PageTablixHelper item, BinaryReader reader, long offsetEndPage)
        {
            RSTrace.RenderingTracer.Assert(item != null, "The item helper is null.");
            RSTrace.RenderingTracer.Assert(reader != null, "The pagination stream is null.");
            RSTrace.RenderingTracer.Assert(offsetEndPage > 0, "The pagination stream is corrupt.");
            byte b = reader.ReadByte();

            while (b != byte.MaxValue && reader.BaseStream.Position <= offsetEndPage)
            {
                switch (b)
                {
                case 16:
                    item.LevelForRepeat = reader.ReadInt32();
                    break;

                case 22:
                    item.IgnoreTotalsOnLastLevel = reader.ReadBoolean();
                    break;

                case 17:
                    item.TablixCreateState = ReadIntList(reader, offsetEndPage);
                    break;

                case 18:
                    item.MembersInstanceIndex = ReadIntList(reader, offsetEndPage);
                    break;

                case 19:
                {
                    byte           b2             = reader.ReadByte();
                    PageItemHelper pageItemHelper = null;
                    switch (b2)
                    {
                    case 5:
                    case 6:
                        ReadPageItemContainerProperties((PageItemContainerHelper)(pageItemHelper = new PageItemContainerHelper(b2)), reader, offsetEndPage);
                        break;

                    case 1:
                    case 2:
                    case 3:
                    case 8:
                    case 9:
                    case 10:
                    case 12:
                    case 15:
                    case 17:
                        pageItemHelper = new PageItemHelper(b2);
                        ReadPageItemProperties(pageItemHelper, reader, offsetEndPage);
                        break;

                    case 4:
                        pageItemHelper = new PageItemHelper(b2);
                        ReadSubReportProperties(pageItemHelper, reader, offsetEndPage);
                        break;

                    case 11:
                        ReadTablixProperties((PageTablixHelper)(pageItemHelper = new PageTablixHelper(b2)), reader, offsetEndPage);
                        break;

                    default:
                        throw new InvalidDataException(SPBRes.InvalidTokenPaginationItems(b2.ToString("x", CultureInfo.InvariantCulture)));
                    }
                    item.ChildPage = pageItemHelper;
                    break;
                }

                default:
                    item.ProcessPageItemToken(b, reader, offsetEndPage);
                    break;
                }
                b = reader.ReadByte();
            }
            if (reader.BaseStream.Position > offsetEndPage)
            {
                throw new InvalidDataException(SPBRes.InvalidPaginationStream);
            }
        }
        private static void ReadPageItemContainerProperties(PageItemContainerHelper item, BinaryReader reader, long offsetEndPage)
        {
            RSTrace.RenderingTracer.Assert(item != null, "The item helper is null.");
            RSTrace.RenderingTracer.Assert(reader != null, "The pagination stream is null.");
            RSTrace.RenderingTracer.Assert(offsetEndPage > 0, "The pagination stream is corrupt.");
            byte b = reader.ReadByte();

            while (b != byte.MaxValue && reader.BaseStream.Position <= offsetEndPage)
            {
                switch (b)
                {
                case 6:
                    item.ItemsCreated = reader.ReadBoolean();
                    break;

                case 11:
                    item.PrevPageEnd = reader.ReadDouble();
                    break;

                case 9:
                {
                    if (reader.ReadByte() != 3)
                    {
                        throw new InvalidDataException(SPBRes.InvalidPaginationStream);
                    }
                    PageItemHelper pageItemHelper = new PageItemHelper(3);
                    ReadPageItemProperties(pageItemHelper, reader, offsetEndPage);
                    item.RightEdgeItem = pageItemHelper;
                    break;
                }

                case 7:
                {
                    int   num3   = reader.ReadInt32();
                    int[] array3 = new int[num3];
                    for (int k = 0; k < num3; k++)
                    {
                        array3[k] = reader.ReadInt32();
                    }
                    item.IndexesLeftToRight = array3;
                    break;
                }

                case 20:
                {
                    int   num4   = reader.ReadInt32();
                    int[] array4 = new int[num4];
                    for (int l = 0; l < num4; l++)
                    {
                        array4[l] = reader.ReadInt32();
                    }
                    item.IndexesTopToBottom = array4;
                    break;
                }

                case 10:
                {
                    int num2 = reader.ReadInt32();
                    PageItemHelper[] array2 = new PageItemHelper[num2];
                    for (int j = 0; j < num2; j++)
                    {
                        byte b3 = reader.ReadByte();
                        switch (b3)
                        {
                        case 5:
                        case 6:
                            ReadPageItemContainerProperties((PageItemContainerHelper)(array2[j] = new PageItemContainerHelper(b3)), reader, offsetEndPage);
                            break;

                        case 1:
                        case 2:
                        case 3:
                        case 8:
                        case 9:
                        case 10:
                        case 12:
                        case 15:
                        case 17:
                            array2[j] = new PageItemHelper(b3);
                            ReadPageItemProperties(array2[j], reader, offsetEndPage);
                            break;

                        case 4:
                            array2[j] = new PageItemHelper(b3);
                            ReadSubReportProperties(array2[j], reader, offsetEndPage);
                            break;

                        case 11:
                            ReadTablixProperties((PageTablixHelper)(array2[j] = new PageTablixHelper(b3)), reader, offsetEndPage);
                            break;

                        case 14:
                            reader.ReadByte();
                            array2[j] = null;
                            break;

                        default:
                            throw new InvalidDataException(SPBRes.InvalidTokenPaginationItems(b3.ToString("x", CultureInfo.InvariantCulture)));
                        }
                    }
                    item.Children = array2;
                    break;
                }

                case 8:
                {
                    int num = reader.ReadInt32();
                    PageItemRepeatWithHelper[] array = new PageItemRepeatWithHelper[num];
                    for (int i = 0; i < num; i++)
                    {
                        byte b2 = reader.ReadByte();
                        array[i] = new PageItemRepeatWithHelper(b2);
                        if (b2 != 14)
                        {
                            ReadRepeatWithItemProperties(array[i], reader, offsetEndPage);
                            continue;
                        }
                        reader.ReadByte();
                        array[i] = null;
                    }
                    item.RepeatWithItems = array;
                    break;
                }

                default:
                    item.ProcessPageItemToken(b, reader, offsetEndPage);
                    break;
                }
                b = reader.ReadByte();
            }
            if (reader.BaseStream.Position > offsetEndPage)
            {
                throw new InvalidDataException(SPBRes.InvalidPaginationStream);
            }
        }
        private static void ReadRepeatWithItemProperties(PageItemRepeatWithHelper item, BinaryReader reader, long offsetEndPage)
        {
            RSTrace.RenderingTracer.Assert(item != null, "The item helper is null.");
            RSTrace.RenderingTracer.Assert(reader != null, "The pagination stream is null.");
            RSTrace.RenderingTracer.Assert(offsetEndPage > 0, "The pagination stream is corrupt.");
            byte b = reader.ReadByte();

            while (b != byte.MaxValue && reader.BaseStream.Position <= offsetEndPage)
            {
                switch (b)
                {
                case 12:
                    item.RelativeTop = reader.ReadDouble();
                    break;

                case 13:
                    item.RelativeBottom = reader.ReadDouble();
                    break;

                case 14:
                    item.RelativeTopToBottom = reader.ReadDouble();
                    break;

                case 15:
                    item.DataRegionIndex = reader.ReadInt32();
                    break;

                case 1:
                    item.RenderItemSize = new ItemSizes();
                    if (item.RenderItemSize.ReadPaginationInfo(reader, offsetEndPage) != 0)
                    {
                        throw new InvalidDataException(SPBRes.InvalidPaginationStream);
                    }
                    break;

                case 2:
                    item.RenderItemSize = new PaddItemSizes();
                    if (item.RenderItemSize.ReadPaginationInfo(reader, offsetEndPage) != 0)
                    {
                        throw new InvalidDataException(SPBRes.InvalidPaginationStream);
                    }
                    break;

                case 19:
                {
                    byte           b2             = reader.ReadByte();
                    PageItemHelper pageItemHelper = null;
                    switch (b2)
                    {
                    case 5:
                    case 6:
                        ReadPageItemContainerProperties((PageItemContainerHelper)(pageItemHelper = new PageItemContainerHelper(b2)), reader, offsetEndPage);
                        break;

                    case 1:
                    case 8:
                    case 9:
                    case 12:
                        pageItemHelper = new PageItemHelper(b2);
                        ReadPageItemProperties(pageItemHelper, reader, offsetEndPage);
                        break;

                    default:
                        throw new InvalidDataException(SPBRes.InvalidTokenPaginationItems(b2.ToString("x", CultureInfo.InvariantCulture)));
                    }
                    item.ChildPage = pageItemHelper;
                    break;
                }

                default:
                    throw new InvalidDataException(SPBRes.InvalidTokenPaginationProperties(b.ToString("x", CultureInfo.InvariantCulture)));
                }
                b = reader.ReadByte();
            }
            if (reader.BaseStream.Position > offsetEndPage)
            {
                throw new InvalidDataException(SPBRes.InvalidPaginationStream);
            }
        }