void SetField <T>(TextBox textbox, StatefulVariable <T> val) where T : struct, IComparable { this.UIThread(delegate { if (val is StatefulVariable <UInt32> ) { textbox.Text = string.Format("{0:X8}", val.CurrentValue); } else if (val is StatefulVariable <UInt16> ) { textbox.Text = string.Format("{0:X4}", val.CurrentValue); } else if (val is StatefulVariable <Boolean> ) { textbox.Text = string.Format("{0}", Convert.ToBoolean(val.CurrentValue) ? "1" : "0"); } else { textbox.Text = Convert.ToString(val.CurrentValue); } if (mStatefulRegisters.EIP.HasChanged) { textbox.BackColor = (val.HasChanged ? highlightColor : defaultBackColor); } }); }
public StatefulX86Registers() { EAX = new StatefulVariable <UInt32>(); EBX = new StatefulVariable <UInt32>(); ECX = new StatefulVariable <UInt32>(); EDX = new StatefulVariable <UInt32>(); ESI = new StatefulVariable <UInt32>(); EDI = new StatefulVariable <UInt32>(); EBP = new StatefulVariable <UInt32>(); ESP = new StatefulVariable <UInt32>(); EIP = new StatefulVariable <UInt32>(); CS = new StatefulVariable <UInt16>(); DS = new StatefulVariable <UInt16>(); SS = new StatefulVariable <UInt16>(); ES = new StatefulVariable <UInt16>(); FS = new StatefulVariable <UInt16>(); GS = new StatefulVariable <UInt16>(); Flags = new StatefulVariable <UInt32>(); CarryFlag = new StatefulVariable <bool>(); ParityFlag = new StatefulVariable <bool>(); AdjustFlag = new StatefulVariable <bool>(); ZeroFlag = new StatefulVariable <bool>(); SignFlag = new StatefulVariable <bool>(); TrapFlag = new StatefulVariable <bool>(); InterruptEnableFlag = new StatefulVariable <bool>(); DirectionFlag = new StatefulVariable <bool>(); OverflowFlag = new StatefulVariable <bool>(); NestedTaskFlag = new StatefulVariable <bool>(); ResumeFlag = new StatefulVariable <bool>(); Virtual8086ModeFlag = new StatefulVariable <bool>(); AlignmentCheck = new StatefulVariable <bool>(); VirtualInterruptFlag = new StatefulVariable <bool>(); VirtualInterruptPending = new StatefulVariable <bool>(); AllowCPUID = new StatefulVariable <bool>(); IOPrivilegeLevel = new StatefulVariable <byte>(); Flags.Updated += new EventHandler(Flags_OnUpdate); }