From 39726f0fdac3316998131e723ae0070743f97786 Mon Sep 17 00:00:00 2001 From: dr scofield (aka dirk husemann) Date: Tue, 1 Sep 2009 10:25:10 +0200 Subject: switching SerialiserModule to "new" region module scheme --- .../Resources/CoreModulePlugin.addin.xml | 1 + .../World/Serialiser/SerialiserModule.cs | 60 +++++++++++++++++----- 2 files changed, 47 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index 383063d..c882146 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml @@ -8,6 +8,7 @@ + diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs index b6d28ab..e0331d3 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs @@ -28,7 +28,11 @@ using System; using System.Collections.Generic; using System.IO; +using System.Reflection; + +using log4net; using Nini.Config; + using OpenMetaverse; using OpenSim.Region.CoreModules.Framework.InterfaceCommander; using OpenSim.Region.Framework.Interfaces; @@ -37,25 +41,32 @@ using OpenSim.Region.Framework.Scenes.Serialization; namespace OpenSim.Region.CoreModules.World.Serialiser { - public class SerialiserModule : IRegionModule, IRegionSerialiserModule + public class SerialiserModule : ISharedRegionModule, IRegionSerialiserModule { + private static readonly ILog m_log = + LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private Commander m_commander = new Commander("export"); private List m_regions = new List(); private string m_savedir = "exports" + "/"; private List m_serialisers = new List(); - #region IRegionModule Members + #region ISharedRegionModule Members - public void Initialise(Scene scene, IConfigSource source) - { - scene.RegisterModuleCommander(m_commander); - scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; - scene.RegisterModuleInterface(this); + public Type ReplaceableInterface + { + get { return null; } + } - lock (m_regions) + public void Initialise(IConfigSource source) + { + IConfig config = source.Configs["Serialiser"]; + if (config != null) { - m_regions.Add(scene); + m_savedir = config.GetString("save_dir", m_savedir); } + + m_log.InfoFormat("[Serialiser] Enabled, using save dir \"{0}\"", m_savedir); } public void PostInitialise() @@ -69,6 +80,31 @@ namespace OpenSim.Region.CoreModules.World.Serialiser LoadCommanderCommands(); } + + public void AddRegion(Scene scene) + { + scene.RegisterModuleCommander(m_commander); + scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; + scene.RegisterModuleInterface(this); + + lock (m_regions) + { + m_regions.Add(scene); + } + } + + public void RegionLoaded(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + lock (m_regions) + { + m_regions.Remove(scene); + } + } + public void Close() { m_regions.Clear(); @@ -79,13 +115,9 @@ namespace OpenSim.Region.CoreModules.World.Serialiser get { return "ExportSerialisationModule"; } } - public bool IsSharedModule - { - get { return true; } - } - #endregion + #region IRegionSerialiser Members public void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, Vector3 loadOffset) -- cgit v1.1