/[RomCheater]/trunk/RomCheater/Main.cs
ViewVC logotype

Diff of /trunk/RomCheater/Main.cs

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

--- trunk/RomCheater/Main.cs	2012/06/10 02:53:09	365
+++ trunk/RomCheater/Main.cs	2012/06/10 03:14:42	366
@@ -30,11 +30,12 @@
         private FloatingLogWindow m_LogWindow = new FloatingLogWindow();
         private FloatingAboutBox m_AboutBox = new FloatingAboutBox();
         private FloatingRamDumperDialog m_RamDump = new FloatingRamDumperDialog();
-        private PIDSelector m_PIDSelector = new PIDSelector();
+        private FloatingPIDSelector m_PIDSelector = new FloatingPIDSelector();
         private FloatingMemoryView m_memoryview = new FloatingMemoryView();
         private FloatingDataTypeConverter m_typeconverter = new FloatingDataTypeConverter();
         private FloatingMemorySearcher m_memsearcher = new FloatingMemorySearcher();
         private FloatingPEViewer m_peviewer = new FloatingPEViewer();
+        private FloatingRVACalculator m_rvacalc = new FloatingRVACalculator();
         //private bool log_window_expanded = false;
         //private double log_window_splitter_default_position = 1.4045;
         PluginLoader loader = null;
@@ -117,11 +118,12 @@
         {
             if (persistString == typeof(FloatingLogWindow).ToString()) { return m_LogWindow; }
             if (persistString == typeof(FloatingRamDumperDialog).ToString()) { return m_RamDump; }
-            if (persistString == typeof(PIDSelector).ToString()) { return m_PIDSelector; }
+            if (persistString == typeof(FloatingPIDSelector).ToString()) { return m_PIDSelector; }
             if (persistString == typeof(FloatingMemoryView).ToString()) { return m_memoryview; }
             if (persistString == typeof(FloatingDataTypeConverter).ToString()) { return m_typeconverter; }
             if (persistString == typeof(FloatingMemorySearcher).ToString()) { return m_memsearcher; }
             if (persistString == typeof(FloatingPEViewer).ToString()) { return m_peviewer; }
+            if (persistString == typeof(FloatingRVACalculator).ToString()) { return m_rvacalc; }
             else { return null; }
         }
         public void SetupDocks()
@@ -129,7 +131,7 @@
             m_LogWindow = new FloatingLogWindow();
             m_AboutBox = new FloatingAboutBox();
             m_RamDump = new FloatingRamDumperDialog();
-            m_PIDSelector = new PIDSelector();
+            m_PIDSelector = new FloatingPIDSelector();
             m_PIDSelector.OnSelectedProcessChanged += new BaseEventHandler<ProcessChangedEventArgs>(OnProcessChanged);
             m_memoryview = new FloatingMemoryView();
             m_typeconverter = new FloatingDataTypeConverter();
@@ -137,6 +139,7 @@
             m_memsearcher.OnBrowseMemoryRegion += new BaseEventHandler<BrowseMemoryRegionEvent>(OnBrowseMemoryRegion);
             m_peviewer = new FloatingPEViewer();
             m_peviewer.OnPEDataUpdated+=new BaseEventHandler<PEViewerDataUpdatedEvent>(OnPEDataUpdated);
+            m_rvacalc = new FloatingRVACalculator();
             m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
         }
         #region SetupDockWindowHandler support
@@ -149,6 +152,7 @@
             SetupDataTypeConverterWindowHandler();
             SetupMemorySearchWindowHandler();
             SetupPEViewerWindowHandler();
+            SetupRVACalculatorWindowHandler();
         }
         private void SetupLogWindowHandler()
         {
@@ -203,6 +207,14 @@
             m_PIDSelector.AcceptedPlugin = ConfigPlugin;
             m_peviewer.Activate();
         }
+        private void SetupRVACalculatorWindowHandler()
+        {
+            if (m_rvacalc == null) return;
+            m_rvacalc.Shown += new EventHandler(AddDockToWindowList);
+            m_rvacalc.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList);
+            m_rvacalc.AcceptedPlugin = ConfigPlugin;
+            m_rvacalc.Activate();
+        }
         #endregion
         public void ShowDocks()
         {
@@ -221,6 +233,8 @@
             SetupMemorySearchWindowHandler();
             ShowPEViewer();
             SetupPEViewerWindowHandler();
+            ShowRVACalculator();
+            SetupRVACalculatorWindowHandler();
         }
         public void ShowLogWindow()
         {
@@ -236,23 +250,23 @@
         }
         public void ShowRamDump()
         {
-            load_plugins();
+            load_plugins_silent();
             m_RamDump = new FloatingRamDumperDialog(ConfigPlugin);
             m_RamDump.AcceptedProcess = SelectedProcess;
             m_RamDump.Show(dockPanel);
         }       
         public void ShowMemoryView()
         {
-            load_plugins();
+            load_plugins_silent();
             m_memoryview = new FloatingMemoryView(ConfigPlugin);
             m_memoryview.AcceptedProcess = SelectedProcess;
             m_memoryview.Show(dockPanel);
         }
         public void ShowPidSelector()
         {
-            load_plugins();
+            load_plugins_silent();
             //List<Process> procs = ConfigPlugin.ValidProcessesForPlugin;
-            m_PIDSelector = new PIDSelector(ConfigPlugin);
+            m_PIDSelector = new FloatingPIDSelector(ConfigPlugin);
             m_PIDSelector.OnSelectedProcessChanged += new BaseEventHandler<ProcessChangedEventArgs>(OnProcessChanged);
             m_PIDSelector.Show(dockPanel);
         }
@@ -263,7 +277,7 @@
         }
         public void ShowMemorySearch()
         {
-            load_plugins();
+            load_plugins_silent();
             m_memsearcher = new FloatingMemorySearcher(ConfigPlugin);
             m_memsearcher.AcceptedProcess = SelectedProcess;
             m_memsearcher.OnBrowseMemoryRegion += new BaseEventHandler<BrowseMemoryRegionEvent>(OnBrowseMemoryRegion);
@@ -271,13 +285,19 @@
         }
         public void ShowPEViewer()
         {
-            load_plugins();
+            load_plugins_silent();
             m_peviewer = new FloatingPEViewer(ConfigPlugin);
             m_peviewer.AcceptedProcess = SelectedProcess;
             m_peviewer.OnPEDataUpdated +=new BaseEventHandler<PEViewerDataUpdatedEvent>(OnPEDataUpdated);
             m_peviewer.Show(dockPanel);
         }
-       
+        public void ShowRVACalculator()
+        {
+            load_plugins_silent();
+            m_rvacalc = new FloatingRVACalculator(ConfigPlugin);
+            m_rvacalc.AcceptedProcess = SelectedProcess;
+            m_rvacalc.Show(dockPanel, DockState.DockRightAutoHide);
+        }
         #endregion
 
 
@@ -309,19 +329,21 @@
             logger.SetLoggingFlags(loggerflags.ALL);
 #endif
         }
-        private void load_plugins()
+        private void load_plugins() { load_plugins(false); }
+        private void load_plugins_silent() { load_plugins(true); }
+        private void load_plugins(bool silent)
         {
             loader = new PluginLoader();
-            loader.LoadPlugins();
+            loader.LoadPlugins(silent);
 
             ConfigPlugin = loader.GetConfigPlugin(RomCheater.Properties.Settings.Default.LastConfigPlugin);
-            if (ConfigPlugin != null)
+            if (ConfigPlugin != null && !silent)
                 logger.Info.WriteLine("Loaded Config Plugin: {0}", ConfigPlugin.ToString());
             InputPlugin = loader.GetInputPlugin(RomCheater.Properties.Settings.Default.LastInputPlugin);
-            if (InputPlugin != null)
+            if (InputPlugin != null && !silent)
                 logger.Info.WriteLine("Loaded Input Plugin: {0}", InputPlugin.ToString());
             WindowPlugin = loader.GetWindowPlugin(RomCheater.Properties.Settings.Default.LastWindowPlugin);
-            if (WindowPlugin != null)
+            if (WindowPlugin != null && !silent)
                 logger.Info.WriteLine("Loaded Window Plugin: {0}", WindowPlugin.ToString());
 
             m_PIDSelector.AcceptedPlugin = ConfigPlugin;
@@ -355,8 +377,7 @@
             dlg.ShowDialog();
             logger.ForceLog.Info.WriteLine("LoggingFlags = 0x{0:x4} ({1})", logger.GetLoggingFlags().Value, logger.GetLoggingFlags().Name);
             // reload plugins
-            load_plugins();
-
+            load_plugins(true);
         }
 
         private void mnuItemOpenProcess_Click(object sender, EventArgs e)
@@ -491,6 +512,9 @@
             ShowPEViewer();
         }
 
-        
+        private void mnuItemShowRVACalculator_Click(object sender, EventArgs e)
+        {
+            ShowRVACalculator();
+        }        
     }
 }

 

  ViewVC Help
Powered by ViewVC 1.1.22