/[EmuXPortal]/trunk/EmuXPortal/Form1.cs
ViewVC logotype

Diff of /trunk/EmuXPortal/Form1.cs

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

--- trunk/EmuXPortal/Form1.cs	2012/08/23 02:44:26	110
+++ trunk/EmuXPortal/Form1.cs	2012/08/23 04:13:19	112
@@ -19,18 +19,19 @@
         IEmuConfig CurrentSelectedRom = null;
         PlatformControl CurrentPlatformControl = null;
         GameControl CurrentGameControl = null;
+        logger log = new logger();
         public Form1()
         {
             InitializeComponent();
             platform_flow.Dock = DockStyle.Fill;
             rom_flow.Dock = DockStyle.Fill;
-          
+            log.OpenLog();          
         }
      
         private void Form1_Load(object sender, EventArgs e)
         {
-            Config.LoadConfig();
-            Config.InitializePresentationForm(this);           
+            Config.LoadConfig(log);
+            Config.InitializePresentationForm(log,this);           
         }
         private void Form1_Shown(object sender, EventArgs e) { platform_flow.Visible = true; Cursor.Hide(); }
         void platform_ctrl_LostFocus(object sender, EventArgs e)
@@ -369,7 +370,7 @@
         private void gameWorker_DoWork(object sender, DoWorkEventArgs e)
         {
             Stopwatch t = e.Argument as Stopwatch;
-            RomParser parser = new RomParser(CurrentSelectedRom);
+            RomParser parser = new RomParser(log, CurrentSelectedRom);
 
             ProgressBar bar = new ProgressBar();
             AddGameControl(bar);
@@ -402,7 +403,7 @@
                 UpdateGameControls();
                 Application.DoEvents();
                 int percent = (int)(100.0 * (count / total_count));
-                logger.WriteLine("gameWorker_DoWork(): count={0} total={1} percent={2}",count,total_count,percent);
+                log.WriteLine("gameWorker_DoWork(): count={0} total={1} percent={2}", count, total_count, percent);
                 bar.Invoke(new MethodInvoker(delegate
                 {
                     bar.Value = percent;
@@ -420,7 +421,7 @@
             rom_flow.Controls[0].Select();
             (rom_flow.Controls[0] as GameControl).BorderStyle = BorderStyle.FixedSingle;
             t.Stop();
-            logger.WriteLine("RomParser took: {0}s to parse roms", (int)t.Elapsed.TotalSeconds);
+            log.WriteLine("RomParser took: {0}s to parse roms", (int)t.Elapsed.TotalSeconds);
         }
         #endregion
         #region platformWorker
@@ -428,7 +429,7 @@
         private void platformWorker_DoWork(object sender, DoWorkEventArgs e)
         {
             Stopwatch t = e.Argument as Stopwatch;
-            PlatformParser parser = new PlatformParser(Config.RomPath);
+            PlatformParser parser = new PlatformParser(log, Config.RomPath);
             double count = 0;
             double total_count = parser.Platforms.Count;
             ProgressBar bar = new ProgressBar();
@@ -456,7 +457,7 @@
                 AddPlatformControl(platform_ctrl);
                 Application.DoEvents();
                 int percent = (int)(100.0 * (count / total_count));
-                logger.WriteLine("platformWorker_DoWork(): count={0} total={1} percent={2}", count, total_count, percent);
+                log.WriteLine("platformWorker_DoWork(): count={0} total={1} percent={2}", count, total_count, percent);
                 bar.Invoke(new MethodInvoker(delegate
                 {
                     bar.Value = percent;
@@ -473,13 +474,14 @@
             platform_flow.Controls.RemoveAt(0);
             platform_flow.Controls[0].Select();
             (platform_flow.Controls[0] as PlatformControl).BorderStyle = BorderStyle.FixedSingle;
-            logger.WriteLine("PlatformParser took: {0}s to parse platforms", (int)t.Elapsed.TotalSeconds);
+            log.WriteLine("PlatformParser took: {0}s to parse platforms", (int)t.Elapsed.TotalSeconds);
         }
         #endregion
 
         private void Form1_FormClosed(object sender, FormClosedEventArgs e)
         {
             Cursor.Show();
+            log.CloseLog();
         }
         #endregion
     }

 

  ViewVC Help
Powered by ViewVC 1.1.22