예제 #1
0
		string DecodeToken(CodedToken desc, uint codedToken) {
			MDToken token;
			if (!desc.Decode(codedToken, out token))
				return "<<<INVALID>>>";

			if (!Parent.Tables.HasTable(token.Table) ||
			    Parent.Tables.Get(token.Table).IsInvalidRID(token.Rid))
				return "<<<INVALID>>>";

			return token.ToDescription();
		}
예제 #2
0
        string GetCodedTokenDescription(CodedToken codedToken, string codedTokenName, ColumnInfo col, HexField field)
        {
            MDToken token;
            if (!codedToken.Decode(ReadFieldValue(field), out token))
                return string.Format("Invalid {0} Coded Token", codedTokenName);

            var info = GetInfo(token.Table, token.Rid);
            if (string.IsNullOrEmpty(info))
                return string.Format("{0}: {1}[{2}], 0x{3:X8})", codedTokenName, token.Table, token.Rid, token.Raw);
            return string.Format("{0} ({1}: {2}[{3}], 0x{4:X8})", info, codedTokenName, token.Table, token.Rid, token.Raw);
        }
예제 #3
0
        string GetCodedTokenDescription(CodedToken codedToken, string codedTokenName, ColumnInfo col, HexField field)
        {
            MDToken token;
            if (!codedToken.Decode(ReadFieldValue(field), out token))
                return string.Empty;

            return string.Format("{0} Coded Token: {1}[{2}] (0x{3:X8})", codedTokenName, token.Table, token.Rid, token.Raw);
        }
예제 #4
0
		static ContextMenuStrip CreateCodedTokenContextMenu(MDTableHeapView view, CodedToken code) {
			var menu = new ContextMenuStrip();

			var go = new ToolStripMenuItem("Go To Row");
			go.Click += (sender, e) => {
				var gridView = (GridView)menu.SourceControl;
				var rowIndex = gridView.SelectedCells[0].RowIndex;

				if (gridView[4, rowIndex].Value == InvalidValue) {
					MessageBox.Show("Invalid token.", view.App.AppName, MessageBoxButtons.OK, MessageBoxIcon.Error);
					return;
				}

				var token = code.Decode(Convert.ToUInt32(gridView[3, rowIndex].Value));
				view.SelectItem(new MDToken(token));
			};
			menu.Items.Add(go);

			return menu;
		}