diff options
Diffstat (limited to 'OpenSim/Region/Environment/ModuleLoader.cs')
-rw-r--r-- | OpenSim/Region/Environment/ModuleLoader.cs | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs index 442ee77..c0dd52a 100644 --- a/OpenSim/Region/Environment/ModuleLoader.cs +++ b/OpenSim/Region/Environment/ModuleLoader.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections; | ||
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using System.IO; | 32 | using System.IO; |
32 | using System.Reflection; | 33 | using System.Reflection; |
@@ -42,10 +43,10 @@ namespace OpenSim.Region.Environment | |||
42 | { | 43 | { |
43 | public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>(); | 44 | public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>(); |
44 | 45 | ||
45 | public List<IRegionModule> LoadedModules = new List<IRegionModule>(); | 46 | private readonly List<IRegionModule> m_loadedModules = new List<IRegionModule>(); |
46 | public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>(); | 47 | private Dictionary<string, IRegionModule> m_loadedSharedModules = new Dictionary<string, IRegionModule>(); |
47 | private readonly LogBase m_log; | 48 | private readonly LogBase m_log; |
48 | private IConfigSource m_config; | 49 | private readonly IConfigSource m_config; |
49 | 50 | ||
50 | public ModuleLoader(LogBase log, IConfigSource config) | 51 | public ModuleLoader(LogBase log, IConfigSource config) |
51 | { | 52 | { |
@@ -53,6 +54,16 @@ namespace OpenSim.Region.Environment | |||
53 | m_config = config; | 54 | m_config = config; |
54 | } | 55 | } |
55 | 56 | ||
57 | public IRegionModule[] GetLoadedSharedModules | ||
58 | { | ||
59 | get | ||
60 | { | ||
61 | IRegionModule[] regionModules = new IRegionModule[ m_loadedSharedModules.Count ]; | ||
62 | m_loadedSharedModules.Values.CopyTo( regionModules, 0 ); | ||
63 | return regionModules; | ||
64 | } | ||
65 | } | ||
66 | |||
56 | public void PickupModules(Scene scene, string moduleDir) | 67 | public void PickupModules(Scene scene, string moduleDir) |
57 | { | 68 | { |
58 | DirectoryInfo dir = new DirectoryInfo(moduleDir); | 69 | DirectoryInfo dir = new DirectoryInfo(moduleDir); |
@@ -66,19 +77,19 @@ namespace OpenSim.Region.Environment | |||
66 | public void LoadDefaultSharedModules() | 77 | public void LoadDefaultSharedModules() |
67 | { | 78 | { |
68 | DynamicTextureModule dynamicModule = new DynamicTextureModule(); | 79 | DynamicTextureModule dynamicModule = new DynamicTextureModule(); |
69 | LoadedSharedModules.Add(dynamicModule.Name, dynamicModule); | 80 | m_loadedSharedModules.Add(dynamicModule.Name, dynamicModule); |
70 | 81 | ||
71 | ChatModule chat = new ChatModule(); | 82 | ChatModule chat = new ChatModule(); |
72 | LoadedSharedModules.Add(chat.Name, chat); | 83 | m_loadedSharedModules.Add(chat.Name, chat); |
73 | 84 | ||
74 | InstantMessageModule imMod = new InstantMessageModule(); | 85 | InstantMessageModule imMod = new InstantMessageModule(); |
75 | LoadedSharedModules.Add(imMod.Name, imMod); | 86 | m_loadedSharedModules.Add(imMod.Name, imMod); |
76 | 87 | ||
77 | LoadImageURLModule loadMod = new LoadImageURLModule(); | 88 | LoadImageURLModule loadMod = new LoadImageURLModule(); |
78 | LoadedSharedModules.Add(loadMod.Name, loadMod); | 89 | m_loadedSharedModules.Add(loadMod.Name, loadMod); |
79 | 90 | ||
80 | AvatarFactoryModule avatarFactory = new AvatarFactoryModule(); | 91 | AvatarFactoryModule avatarFactory = new AvatarFactoryModule(); |
81 | LoadedSharedModules.Add(avatarFactory.Name, avatarFactory); | 92 | m_loadedSharedModules.Add(avatarFactory.Name, avatarFactory); |
82 | 93 | ||
83 | //TextureDownloadModule textureModule = new TextureDownloadModule(); | 94 | //TextureDownloadModule textureModule = new TextureDownloadModule(); |
84 | //LoadedSharedModules.Add(textureModule.Name, textureModule); | 95 | //LoadedSharedModules.Add(textureModule.Name, textureModule); |
@@ -86,7 +97,7 @@ namespace OpenSim.Region.Environment | |||
86 | 97 | ||
87 | public void InitialiseSharedModules(Scene scene) | 98 | public void InitialiseSharedModules(Scene scene) |
88 | { | 99 | { |
89 | foreach (IRegionModule module in LoadedSharedModules.Values) | 100 | foreach (IRegionModule module in m_loadedSharedModules.Values) |
90 | { | 101 | { |
91 | module.Initialise(scene, m_config); | 102 | module.Initialise(scene, m_config); |
92 | scene.AddModule(module.Name, module); //should be doing this? | 103 | scene.AddModule(module.Name, module); //should be doing this? |
@@ -97,7 +108,7 @@ namespace OpenSim.Region.Environment | |||
97 | { | 108 | { |
98 | module.Initialise(scene, m_config); | 109 | module.Initialise(scene, m_config); |
99 | scene.AddModule(module.Name, module); | 110 | scene.AddModule(module.Name, module); |
100 | LoadedModules.Add(module); | 111 | m_loadedModules.Add(module); |
101 | } | 112 | } |
102 | 113 | ||
103 | /// <summary> | 114 | /// <summary> |
@@ -111,7 +122,7 @@ namespace OpenSim.Region.Environment | |||
111 | IRegionModule module = LoadModule(dllName, moduleName); | 122 | IRegionModule module = LoadModule(dllName, moduleName); |
112 | if (module != null) | 123 | if (module != null) |
113 | { | 124 | { |
114 | LoadedSharedModules.Add(module.Name, module); | 125 | m_loadedSharedModules.Add(module.Name, module); |
115 | } | 126 | } |
116 | } | 127 | } |
117 | 128 | ||
@@ -204,12 +215,12 @@ namespace OpenSim.Region.Environment | |||
204 | 215 | ||
205 | public void PostInitialise() | 216 | public void PostInitialise() |
206 | { | 217 | { |
207 | foreach (IRegionModule module in LoadedSharedModules.Values) | 218 | foreach (IRegionModule module in m_loadedSharedModules.Values) |
208 | { | 219 | { |
209 | module.PostInitialise(); | 220 | module.PostInitialise(); |
210 | } | 221 | } |
211 | 222 | ||
212 | foreach (IRegionModule module in LoadedModules) | 223 | foreach (IRegionModule module in m_loadedModules) |
213 | { | 224 | { |
214 | module.PostInitialise(); | 225 | module.PostInitialise(); |
215 | } | 226 | } |