aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/ModuleLoader.cs
diff options
context:
space:
mode:
authorSean Dague2007-10-05 15:45:45 +0000
committerSean Dague2007-10-05 15:45:45 +0000
commitc3d8f1f4253f72484100394940e62f2912cbc4ff (patch)
tree8a9f237ed3c1140b4059ec121e0d4ede82eae416 /OpenSim/Region/Environment/ModuleLoader.cs
parent* So, ok, maybe renaming serialized fields on a friday wasn't the smartest of... (diff)
downloadopensim-SC_OLD-c3d8f1f4253f72484100394940e62f2912cbc4ff.zip
opensim-SC_OLD-c3d8f1f4253f72484100394940e62f2912cbc4ff.tar.gz
opensim-SC_OLD-c3d8f1f4253f72484100394940e62f2912cbc4ff.tar.bz2
opensim-SC_OLD-c3d8f1f4253f72484100394940e62f2912cbc4ff.tar.xz
getting all our line endings consistant again
Diffstat (limited to 'OpenSim/Region/Environment/ModuleLoader.cs')
-rw-r--r--OpenSim/Region/Environment/ModuleLoader.cs310
1 files changed, 155 insertions, 155 deletions
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs
index 2b18949..ce2a843 100644
--- a/OpenSim/Region/Environment/ModuleLoader.cs
+++ b/OpenSim/Region/Environment/ModuleLoader.cs
@@ -1,156 +1,156 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.IO; 3using System.IO;
4using System.Reflection; 4using System.Reflection;
5using OpenSim.Region.Environment.Interfaces; 5using OpenSim.Region.Environment.Interfaces;
6using OpenSim.Region.Environment.Modules; 6using OpenSim.Region.Environment.Modules;
7using OpenSim.Region.Environment.Scenes; 7using OpenSim.Region.Environment.Scenes;
8 8
9namespace OpenSim.Region.Environment 9namespace OpenSim.Region.Environment
10{ 10{
11 public class ModuleLoader 11 public class ModuleLoader
12 { 12 {
13 public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>(); 13 public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>();
14 14
15 public List<IRegionModule> LoadedModules = new List<IRegionModule>(); 15 public List<IRegionModule> LoadedModules = new List<IRegionModule>();
16 public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>(); 16 public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>();
17 17
18 public ModuleLoader() 18 public ModuleLoader()
19 { 19 {
20 } 20 }
21 21
22 /// <summary> 22 /// <summary>
23 /// Should have a module factory? 23 /// Should have a module factory?
24 /// </summary> 24 /// </summary>
25 /// <param name="scene"></param> 25 /// <param name="scene"></param>
26 public void CreateDefaultModules(Scene scene, string exceptModules) 26 public void CreateDefaultModules(Scene scene, string exceptModules)
27 { 27 {
28 IRegionModule module = new XferModule(); 28 IRegionModule module = new XferModule();
29 InitialiseModule(module, scene); 29 InitialiseModule(module, scene);
30 30
31 module = new ChatModule(); 31 module = new ChatModule();
32 InitialiseModule(module, scene); 32 InitialiseModule(module, scene);
33 33
34 module = new AvatarProfilesModule(); 34 module = new AvatarProfilesModule();
35 InitialiseModule(module, scene); 35 InitialiseModule(module, scene);
36 36
37 LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); 37 LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene);
38 38
39 string lslPath = Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); 39 string lslPath = Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll");
40 LoadRegionModule(lslPath, "LSLScriptingModule", scene); 40 LoadRegionModule(lslPath, "LSLScriptingModule", scene);
41 } 41 }
42 42
43 43
44 public void LoadDefaultSharedModules(string exceptModules) 44 public void LoadDefaultSharedModules(string exceptModules)
45 { 45 {
46 DynamicTextureModule dynamicModule = new DynamicTextureModule(); 46 DynamicTextureModule dynamicModule = new DynamicTextureModule();
47 LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule); 47 LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule);
48 } 48 }
49 49
50 public void InitialiseSharedModules(Scene scene) 50 public void InitialiseSharedModules(Scene scene)
51 { 51 {
52 foreach (IRegionModule module in LoadedSharedModules.Values) 52 foreach (IRegionModule module in LoadedSharedModules.Values)
53 { 53 {
54 module.Initialise(scene); 54 module.Initialise(scene);
55 scene.AddModule(module.GetName(), module); //should be doing this? 55 scene.AddModule(module.GetName(), module); //should be doing this?
56 } 56 }
57 } 57 }
58 58
59 private void InitialiseModule(IRegionModule module, Scene scene) 59 private void InitialiseModule(IRegionModule module, Scene scene)
60 { 60 {
61 module.Initialise(scene); 61 module.Initialise(scene);
62 scene.AddModule(module.GetName(), module); 62 scene.AddModule(module.GetName(), module);
63 LoadedModules.Add(module); 63 LoadedModules.Add(module);
64 } 64 }
65 65
66 /// <summary> 66 /// <summary>
67 /// Loads/initialises a Module instance that can be used by mutliple Regions 67 /// Loads/initialises a Module instance that can be used by mutliple Regions
68 /// </summary> 68 /// </summary>
69 /// <param name="dllName"></param> 69 /// <param name="dllName"></param>
70 /// <param name="moduleName"></param> 70 /// <param name="moduleName"></param>
71 /// <param name="scene"></param> 71 /// <param name="scene"></param>
72 public void LoadSharedModule(string dllName, string moduleName) 72 public void LoadSharedModule(string dllName, string moduleName)
73 { 73 {
74 IRegionModule module = LoadModule(dllName, moduleName); 74 IRegionModule module = LoadModule(dllName, moduleName);
75 if (module != null) 75 if (module != null)
76 { 76 {
77 LoadedSharedModules.Add(module.GetName(), module); 77 LoadedSharedModules.Add(module.GetName(), module);
78 } 78 }
79 } 79 }
80 80
81 public void LoadRegionModule(string dllName, string moduleName, Scene scene) 81 public void LoadRegionModule(string dllName, string moduleName, Scene scene)
82 { 82 {
83 IRegionModule module = LoadModule(dllName, moduleName); 83 IRegionModule module = LoadModule(dllName, moduleName);
84 if (module != null) 84 if (module != null)
85 { 85 {
86 InitialiseModule(module, scene); 86 InitialiseModule(module, scene);
87 } 87 }
88 } 88 }
89 89
90 /// <summary> 90 /// <summary>
91 /// Loads a external Module (if not already loaded) and creates a new instance of it. 91 /// Loads a external Module (if not already loaded) and creates a new instance of it.
92 /// </summary> 92 /// </summary>
93 /// <param name="dllName"></param> 93 /// <param name="dllName"></param>
94 /// <param name="moduleName"></param> 94 /// <param name="moduleName"></param>
95 /// <param name="scene"></param> 95 /// <param name="scene"></param>
96 public IRegionModule LoadModule(string dllName, string moduleName) 96 public IRegionModule LoadModule(string dllName, string moduleName)
97 { 97 {
98 Assembly pluginAssembly = null; 98 Assembly pluginAssembly = null;
99 if (LoadedAssemblys.ContainsKey(dllName)) 99 if (LoadedAssemblys.ContainsKey(dllName))
100 { 100 {
101 pluginAssembly = LoadedAssemblys[dllName]; 101 pluginAssembly = LoadedAssemblys[dllName];
102 } 102 }
103 else 103 else
104 { 104 {
105 pluginAssembly = Assembly.LoadFrom(dllName); 105 pluginAssembly = Assembly.LoadFrom(dllName);
106 LoadedAssemblys.Add(dllName, pluginAssembly); 106 LoadedAssemblys.Add(dllName, pluginAssembly);
107 } 107 }
108 108
109 IRegionModule module = null; 109 IRegionModule module = null;
110 foreach (Type pluginType in pluginAssembly.GetTypes()) 110 foreach (Type pluginType in pluginAssembly.GetTypes())
111 { 111 {
112 if (pluginType.IsPublic) 112 if (pluginType.IsPublic)
113 { 113 {
114 if (!pluginType.IsAbstract) 114 if (!pluginType.IsAbstract)
115 { 115 {
116 Type typeInterface = pluginType.GetInterface("IRegionModule", true); 116 Type typeInterface = pluginType.GetInterface("IRegionModule", true);
117 117
118 if (typeInterface != null) 118 if (typeInterface != null)
119 { 119 {
120 module = 120 module =
121 (IRegionModule) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 121 (IRegionModule) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
122 break; 122 break;
123 } 123 }
124 typeInterface = null; 124 typeInterface = null;
125 } 125 }
126 } 126 }
127 } 127 }
128 pluginAssembly = null; 128 pluginAssembly = null;
129 129
130 if ((module != null) || (module.GetName() == moduleName)) 130 if ((module != null) || (module.GetName() == moduleName))
131 { 131 {
132 return module; 132 return module;
133 } 133 }
134 134
135 return null; 135 return null;
136 } 136 }
137 137
138 public void PostInitialise() 138 public void PostInitialise()
139 { 139 {
140 foreach (IRegionModule module in LoadedSharedModules.Values) 140 foreach (IRegionModule module in LoadedSharedModules.Values)
141 { 141 {
142 module.PostInitialise(); 142 module.PostInitialise();
143 } 143 }
144 144
145 foreach (IRegionModule module in LoadedModules) 145 foreach (IRegionModule module in LoadedModules)
146 { 146 {
147 module.PostInitialise(); 147 module.PostInitialise();
148 } 148 }
149 } 149 }
150 150
151 public void ClearCache() 151 public void ClearCache()
152 { 152 {
153 LoadedAssemblys.Clear(); 153 LoadedAssemblys.Clear();
154 } 154 }
155 } 155 }
156} \ No newline at end of file 156} \ No newline at end of file