static void Main(string[] args) { try { Log.WriteEntry("Starting"); LightCoreBuilder builder = new LightCoreBuilder(); _container = builder.BuildContainer(); _splash = _container.Resolve<ISplash>(); _splash.Show(); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); // Delete any temp files created during compilation of profile IO string temp = Path.Combine(Pandora.Folder, "temp.dll"); if (File.Exists(temp)) { _splash.SetStatusText("Deleting temporary files"); File.Delete(temp); } _profileManager = _container.Resolve<ProfileManager>(); // Issue 28: Refactoring Pandora.cs - Tarion // Move any profiles resulting from previous versions _profileManager.MoveOldProfiles(); //ProfileManager.Instance.MoveOldProfiles(); // End Issue 28: if (args.Length == 1 && File.Exists(args[0]) && Path.GetExtension(args[0]).ToLower() == ".pbp") { _profileManager.ImportProfile(args[0]); } StartingContext context = _container.Resolve<StartingContext>(); Application.Run(context); // the following code is replaced, logic moved into StartingContext /* if (profileManager.ProfileLoaded) { Pandora.Log.WriteEntry("Import startup initiated"); m_Context = new StartingContext(profileManager.Profile.Name); Application.Run(m_Context); } else { Pandora.Log.WriteEntry("Normal startup initiated"); // Move on with normal startup Process proc = Pandora.ExistingInstance; if (proc != null) // Single instance check { Pandora.Log.WriteError(null, "Double instance detected"); System.Windows.Forms.MessageBox.Show("You can't run two instances of Pandora's Box at the same time"); // Issue 33: Bring to front if already started - Tarion ProcessExtension.BringToFront(proc); } else { Pandora.Log.WriteEntry("Double instances check passed"); m_Context = new StartingContext(); Application.Run(m_Context); } } */ } catch (Exception err) { Clipboard.SetDataObject(err.ToString(), true); MessageBox.Show("An error occurred. The error text has been placed on your clipboard, use CTRL+V to paste it in a text file."); // Issue 6: Improve error management - Tarion Environment.Exit(1); // End Issue 6: } }
static void Main(string[] args) { try { Log.WriteEntry("Starting"); LightCoreBuilder builder = new LightCoreBuilder(); _container = builder.BuildContainer(); _splash = _container.Resolve <ISplash>(); _splash.Show(); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); // Delete any temp files created during compilation of profile IO string temp = Path.Combine(Pandora.Folder, "temp.dll"); if (File.Exists(temp)) { _splash.SetStatusText("Deleting temporary files"); File.Delete(temp); } _profileManager = _container.Resolve <ProfileManager>(); // Issue 28: Refactoring Pandora.cs - Tarion // Move any profiles resulting from previous versions _profileManager.MoveOldProfiles(); //ProfileManager.Instance.MoveOldProfiles(); // End Issue 28: if (args.Length == 1 && File.Exists(args[0]) && Path.GetExtension(args[0]).ToLower() == ".pbp") { _profileManager.ImportProfile(args[0]); } StartingContext context = _container.Resolve <StartingContext>(); Application.Run(context); // the following code is replaced, logic moved into StartingContext /* * if (profileManager.ProfileLoaded) * { * Pandora.Log.WriteEntry("Import startup initiated"); * m_Context = new StartingContext(profileManager.Profile.Name); * Application.Run(m_Context); * } * else * { * Pandora.Log.WriteEntry("Normal startup initiated"); * * // Move on with normal startup * Process proc = Pandora.ExistingInstance; * if (proc != null) // Single instance check * { * Pandora.Log.WriteError(null, "Double instance detected"); * System.Windows.Forms.MessageBox.Show("You can't run two instances of Pandora's Box at the same time"); * // Issue 33: Bring to front if already started - Tarion * ProcessExtension.BringToFront(proc); * } * else * { * Pandora.Log.WriteEntry("Double instances check passed"); * * m_Context = new StartingContext(); * Application.Run(m_Context); * } * } */ } catch (Exception err) { Clipboard.SetDataObject(err.ToString(), true); MessageBox.Show("An error occurred. The error text has been placed on your clipboard, use CTRL+V to paste it in a text file."); // Issue 6: Improve error management - Tarion Environment.Exit(1); // End Issue 6: } }