Browse Source

New command line argument - noExceptionBox

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4327 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 16 years ago
parent
commit
8fcb895665
  1. 45
      src/Main/StartUp/Project/SharpDevelopMain.cs

45
src/Main/StartUp/Project/SharpDevelopMain.cs

@ -32,28 +32,40 @@ namespace ICSharpCode.SharpDevelop
} }
} }
static bool UseExceptionBox {
get {
#if DEBUG
if (Debugger.IsAttached) return false;
#endif
foreach(string arg in commandLineArgs) {
if (arg.Contains("noExceptionBox")) return false;
}
return true;
}
}
/// <summary> /// <summary>
/// Starts the core of SharpDevelop. /// Starts the core of SharpDevelop.
/// </summary> /// </summary>
[STAThread()] [STAThread()]
public static void Main(string[] args) public static void Main(string[] args)
{ {
#if DEBUG commandLineArgs = args; // Needed by UseExceptionBox
if (Debugger.IsAttached) {
Run(args);
return;
}
#endif
// Do not use LoggingService here (see comment in Run(string[])) // Do not use LoggingService here (see comment in Run(string[]))
try { if (UseExceptionBox) {
Run(args);
} catch (Exception ex) {
try { try {
HandleMainException(ex); Run();
} catch (Exception loadError) { } catch (Exception ex) {
// HandleMainException can throw error when log4net is not found try {
MessageBox.Show(loadError.ToString(), "Critical error (Logging service defect?)"); HandleMainException(ex);
} catch (Exception loadError) {
// HandleMainException can throw error when log4net is not found
MessageBox.Show(loadError.ToString(), "Critical error (Logging service defect?)");
}
} }
} else {
Run();
} }
} }
@ -67,7 +79,7 @@ namespace ICSharpCode.SharpDevelop
} }
} }
static void Run(string[] args) static void Run()
{ {
// DO NOT USE LoggingService HERE! // DO NOT USE LoggingService HERE!
// LoggingService requires ICSharpCode.Core.dll and log4net.dll // LoggingService requires ICSharpCode.Core.dll and log4net.dll
@ -79,11 +91,10 @@ namespace ICSharpCode.SharpDevelop
#if DEBUG #if DEBUG
Control.CheckForIllegalCrossThreadCalls = true; Control.CheckForIllegalCrossThreadCalls = true;
#endif #endif
commandLineArgs = args;
bool noLogo = false; bool noLogo = false;
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
SplashScreenForm.SetCommandLineArgs(args); SplashScreenForm.SetCommandLineArgs(commandLineArgs);
foreach (string parameter in SplashScreenForm.GetParameterList()) { foreach (string parameter in SplashScreenForm.GetParameterList()) {
if ("nologo".Equals(parameter, StringComparison.OrdinalIgnoreCase)) if ("nologo".Equals(parameter, StringComparison.OrdinalIgnoreCase))
@ -108,7 +119,7 @@ namespace ICSharpCode.SharpDevelop
try { try {
StartupSettings startup = new StartupSettings(); StartupSettings startup = new StartupSettings();
#if DEBUG #if DEBUG
startup.UseSharpDevelopErrorHandler = !Debugger.IsAttached; startup.UseSharpDevelopErrorHandler = UseExceptionBox;
#endif #endif
Assembly exe = typeof(SharpDevelopMain).Assembly; Assembly exe = typeof(SharpDevelopMain).Assembly;

Loading…
Cancel
Save