aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/ModuleLoader.cs
diff options
context:
space:
mode:
authorlbsa712007-09-19 00:30:55 +0000
committerlbsa712007-09-19 00:30:55 +0000
commit8f0b03597b0bc8ea6873af9a55495407fae1ec56 (patch)
treef9f4de38379aebf2223ad4cb10a3d9ebcfa52a4f /OpenSim/Region/Environment/ModuleLoader.cs
parent* Moved SendLogoutPacket back to IClientAPI. (diff)
downloadopensim-SC_OLD-8f0b03597b0bc8ea6873af9a55495407fae1ec56.zip
opensim-SC_OLD-8f0b03597b0bc8ea6873af9a55495407fae1ec56.tar.gz
opensim-SC_OLD-8f0b03597b0bc8ea6873af9a55495407fae1ec56.tar.bz2
opensim-SC_OLD-8f0b03597b0bc8ea6873af9a55495407fae1ec56.tar.xz
* Modernized ScriptManager to new interface-based module calls.
* 'remove redundant this qualifier' ftw
Diffstat (limited to 'OpenSim/Region/Environment/ModuleLoader.cs')
-rw-r--r--OpenSim/Region/Environment/ModuleLoader.cs66
1 files changed, 31 insertions, 35 deletions
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs
index 5e27f50..34cc383 100644
--- a/OpenSim/Region/Environment/ModuleLoader.cs
+++ b/OpenSim/Region/Environment/ModuleLoader.cs
@@ -1,25 +1,22 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Reflection; 3using System.IO;
4using System.Text; 4using System.Reflection;
5using OpenSim.Framework.Console; 5using OpenSim.Region.Environment.Interfaces;
6using OpenSim.Region.Environment.Scenes; 6using OpenSim.Region.Environment.Modules;
7using OpenSim.Region.Environment.Interfaces; 7using OpenSim.Region.Environment.Scenes;
8using OpenSim.Region.Environment.Modules; 8
9
10namespace OpenSim.Region.Environment 9namespace OpenSim.Region.Environment
11{ 10{
12 public class ModuleLoader 11 public class ModuleLoader
13 { 12 {
14
15 public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>(); 13 public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>();
16 14
17 public List<IRegionModule> LoadedModules = new List<IRegionModule>(); 15 public List<IRegionModule> LoadedModules = new List<IRegionModule>();
18 public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>(); 16 public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>();
19
20 public ModuleLoader()
21 {
22 17
18 public ModuleLoader()
19 {
23 } 20 }
24 21
25 /// <summary> 22 /// <summary>
@@ -28,32 +25,31 @@ namespace OpenSim.Region.Environment
28 /// <param name="scene"></param> 25 /// <param name="scene"></param>
29 public void CreateDefaultModules(Scene scene, string exceptModules) 26 public void CreateDefaultModules(Scene scene, string exceptModules)
30 { 27 {
31 IRegionModule module = new XferModule(); 28 IRegionModule module = new XferModule();
32 InitialiseModule(module, scene); 29 InitialiseModule(module, scene);
33 30
34 module = new ChatModule(); 31 module = new ChatModule();
35 InitialiseModule(module, scene); 32 InitialiseModule(module, scene);
36 33
37 module = new AvatarProfilesModule(); 34 module = new AvatarProfilesModule();
38 InitialiseModule(module, scene); 35 InitialiseModule(module, scene);
39 36
40 this.LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); 37 LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene);
41
42 string lslPath = System.IO.Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll");
43 this.LoadRegionModule(lslPath, "LSLScriptingModule", scene);
44 38
39 string lslPath = Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll");
40 LoadRegionModule(lslPath, "LSLScriptingModule", scene);
45 } 41 }
46 42
47 43
48 public void LoadDefaultSharedModules(string exceptModules) 44 public void LoadDefaultSharedModules(string exceptModules)
49 { 45 {
50 DynamicTextureModule dynamicModule = new DynamicTextureModule(); 46 DynamicTextureModule dynamicModule = new DynamicTextureModule();
51 this.LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule); 47 LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule);
52 } 48 }
53 49
54 public void InitialiseSharedModules(Scene scene) 50 public void InitialiseSharedModules(Scene scene)
55 { 51 {
56 foreach (IRegionModule module in this.LoadedSharedModules.Values) 52 foreach (IRegionModule module in LoadedSharedModules.Values)
57 { 53 {
58 module.Initialise(scene); 54 module.Initialise(scene);
59 scene.AddModule(module.GetName(), module); //should be doing this? 55 scene.AddModule(module.GetName(), module); //should be doing this?
@@ -75,19 +71,19 @@ namespace OpenSim.Region.Environment
75 /// <param name="scene"></param> 71 /// <param name="scene"></param>
76 public void LoadSharedModule(string dllName, string moduleName) 72 public void LoadSharedModule(string dllName, string moduleName)
77 { 73 {
78 IRegionModule module = this.LoadModule(dllName, moduleName); 74 IRegionModule module = LoadModule(dllName, moduleName);
79 if (module != null) 75 if (module != null)
80 { 76 {
81 this.LoadedSharedModules.Add(module.GetName(), module); 77 LoadedSharedModules.Add(module.GetName(), module);
82 } 78 }
83 } 79 }
84 80
85 public void LoadRegionModule(string dllName, string moduleName, Scene scene) 81 public void LoadRegionModule(string dllName, string moduleName, Scene scene)
86 { 82 {
87 IRegionModule module = this.LoadModule(dllName, moduleName); 83 IRegionModule module = LoadModule(dllName, moduleName);
88 if (module != null) 84 if (module != null)
89 { 85 {
90 this.InitialiseModule(module, scene); 86 InitialiseModule(module, scene);
91 } 87 }
92 } 88 }
93 89
@@ -107,7 +103,7 @@ namespace OpenSim.Region.Environment
107 else 103 else
108 { 104 {
109 pluginAssembly = Assembly.LoadFrom(dllName); 105 pluginAssembly = Assembly.LoadFrom(dllName);
110 this.LoadedAssemblys.Add(dllName, pluginAssembly); 106 LoadedAssemblys.Add(dllName, pluginAssembly);
111 } 107 }
112 108
113 IRegionModule module = null; 109 IRegionModule module = null;
@@ -121,7 +117,8 @@ namespace OpenSim.Region.Environment
121 117
122 if (typeInterface != null) 118 if (typeInterface != null)
123 { 119 {
124 module = (IRegionModule)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 120 module =
121 (IRegionModule) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
125 break; 122 break;
126 } 123 }
127 typeInterface = null; 124 typeInterface = null;
@@ -130,23 +127,22 @@ namespace OpenSim.Region.Environment
130 } 127 }
131 pluginAssembly = null; 128 pluginAssembly = null;
132 129
133 if ((module != null ) || (module.GetName() == moduleName)) 130 if ((module != null) || (module.GetName() == moduleName))
134 { 131 {
135 return module; 132 return module;
136 } 133 }
137 134
138 return null; 135 return null;
139
140 } 136 }
141 137
142 public void PostInitialise() 138 public void PostInitialise()
143 { 139 {
144 foreach (IRegionModule module in this.LoadedSharedModules.Values) 140 foreach (IRegionModule module in LoadedSharedModules.Values)
145 { 141 {
146 module.PostInitialise(); 142 module.PostInitialise();
147 } 143 }
148 144
149 foreach (IRegionModule module in this.LoadedModules) 145 foreach (IRegionModule module in LoadedModules)
150 { 146 {
151 module.PostInitialise(); 147 module.PostInitialise();
152 } 148 }
@@ -154,7 +150,7 @@ namespace OpenSim.Region.Environment
154 150
155 public void ClearCache() 151 public void ClearCache()
156 { 152 {
157 this.LoadedAssemblys.Clear(); 153 LoadedAssemblys.Clear();
158 } 154 }
159 } 155 }
160} 156} \ No newline at end of file