Less message box popups, more reporting in the Errors and Warning dialog window

This commit is contained in:
codeimp 2009-04-06 05:51:59 +00:00
parent c53ee9c927
commit 1921c63583
3 changed files with 21 additions and 22 deletions

View file

@ -256,16 +256,16 @@ namespace CodeImp.DoomBuilder
if(cfg.ErrorResult != 0) if(cfg.ErrorResult != 0)
{ {
// Error in configuration // Error in configuration
ShowErrorMessage("Unable to load the game configuration file \"" + filename + "\".\n" + errorlogger.Add(ErrorType.Error, "Unable to load the game configuration file \"" + filename + "\". " +
"Error near line " + cfg.ErrorLine + ": " + cfg.ErrorDescription, MessageBoxButtons.OK); "Error near line " + cfg.ErrorLine + ": " + cfg.ErrorDescription);
return null; return null;
} }
// Check if this is a Doom Builder 2 config // Check if this is a Doom Builder 2 config
else if(cfg.ReadSetting("type", "") != "Doom Builder 2 Game Configuration") else if(cfg.ReadSetting("type", "") != "Doom Builder 2 Game Configuration")
{ {
// Old configuration // Old configuration
ShowErrorMessage("Unable to load the game configuration file \"" + filename + "\".\n" + errorlogger.Add(ErrorType.Error, "Unable to load the game configuration file \"" + filename + "\". " +
"This configuration is not a Doom Builder 2 game configuration.", MessageBoxButtons.OK); "This configuration is not a Doom Builder 2 game configuration.");
return null; return null;
} }
else else
@ -314,7 +314,7 @@ namespace CodeImp.DoomBuilder
catch(Exception) catch(Exception)
{ {
// Unable to load configuration // Unable to load configuration
ShowErrorMessage("Unable to load the game configuration file \"" + filename + "\".", MessageBoxButtons.OK); errorlogger.Add(ErrorType.Error, "Unable to load the game configuration file \"" + filename + "\".");
return null; return null;
} }
} }
@ -379,8 +379,8 @@ namespace CodeImp.DoomBuilder
if(cfg.ErrorResult != 0) if(cfg.ErrorResult != 0)
{ {
// Error in configuration // Error in configuration
ShowErrorMessage("Unable to load the compiler configuration file \"" + Path.GetFileName(filepath) + "\".\n" + errorlogger.Add(ErrorType.Error, "Unable to load the compiler configuration file \"" + Path.GetFileName(filepath) + "\". " +
"Error near line " + cfg.ErrorLine + ": " + cfg.ErrorDescription, MessageBoxButtons.OK); "Error near line " + cfg.ErrorLine + ": " + cfg.ErrorDescription);
} }
else else
{ {
@ -399,7 +399,7 @@ namespace CodeImp.DoomBuilder
catch(Exception e) catch(Exception e)
{ {
// Unable to load configuration // Unable to load configuration
ShowErrorMessage("Unable to load the nodebuilder configuration '" + de.Key.ToString() + "' from \"" + Path.GetFileName(filepath) + "\". Error: " + e.Message, MessageBoxButtons.OK); errorlogger.Add(ErrorType.Error, "Unable to load the nodebuilder configuration '" + de.Key.ToString() + "' from \"" + Path.GetFileName(filepath) + "\". Error: " + e.Message);
} }
} }
} }
@ -408,7 +408,7 @@ namespace CodeImp.DoomBuilder
catch(Exception) catch(Exception)
{ {
// Unable to load configuration // Unable to load configuration
ShowErrorMessage("Unable to load the compiler configuration file \"" + Path.GetFileName(filepath) + "\".", MessageBoxButtons.OK); errorlogger.Add(ErrorType.Error, "Unable to load the compiler configuration file \"" + Path.GetFileName(filepath) + "\".");
} }
} }
@ -441,8 +441,8 @@ namespace CodeImp.DoomBuilder
if(cfg.ErrorResult != 0) if(cfg.ErrorResult != 0)
{ {
// Error in configuration // Error in configuration
ShowErrorMessage("Unable to load the script configuration file \"" + Path.GetFileName(filepath) + "\".\n" + errorlogger.Add(ErrorType.Error, "Unable to load the script configuration file \"" + Path.GetFileName(filepath) + "\". " +
"Error near line " + cfg.ErrorLine + ": " + cfg.ErrorDescription, MessageBoxButtons.OK); "Error near line " + cfg.ErrorLine + ": " + cfg.ErrorDescription);
} }
else else
{ {
@ -456,14 +456,14 @@ namespace CodeImp.DoomBuilder
catch(Exception e) catch(Exception e)
{ {
// Unable to load configuration // Unable to load configuration
ShowErrorMessage("Unable to load the script configuration \"" + Path.GetFileName(filepath) + "\". Error: " + e.Message, MessageBoxButtons.OK); errorlogger.Add(ErrorType.Error, "Unable to load the script configuration \"" + Path.GetFileName(filepath) + "\". Error: " + e.Message);
} }
} }
} }
catch(Exception e) catch(Exception e)
{ {
// Unable to load configuration // Unable to load configuration
ShowErrorMessage("Unable to load the script configuration file \"" + Path.GetFileName(filepath) + "\". Error: " + e.Message, MessageBoxButtons.OK); errorlogger.Add(ErrorType.Error, "Unable to load the script configuration file \"" + Path.GetFileName(filepath) + "\". Error: " + e.Message);
} }
} }
} }
@ -495,8 +495,8 @@ namespace CodeImp.DoomBuilder
if(cfg.ErrorResult != 0) if(cfg.ErrorResult != 0)
{ {
// Error in configuration // Error in configuration
ShowErrorMessage("Unable to load the compiler configuration file \"" + Path.GetFileName(filepath) + "\".\n" + errorlogger.Add(ErrorType.Error, "Unable to load the compiler configuration file \"" + Path.GetFileName(filepath) + "\". " +
"Error near line " + cfg.ErrorLine + ": " + cfg.ErrorDescription, MessageBoxButtons.OK); "Error near line " + cfg.ErrorLine + ": " + cfg.ErrorDescription);
} }
else else
{ {
@ -525,7 +525,7 @@ namespace CodeImp.DoomBuilder
catch(Exception) catch(Exception)
{ {
// Unable to load configuration // Unable to load configuration
ShowErrorMessage("Unable to load the compiler configuration file \"" + Path.GetFileName(filepath) + "\".", MessageBoxButtons.OK); errorlogger.Add(ErrorType.Error, "Unable to load the compiler configuration file \"" + Path.GetFileName(filepath) + "\".");
} }
} }
} }

View file

@ -67,8 +67,9 @@ namespace CodeImp.DoomBuilder.Plugins
public Plugin(string filename) public Plugin(string filename)
{ {
// Initialize // Initialize
string shortfilename = Path.GetFileName(filename);
name = Path.GetFileNameWithoutExtension(filename); name = Path.GetFileNameWithoutExtension(filename);
General.WriteLogLine("Loading plugin '" + name + "' from '" + Path.GetFileName(filename) + "'..."); General.WriteLogLine("Loading plugin '" + name + "' from '" + shortfilename + "'...");
try try
{ {
@ -77,7 +78,7 @@ namespace CodeImp.DoomBuilder.Plugins
} }
catch(Exception) catch(Exception)
{ {
General.ErrorLogger.Add(ErrorType.Error, "Could not load plugin '" + name + "', the DLL file could not be read."); General.ErrorLogger.Add(ErrorType.Error, "Could not load plugin \"" + shortfilename + "\", the DLL file could not be read. This file is not supposed to be in the Plugins subdirectory.");
throw new InvalidProgramException(); throw new InvalidProgramException();
} }
@ -89,7 +90,7 @@ namespace CodeImp.DoomBuilder.Plugins
if(FindClasses(typeof(Plug)).Length > 1) if(FindClasses(typeof(Plug)).Length > 1)
{ {
// Show a warning // Show a warning
General.ErrorLogger.Add(ErrorType.Warning, "Plugin '" + name + "' has more than one plug."); General.ErrorLogger.Add(ErrorType.Warning, "Plugin \"" + shortfilename + "\" has more than one plug.");
} }
// Make plug instance // Make plug instance
@ -99,7 +100,7 @@ namespace CodeImp.DoomBuilder.Plugins
else else
{ {
// How can we plug something in without a plug? // How can we plug something in without a plug?
General.ErrorLogger.Add(ErrorType.Error, "Could not load plugin '" + name + "', plugin is missing the plug."); General.ErrorLogger.Add(ErrorType.Error, "Could not load plugin \"" + shortfilename + "\", plugin is missing the plug. This file is not supposed to be in the Plugins subdirectory.");
throw new InvalidProgramException(); throw new InvalidProgramException();
} }

View file

@ -109,14 +109,12 @@ namespace CodeImp.DoomBuilder.Plugins
foreach(string fn in filenames) foreach(string fn in filenames)
{ {
// Load plugin from this file // Load plugin from this file
General.MainWindow.DisplayStatus(StatusType.Busy, "Loading plugin '" + Path.GetFileName(fn) + "'...");
try try
{ {
p = new Plugin(fn); p = new Plugin(fn);
} }
catch(InvalidProgramException) catch(InvalidProgramException)
{ {
General.ErrorLogger.Add(ErrorType.Warning, "Plugin file '" + Path.GetFileName(fn) + "' was not loaded.");
p = null; p = null;
} }