/[RomCheater]/trunk/RomCheater.RVACalculator/RVACalculatorDockControl.cs
ViewVC logotype

Contents of /trunk/RomCheater.RVACalculator/RVACalculatorDockControl.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 666 - (show annotations) (download)
Mon Jun 17 03:28:46 2013 UTC (8 years, 4 months ago) by william
File size: 4625 byte(s)

1 #region Logging Defines
2 // include this any class or method that required logging, and comment-out what is not needed
3
4 #region Enabled logging levels
5 #define LOGGING_ENABLE_INFO
6 #define LOGGING_ENABLE_WARN
7 #define LOGGING_ENABLE_DEBUG
8 #define LOGGING_ENABLE_VERBOSEDEBUG
9 #define LOGGING_ENABLE_ERROR
10 #define LOGGING_ENABLE_VERBOSEERROR
11 #define LOGGING_ENABLE_PROFILER
12 #endregion
13 #endregion
14 using System;
15 using System.Collections.Generic;
16 using System.ComponentModel;
17 using System.Data;
18 using System.Drawing;
19 using System.Linq;
20 using System.Text;
21 using System.Windows.Forms;
22 using WeifenLuo.WinFormsUI.Docking;
23 using RomCheater.Logging;
24
25 namespace RomCheater.RVACalculator
26 {
27 public partial class RVACalculatorDockControl : DockContent
28 {
29 public RVACalculatorDockControl()
30 {
31 InitializeComponent();
32 }
33
34 /*
35 * foreach (var col in Enumerable.Range(0, lstCheats.Columns.Count))
36 {
37 lstCheats.AutoResizeColumn(col, ColumnHeaderAutoResizeStyle.ColumnContent);
38 }
39 */
40 private void btnAdd_Click(object sender, EventArgs e)
41 {
42 string name = string.Empty;
43 string address = string.Empty;
44
45 name = Microsoft.VisualBasic.Interaction.InputBox("Input Dialog", "Enter the cheat name", string.Empty);
46 address = Microsoft.VisualBasic.Interaction.InputBox("Input Dialog", "Enter the cheat address (in hex : 0xXXXXXXXX)", string.Empty);
47 uint physical = Convert.ToUInt32(address, 16) + txtRVA.ToUInt32();
48 ListViewItem li = new ListViewItem(name);
49 li.SubItems.Add(new ListViewItem.ListViewSubItem(li, string.Format("0x{0:x8}", Convert.ToUInt32(address, 16))));
50 li.SubItems.Add(new ListViewItem.ListViewSubItem(li, string.Format("0x{0:x8}", physical)));
51 lstCheats.Items.Add(li);
52 }
53
54 private void btnRemove_Click(object sender, EventArgs e)
55 {
56 if (lstCheats.SelectedItems.Count == 0 || lstCheats.SelectedItems.Count > 1) { return; }
57 int index = lstCheats.SelectedIndices[0];
58 lstCheats.Items.RemoveAt(index);
59 }
60
61 private void btnUpdate_Click(object sender, EventArgs e)
62 {
63 if (lstCheats.SelectedItems.Count == 0 || lstCheats.SelectedItems.Count > 1) { return; }
64 int index = lstCheats.SelectedIndices[0];
65 var li = lstCheats.SelectedItems[0];
66 string name = li.Text;
67 string address = li.SubItems[1].Text;
68
69 name = Microsoft.VisualBasic.Interaction.InputBox("Input Dialog", "Enter the cheat name", name);
70 address = Microsoft.VisualBasic.Interaction.InputBox("Input Dialog", "Enter the cheat address (in hex : 0xXXXXXXXX)", address);
71 uint physical = Convert.ToUInt32(address, 16) + txtRVA.ToUInt32();
72 li.Text = name;
73 li.SubItems[1].Text = string.Format("0x{0:x8}", Convert.ToUInt32(address, 16));
74 li.SubItems[2].Text = string.Format("0x{0:x8}", physical);
75 lstCheats.Items[index] = li;
76 }
77
78 private void btnCopy_Click(object sender, EventArgs e)
79 {
80 string name = string.Empty;
81 string address = string.Empty;
82 }
83
84 private void btnSave_Click(object sender, EventArgs e)
85 {
86
87 }
88
89 private void btnLoad_Click(object sender, EventArgs e)
90 {
91
92 }
93
94 private void btnRefresh_Click(object sender, EventArgs e)
95 {
96 int index = 0;
97 foreach (ListViewItem li in lstCheats.Items)
98 {
99 string name = li.Text;
100 string address = li.SubItems[1].Text;
101 uint physical = Convert.ToUInt32(address, 16) + txtRVA.ToUInt32();
102 li.SubItems[2].Text = string.Format("0x{0:x8}", physical);
103 lstCheats.Items[index] = li;
104 index++;
105 }
106 }
107
108 private void RVACalculatorDockControl_Shown(object sender, EventArgs e)
109 {
110 //const int t = 100;
111 ////txtRVA.SuspendLayout();
112 //logger.Debug.WriteLine("txtRva.Width={0}", txtRVA.Width);
113 //logger.Debug.WriteLine("increasing txtRva.Width to {0}", txtRVA.Width + t);
114 //txtRVA.Width = txtRVA.Width + t;
115 //logger.Debug.WriteLine("txtRva.Width={0}", txtRVA.Width);
116 ////txtRVA.ResumeLayout();
117 }
118
119
120 }
121 }

  ViewVC Help
Powered by ViewVC 1.1.22