// Add each global command to the list in this method // Non-global commands will be handled slightly differently when they are // implemented. private string InitCommands() { string errors = ""; string errorstrings = ""; Object[] Objects = new Object[Lib.MaxGameCommands]; Command[] Commands = new Command[Lib.MaxGameCommands]; Lib.PrintLine("Loading commands..."); //Load Commands from existing DLLs //DirectoryInfo toplevel=Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory); //DirectoryInfo toplevel = new DirectoryInfo(Lib.PathtoRoot); ArrayList files = Lib.GetFilesRecursive(Lib.PathtoRoot, "*commands.dll"); if (files.Count > 0) { foreach (string file in files) { Lib.LoadPlugin(file); } } // Load commands from source files that are not yet compiled files = Lib.GetFilesRecursive(Lib.PathtoRootScriptsandPlugins, "*.tmc.cs"); if (files.Count > 0) { try { Objects = Lib.Compiler.GetObjectsFromFiles(Lib.ConvertToStringArray(files), out errors); errorstrings += errors; } catch { return(errorstrings); //throw new Exception(ex.Message + ex.StackTrace); } if (Objects != null) { // If this comes back equal to it's init length, then nothing was entered into the array if (Objects.Length != Lib.MaxGameActions) { foreach (Object Command in Objects) { Lib.AddCommand((TigerMUD.Command)Command); } } } } return(errorstrings); }