Added improved logging through the engine for the server console.

This commit is contained in:
Scionwest_cp 2012-03-08 19:44:18 -08:00
parent 43e93706ab
commit bcd9f46b0a
10 changed files with 115 additions and 27 deletions

View file

@ -143,9 +143,9 @@ namespace MudEngine.Core
/// Loads all of the commands found within the assembly specified.
/// </summary>
/// <param name="commandLibrary"></param>
public static void LoadCommandLibrary(Assembly commandLibrary)
public static ICommand[] LoadCommandLibrary(Assembly commandLibrary)
{
LoadCommandLibrary(commandLibrary, true);
return LoadCommandLibrary(commandLibrary, true);
}
/// <summary>
@ -155,14 +155,20 @@ namespace MudEngine.Core
/// </summary>
/// <param name="commandLibrary"></param>
/// <param name="purgeLoadedCommands"></param>
public static void LoadCommandLibrary(Assembly commandLibrary, bool purgeLoadedCommands)
public static ICommand[] LoadCommandLibrary(Assembly commandLibrary, bool purgeLoadedCommands)
{
//Check if we need to purge all of the commands.
if (purgeLoadedCommands)
PurgeCommands();
if (commandLibrary == null)
return;
return null;
//Custom commands are temporarily stored here.
//Since Commands are stored in the general Command collection
//that can contain internal commands as well, we want to
//return only what we just loaded.
List<ICommand> commandsFound = new List<ICommand>();
//Loop through each Type in the assembly provided.
foreach (Type type in commandLibrary.GetTypes())
@ -192,8 +198,14 @@ namespace MudEngine.Core
//Everything checks out ok. Add the command to our collection.
Commands.Add(cmd.Name, cmd);
commandsFound.Add(cmd);
}
}
if (commandsFound.Count > 0)
return commandsFound.ToArray();
else
return null;
}
/// <summary>

View file

@ -49,7 +49,8 @@ namespace MudEngine.Core
System.IO.File.Delete(LogFilename);
//Clear the cache.
_Messages.Clear();
if (_Messages != null)
_Messages.Clear();
}
public static void WriteLine(String message, Importance importance)