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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/RomCheater/Docking/FloatingRVACalculator.cs	2012/06/10 03:14:42	366
+++ trunk/RomCheater/Docking/FloatingRVACalculator.cs	2012/06/10 03:39:00	367
@@ -9,13 +9,16 @@
 using WeifenLuo.WinFormsUI.Docking;
 using RomCheater.PluginFramework.Interfaces;
 using System.Diagnostics;
+using RomCheater.PluginFramework.Events;
+using Sojaner.MemoryScanner;
 
 namespace RomCheater.Docking
 {
     public partial class FloatingRVACalculator : DockContent,
         IAcceptsPlugin<IConfigPlugin>,
         IAcceptsProcess<Process>,
-        IAcceptsProcessAndConfig
+        IAcceptsProcessAndConfig,
+        IAcceptPEData
     {
         public FloatingRVACalculator() { InitializeComponent(); this.AcceptedPlugin = null; this.AcceptedProcess = null; }
         public FloatingRVACalculator(IConfigPlugin config) : this() { this.AcceptedPlugin = config; }
@@ -26,5 +29,43 @@
         #region IAcceptsPlugin<IConfigPlugin> Members
         public IConfigPlugin AcceptedPlugin { get; set; }
         #endregion
+        #region IAcceptPEData members
+        private IPEDData peData { get; set; }
+        public void SetPEViewerData(IPEDData peData) 
+        { this.peData = peData; 
+
+            if(peData.Is32bitAssembly())
+            {
+                txtImageBase.Value = (int)peData.NTHeader.OptionalHeader32._ImageBase;
+            }
+            else
+            {
+                txtImageBase.Value = (long)peData.NTHeader.OptionalHeader64._ImageBase;
+            }
+            
+        }
+        #endregion
+
+        private void btnConvertMemoryToFile_Click(object sender, EventArgs e)
+        {
+            if (txtMemToFile_ImageAddress.Value < txtImageBase.Value)
+            {
+                MessageBox.Show("Image Address cannot be less than Image Base!", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                return;
+            }
+
+            txtMemToFile_FileAddress.Value = (txtMemToFile_ImageAddress.Value - txtImageBase.Value);
+
+        }
+
+        private void btnConvertFileToMemory_Click(object sender, EventArgs e)
+        {
+            if (txtFileToMem_FileAddress.Value < txtFileBase.Value)
+            {
+                MessageBox.Show("File Address cannot be less than File Base!", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                return;
+            }
+            txtFileToMem_ImageAddress.Value = (txtFileToMem_FileAddress.Value + txtImageBase.Value);
+        }
     }
 }

 

  ViewVC Help
Powered by ViewVC 1.1.22