#region Logging Defines // include this any class or method that required logging, and comment-out what is not needed #region Enabled logging levels #define LOGGING_ENABLE_INFO #define LOGGING_ENABLE_WARN #define LOGGING_ENABLE_DEBUG #define LOGGING_ENABLE_VERBOSEDEBUG #define LOGGING_ENABLE_ERROR #define LOGGING_ENABLE_VERBOSEERROR #define LOGGING_ENABLE_PROFILER #endregion #endregion using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using WeifenLuo.WinFormsUI.Docking; using RomCheater.Logging; namespace RomCheater.RVACalculator { public partial class RVACalculatorDockControl : DockContent { public RVACalculatorDockControl() { InitializeComponent(); } /* * foreach (var col in Enumerable.Range(0, lstCheats.Columns.Count)) { lstCheats.AutoResizeColumn(col, ColumnHeaderAutoResizeStyle.ColumnContent); } */ private void btnAdd_Click(object sender, EventArgs e) { string name = string.Empty; string address = string.Empty; name = Microsoft.VisualBasic.Interaction.InputBox("Input Dialog", "Enter the cheat name", string.Empty); address = Microsoft.VisualBasic.Interaction.InputBox("Input Dialog", "Enter the cheat address (in hex : 0xXXXXXXXX)", string.Empty); uint physical = Convert.ToUInt32(address) + txtRVA.ToUInt32(); ListViewItem li = new ListViewItem(name); li.SubItems.Add(new ListViewItem.ListViewSubItem(li, string.Format("0x{0:x8}", Convert.ToUInt32(address)))); li.SubItems.Add(new ListViewItem.ListViewSubItem(li, string.Format("0x{0:x8}", physical))); lstCheats.Items.Add(li); } private void btnRemove_Click(object sender, EventArgs e) { if (lstCheats.SelectedItems.Count == 0 || lstCheats.SelectedItems.Count > 1) { return; } int index = lstCheats.SelectedIndices[0]; lstCheats.Items.RemoveAt(index); } private void btnUpdate_Click(object sender, EventArgs e) { if (lstCheats.SelectedItems.Count == 0 || lstCheats.SelectedItems.Count > 1) { return; } int index = lstCheats.SelectedIndices[0]; var li = lstCheats.SelectedItems[0]; string name = li.Text; string address = li.SubItems[1].Text; name = Microsoft.VisualBasic.Interaction.InputBox("Input Dialog", "Enter the cheat name", name); address = Microsoft.VisualBasic.Interaction.InputBox("Input Dialog", "Enter the cheat address (in hex : 0xXXXXXXXX)", address); uint physical = Convert.ToUInt32(address) + txtRVA.ToUInt32(); li.Text = name; li.SubItems[1].Text = string.Format("0x{0:x8}", Convert.ToUInt32(address)); li.SubItems[2].Text = string.Format("0x{0:x8}", physical); lstCheats.Items[index] = li; } private void btnCopy_Click(object sender, EventArgs e) { string name = string.Empty; string address = string.Empty; } private void btnSave_Click(object sender, EventArgs e) { } private void btnLoad_Click(object sender, EventArgs e) { } private void btnRefresh_Click(object sender, EventArgs e) { int index = 0; foreach (ListViewItem li in lstCheats.Items) { string name = li.Text; string address = li.SubItems[1].Text; uint physical = Convert.ToUInt32(address) + txtRVA.ToUInt32(); li.SubItems[2].Text = string.Format("0x{0:x8}", physical); lstCheats.Items[index] = li; index++; } } private void RVACalculatorDockControl_Shown(object sender, EventArgs e) { const int t = 100; //txtRVA.SuspendLayout(); logger.Debug.WriteLine("txtRva.Width={0}", txtRVA.Width); logger.Debug.WriteLine("increasing txtRva.Width to {0}", txtRVA.Width + t); txtRVA.Width = txtRVA.Width + t; logger.Debug.WriteLine("txtRva.Width={0}", txtRVA.Width); //txtRVA.ResumeLayout(); } } }