/[RomCheater]/trunk/RomCheater/Docking/FloatingRVACalculator.cs
ViewVC logotype

Contents of /trunk/RomCheater/Docking/FloatingRVACalculator.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 578 - (show annotations) (download)
Thu Jun 6 08:18:44 2013 UTC (6 years, 8 months ago) by william
File size: 2730 byte(s)

1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Data;
5 using System.Drawing;
6 using System.Linq;
7 using System.Text;
8 using System.Windows.Forms;
9 using WeifenLuo.WinFormsUI.Docking;
10 using RomCheater.PluginFramework.Interfaces;
11 using System.Diagnostics;
12 using RomCheater.PluginFramework.Events;
13 using Sojaner.MemoryScanner;
14
15 namespace RomCheater.Docking
16 {
17 public partial class FloatingRVACalculator : DockContent,
18 IAcceptsPlugin<IConfigPlugin>,
19 IAcceptsProcess<Process>,
20 IAcceptsProcessAndConfig,
21 IAcceptPEData
22 {
23 public FloatingRVACalculator() { InitializeComponent(); this.AcceptedPlugin = null; this.AcceptedProcess = null; }
24 public FloatingRVACalculator(IConfigPlugin config) : this() { this.AcceptedPlugin = config; }
25 public FloatingRVACalculator(IConfigPlugin config, Process process) : this() { this.AcceptedPlugin = config; this.AcceptedProcess = process; }
26 #region IAcceptsProcess<Process> Members
27 public Process AcceptedProcess { get; set; }
28 #endregion
29 #region IAcceptsPlugin<IConfigPlugin> Members
30 public IConfigPlugin AcceptedPlugin { get; set; }
31 #endregion
32 #region IAcceptPEData members
33 private IPEDData peData { get; set; }
34 public void SetPEViewerData(IPEDData peData)
35 { this.peData = peData;
36
37 if(peData.Is32bitAssembly())
38 {
39 txtImageBase.Value = (uint)peData.NTHeader.OptionalHeader32._ImageBase;
40 }
41 else
42 {
43 txtImageBase.Value = (ulong)peData.NTHeader.OptionalHeader64._ImageBase;
44 }
45
46 }
47 #endregion
48
49 private void btnConvertMemoryToFile_Click(object sender, EventArgs e)
50 {
51 if (txtMemToFile_ImageAddress.Value < txtImageBase.Value)
52 {
53 MessageBox.Show("Image Address cannot be less than Image Base!", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
54 return;
55 }
56
57 txtMemToFile_FileAddress.Value = (txtMemToFile_ImageAddress.Value - txtImageBase.Value);
58
59 }
60
61 private void btnConvertFileToMemory_Click(object sender, EventArgs e)
62 {
63 if (txtFileToMem_FileAddress.Value < txtFileBase.Value)
64 {
65 MessageBox.Show("File Address cannot be less than File Base!", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
66 return;
67 }
68 txtFileToMem_ImageAddress.Value = (txtFileToMem_FileAddress.Value + txtImageBase.Value);
69 }
70 }
71 }

  ViewVC Help
Powered by ViewVC 1.1.22