From f388a4725477b2e3238ccf19ea18dd05a98cdca0 Mon Sep 17 00:00:00 2001 From: MW Date: Fri, 31 Aug 2007 12:19:36 +0000 Subject: Added a Debug method to the Console/log class that has the Conditional attribute (set to "DEBUG"), so we can use that for writing extra debug info to the console. [for anyone who doesn't know about the Conditional attribute, it is a attribute that can be set on a method, and then any call to that method will on be compiled if the terms of that condition are met, ie is this case only if "DEBUG" is true. So its a cleaner implementation of the #if #endif directives]. A few other minor changes. --- OpenSim/Framework/Console/LogBase.cs | 15 ++++++++++ OpenSim/Grid/GridServer/GridManager.cs | 4 +-- OpenSim/Region/Environment/ModuleLoader.cs | 24 +++++++++++++-- OpenSim/Region/Environment/Modules/ChatModule.cs | 1 + .../Region/Environment/Modules/FriendsModule.cs | 27 ++++++++++++++++- OpenSim/Region/Environment/Modules/GroupsModule.cs | 35 ++++++++++++++++++++++ .../Environment/Modules/InstantMessageModule.cs | 27 ++++++++++++++++- .../Region/Environment/Modules/InventoryModule.cs | 27 ++++++++++++++++- OpenSim/Region/Environment/Scenes/Scene.cs | 2 +- 9 files changed, 153 insertions(+), 9 deletions(-) create mode 100644 OpenSim/Region/Environment/Modules/GroupsModule.cs diff --git a/OpenSim/Framework/Console/LogBase.cs b/OpenSim/Framework/Console/LogBase.cs index 5f16303..119c2cd 100644 --- a/OpenSim/Framework/Console/LogBase.cs +++ b/OpenSim/Framework/Console/LogBase.cs @@ -28,6 +28,7 @@ using System; using System.IO; using System.Net; +using System.Diagnostics; using System.Collections.Generic; namespace OpenSim.Framework.Console @@ -228,7 +229,21 @@ namespace OpenSim.Framework.Console WriteNewLine(ConsoleColor.Blue, format, args); return; } + + [Conditional("DEBUG")] + public void Debug(string format, params object[] args) + { + WriteNewLine(ConsoleColor.Gray, format, args); + return; + } + [Conditional("DEBUG")] + public void Debug(string sender, string format, params object[] args) + { + WritePrefixLine(DeriveColor(sender), sender); + WriteNewLine(ConsoleColor.Gray, format, args); + return; + } private void WriteNewLine(ConsoleColor color, string format, params object[] args) { diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index d38f5d4..885cd02 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs @@ -278,9 +278,9 @@ namespace OpenSim.Grid.GridServer TheSim.regionLocZ = 0; TheSim.regionMapTextureID = new LLUUID((string)requestData["map-image-id"]); - TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); - System.Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + TheSim.serverURI); + TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; + System.Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + TheSim.serverURI); TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/"; diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs index dbe43d5..1787a57 100644 --- a/OpenSim/Region/Environment/ModuleLoader.cs +++ b/OpenSim/Region/Environment/ModuleLoader.cs @@ -23,7 +23,7 @@ namespace OpenSim.Region.Environment /// Really just a test method for loading a set of currently internal modules /// /// - public void LoadInternalModules(Scene scene) + public void CreateDefaultModules(Scene scene) { //Testing IRegionModule ideas XferModule xferManager = new XferModule(); @@ -40,12 +40,30 @@ namespace OpenSim.Region.Environment this.LoadModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); - // Post Initialise Modules + // Post Initialise Modules, which most likely shouldn't be here + // but should rather be in a separate method that is called after all modules are loaded/created/intialised xferManager.PostInitialise(); - // chatModule.PostInitialise(); //for now leave this disabled as it would start up a partially working irc bot + // chatModule.PostInitialise(); //for now leave this disabled as it would start up a partially working irc bot avatarProfiles.PostInitialise(); } + /// + /// Loads/initialises a Module instance that can be used by mutliple Regions + /// + /// + /// + /// + public void LoadSharedModule(string dllName, string moduleName, Scene scene) + { + + } + + /// + /// Loads a external Module (if not already loaded) and creates a new instance of it for the passed Scene. + /// + /// + /// + /// public void LoadModule(string dllName, string moduleName, Scene scene) { Assembly pluginAssembly = null; diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index c26a1a5..752cde4 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs @@ -10,6 +10,7 @@ using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Interfaces; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Utilities; +using OpenSim.Framework.Console; namespace OpenSim.Region.Environment.Modules { diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs index 960d68f..f952bb2 100644 --- a/OpenSim/Region/Environment/Modules/FriendsModule.cs +++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs @@ -1,10 +1,35 @@ using System; using System.Collections.Generic; using System.Text; +using libsecondlife; +using OpenSim.Framework.Interfaces; +using OpenSim.Region.Environment.Scenes; +using OpenSim.Region.Environment.Interfaces; + namespace OpenSim.Region.Environment.Modules { - public class FriendsModule + public class FriendsModule : IRegionModule { + private Scene m_scene; + + public void Initialise(Scene scene) + { + m_scene = scene; + } + + public void PostInitialise() + { + + } + + public void CloseDown() + { + } + + public string GetName() + { + return "FriendsModule"; + } } } diff --git a/OpenSim/Region/Environment/Modules/GroupsModule.cs b/OpenSim/Region/Environment/Modules/GroupsModule.cs new file mode 100644 index 0000000..607b395 --- /dev/null +++ b/OpenSim/Region/Environment/Modules/GroupsModule.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using OpenSim.Framework.Interfaces; +using OpenSim.Region.Environment.Scenes; +using OpenSim.Region.Environment.Interfaces; + +namespace OpenSim.Region.Environment.Modules +{ + public class GroupsModule : IRegionModule + { + private Scene m_scene; + + public void Initialise(Scene scene) + { + m_scene = scene; + } + + public void PostInitialise() + { + + } + + public void CloseDown() + { + } + + public string GetName() + { + return "GroupsModule"; + } + } +} + diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs index ef2f224..9c09c48 100644 --- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs +++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs @@ -1,10 +1,35 @@ using System; using System.Collections.Generic; using System.Text; +using libsecondlife; +using OpenSim.Framework.Interfaces; +using OpenSim.Region.Environment.Scenes; +using OpenSim.Region.Environment.Interfaces; + namespace OpenSim.Region.Environment.Modules { - public class InstantMessageModule + public class InstantMessageModule :IRegionModule { + private Scene m_scene; + + public void Initialise(Scene scene) + { + m_scene = scene; + } + + public void PostInitialise() + { + + } + + public void CloseDown() + { + } + + public string GetName() + { + return "InstantMessageModule"; + } } } diff --git a/OpenSim/Region/Environment/Modules/InventoryModule.cs b/OpenSim/Region/Environment/Modules/InventoryModule.cs index 3659292..94e7ba7 100644 --- a/OpenSim/Region/Environment/Modules/InventoryModule.cs +++ b/OpenSim/Region/Environment/Modules/InventoryModule.cs @@ -1,10 +1,35 @@ using System; using System.Collections.Generic; using System.Text; +using libsecondlife; +using OpenSim.Framework.Interfaces; +using OpenSim.Region.Environment.Scenes; +using OpenSim.Region.Environment.Interfaces; + namespace OpenSim.Region.Environment.Modules { - public class InventoryModule + public class InventoryModule :IRegionModule { + private Scene m_scene; + + public void Initialise(Scene scene) + { + m_scene = scene; + } + + public void PostInitialise() + { + + } + + public void CloseDown() + { + } + + public string GetName() + { + return "InventoryModule"; + } } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 92f26ef..46fc86b 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -170,7 +170,7 @@ namespace OpenSim.Region.Environment.Scenes m_permissionManager = new PermissionManager(this); MainLog.Instance.Verbose("Loading Region Modules"); - m_moduleLoader.LoadInternalModules(this); + m_moduleLoader.CreateDefaultModules(this); m_eventManager.OnParcelPrimCountAdd += m_LandManager.addPrimToLandPrimCounts; -- cgit v1.1