protected override void OnModelUpdated() { gridView.Clear(); if (Model != null) { hexView.ClearHighLight(); var tbls = Model.Stream; var ranges = new List <Tuple <uint, uint> >(); uint relBase = (uint)tbls.StartOffset; uint offset = 0; gridView.AddRow("Reserved1", ranges.IncrementOffset(relBase, ref offset, 4), tbls.Reserved1); gridView.AddRow("MajorVersion", ranges.IncrementOffset(relBase, ref offset, 1), (byte)(tbls.Version >> 8)); gridView.AddRow("MinorVersion", ranges.IncrementOffset(relBase, ref offset, 1), (byte)tbls.Version); gridView.AddRow("Flags", ranges.IncrementOffset(relBase, ref offset, 1), tbls.Flags); gridView.AddRow("Log2Rid", ranges.IncrementOffset(relBase, ref offset, 1), tbls.Log2Rid); gridView.AddRow("MaskValid", ranges.IncrementOffset(relBase, ref offset, 8), tbls.ValidMask); gridView.AddRow("MaskSorted", ranges.IncrementOffset(relBase, ref offset, 8), tbls.SortedMask); var rowSizeBegin = offset; var numTbls = Math.Min(Utils.GetNumOfSetBits(tbls.ValidMask), 0x3f); var rowSizeEnd = rowSizeBegin + numTbls * 4; hexView.AddHighLight(new HexViewer.HighLight(Color.Green, rowSizeBegin, rowSizeEnd)); if (tbls.HasExtraData) { gridView.AddRow("ExtraData (!)", ranges.IncrementOffset(relBase, ref rowSizeEnd, 4), tbls.ExtraData); } hexView.AddHighLights(ranges, Color.Red, Color.Blue); hexView.Stream = tbls.GetClonedImageStream(); } else { hexView.Stream = null; } }
void PopulateMDHeader() { hexView.ClearHighLight(); var header = Model.MetaData.MetaDataHeader; var ranges = new List <Tuple <uint, uint> >(); uint relBase = (uint)header.StartOffset; uint offset = 0; hdrGridView.AddRow("Signature", ranges.IncrementOffset(relBase, ref offset, 4), header.Signature); hdrGridView.AddRow("MajorVersion", ranges.IncrementOffset(relBase, ref offset, 2), header.MajorVersion); hdrGridView.AddRow("MinorVersion", ranges.IncrementOffset(relBase, ref offset, 2), header.MinorVersion); hdrGridView.AddRow("Reserved", ranges.IncrementOffset(relBase, ref offset, 4), header.Reserved1); hdrGridView.AddRow("VersionLength", ranges.IncrementOffset(relBase, ref offset, 4), header.StringLength); hdrGridView.AddRow("VersionString", ranges.IncrementOffset(relBase, ref offset, header.StringLength), header.VersionString); hdrGridView.AddRow("Flags", ranges.IncrementOffset(relBase, ref offset, 1), header.Flags); hdrGridView.AddRow("Reserved", ranges.IncrementOffset(relBase, ref offset, 1), header.Reserved2); hdrGridView.AddRow("NumberOfStreams", ranges.IncrementOffset(relBase, ref offset, 2), header.Streams); hexView.AddHighLights(ranges, Color.Red, Color.Blue); }