예제 #1
0
        private void DisplayCompressionInfoStructure(CompressionInformation.CompressionInfoStructure compressionInfoStructure)
        {
            var markers = new List <Marker>();

            switch (compressionInfoStructure)
            {
            case CompressionInformation.CompressionInfoStructure.Anchor:

                if (Page.CompressionInformation.AnchorRecord != null)
                {
                    markers = MarkerBuilder.BuildMarkers(Page.CompressionInformation.AnchorRecord);
                }

                break;

            case CompressionInformation.CompressionInfoStructure.Dictionary:

                if (Page.CompressionInformation.HasDictionary)
                {
                    markers = MarkerBuilder.BuildMarkers(Page.CompressionInformation.CompressionDictionary);
                }

                break;

            case CompressionInformation.CompressionInfoStructure.Header:

                markers = MarkerBuilder.BuildMarkers(Page?.CompressionInformation);
                break;
            }

            hexViewer.AddMarkers(markers);

            markerKeyTable.SetMarkers(markers);
        }
예제 #2
0
        /// <summary>
        /// Sets an allocation page to be displayed
        /// </summary>
        /// <param name="pageAddress">The page address.</param>
        /// <param name="databaseName">Name of the database.</param>
        /// <param name="connectionString">The connection string.</param>
        /// <param name="showHeader">if set to <c>true</c> [show header].</param>
        /// <returns></returns>
        public List <Marker> SetAllocationPage(PageAddress pageAddress, string databaseName, string connectionString, bool showHeader)
        {
            topPanel.Visible = showHeader;

            var allocationPage = new AllocationPage(connectionString, databaseName, pageAddress);

            allocationMap.Mode        = MapMode.Standard;
            allocationMap.ExtentCount = 63903;
            allocationMap.ExtentSize  = AllocationMap.Small;

            allocationMap.StartPage = allocationPage.StartPage;
            allocationMap.FileId    = allocationPage.StartPage.FileId;

            var layer = new AllocationLayer(allocationPage.PageAddress.ToString(),
                                            allocationPage,
                                            Color.Brown);

            layer.SingleSlotsOnly = false;

            allocationMap.MapLayers.Clear();
            allocationMap.MapLayers.Add(layer);

            allocationMap.Invalidate();

            if (showHeader)
            {
                SetIamInformation(allocationPage);
            }

            var markers = MarkerBuilder.BuildMarkers(allocationPage, string.Empty);

            return(markers);
        }
예제 #3
0
        /// <summary>
        /// Loads a record
        /// </summary>
        /// <param name="offset">The offset.</param>
        private void LoadRecord(ushort offset)
        {
            Record record = null;

            switch (Page.Header.PageType)
            {
            case PageType.Data:

                Structure tableStructure = new TableStructure(Page.Header.AllocationUnitId, Page.Database);

                if (Page.CompressionType == CompressionType.None)
                {
                    record = new DataRecord(Page, offset, tableStructure);
                }
                else
                {
                    record = new CompressedDataRecord(Page, offset, tableStructure);
                }

                allocationViewer.Visible = false;
                markerKeyTable.Visible   = true;
                break;

            case PageType.Index:

                Structure indexStructure = new IndexStructure(Page.Header.AllocationUnitId, Page.Database);

                record = new IndexRecord(Page, offset, indexStructure);

                allocationViewer.Visible = false;
                markerKeyTable.Visible   = true;
                break;

            case PageType.Iam:
            case PageType.Gam:
            case PageType.Sgam:
            case PageType.Bcm:
            case PageType.Dcm:

                allocationViewer.SetAllocationPage(Page.Header.PageAddress,
                                                   Page.Database.Name,
                                                   ConnectionString,
                                                   (Page.Header.PageType == PageType.Iam));

                markerKeyTable.Visible   = false;
                allocationViewer.Visible = true;
                break;

            case PageType.Pfs:

                allocationViewer.SetPfsPage(Page.Header.PageAddress,
                                            Page.Database.Name,
                                            ConnectionString);

                markerKeyTable.Visible   = false;
                allocationViewer.Visible = true;
                break;

            case PageType.Lob3:
            case PageType.Lob4:

                record = new BlobRecord(Page, offset);

                allocationViewer.Visible = false;
                markerKeyTable.Visible   = true;
                break;
            }

            if (record != null)
            {
                var markers = MarkerBuilder.BuildMarkers((Markable)record);

                hexViewer.AddMarkers(markers);

                markerKeyTable.SetMarkers(markers);

                hexViewer.ScrollToOffset(offset);

                offsetTableToolStripTextBox.Text = string.Format("{0:0000}", offset);
            }
        }