diff options
author | lbsa71 | 2007-10-10 18:24:13 +0000 |
---|---|---|
committer | lbsa71 | 2007-10-10 18:24:13 +0000 |
commit | a40e7100a232827cffb813bbbbe9374324ad3448 (patch) | |
tree | 7f16f392d653f155ca90d5477c842db9c881f3ed /OpenSim/Region | |
parent | Added unit tests, based on nunit for the IInventoryData (diff) | |
download | opensim-SC-a40e7100a232827cffb813bbbbe9374324ad3448.zip opensim-SC-a40e7100a232827cffb813bbbbe9374324ad3448.tar.gz opensim-SC-a40e7100a232827cffb813bbbbe9374324ad3448.tar.bz2 opensim-SC-a40e7100a232827cffb813bbbbe9374324ad3448.tar.xz |
* Gave ModuleLoader some good lovin'
* Introduced ModuleLoader.PickupModules that currently picks up IRegionModule:s from /bin
* Made LogBase thread-safe (or at least not thread-ignorant)
* Ignored some genned files
Diffstat (limited to 'OpenSim/Region')
19 files changed, 1336 insertions, 1285 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index eeb69c5..2fc2d0a 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -202,7 +202,7 @@ namespace OpenSim | |||
202 | configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); | 202 | configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); |
203 | } | 203 | } |
204 | 204 | ||
205 | m_moduleLoader = new ModuleLoader(); | 205 | m_moduleLoader = new ModuleLoader( m_log ); |
206 | MainLog.Instance.Verbose("Loading Shared Modules"); | 206 | MainLog.Instance.Verbose("Loading Shared Modules"); |
207 | m_moduleLoader.LoadDefaultSharedModules(m_exceptSharedModules); | 207 | m_moduleLoader.LoadDefaultSharedModules(m_exceptSharedModules); |
208 | 208 | ||
@@ -220,7 +220,9 @@ namespace OpenSim | |||
220 | 220 | ||
221 | m_moduleLoader.InitialiseSharedModules(scene); | 221 | m_moduleLoader.InitialiseSharedModules(scene); |
222 | MainLog.Instance.Verbose("Loading Region's Modules"); | 222 | MainLog.Instance.Verbose("Loading Region's Modules"); |
223 | m_moduleLoader.CreateDefaultModules(scene, m_exceptModules); | 223 | |
224 | //m_moduleLoader.CreateDefaultModules(scene, m_exceptModules); | ||
225 | m_moduleLoader.PickupModules( scene ); | ||
224 | scene.SetModuleInterfaces(); | 226 | scene.SetModuleInterfaces(); |
225 | 227 | ||
226 | // Check if we have a script engine to load | 228 | // Check if we have a script engine to load |
@@ -616,7 +618,7 @@ namespace OpenSim | |||
616 | m_log.Error("The currently loaded shared modules are:"); | 618 | m_log.Error("The currently loaded shared modules are:"); |
617 | foreach (OpenSim.Region.Environment.Interfaces.IRegionModule module in m_moduleLoader.LoadedSharedModules.Values) | 619 | foreach (OpenSim.Region.Environment.Interfaces.IRegionModule module in m_moduleLoader.LoadedSharedModules.Values) |
618 | { | 620 | { |
619 | m_log.Error("Shared Module: " + module.GetName()); | 621 | m_log.Error("Shared Module: " + module.Name); |
620 | } | 622 | } |
621 | break; | 623 | break; |
622 | } | 624 | } |
diff --git a/OpenSim/Region/Environment/Interfaces/IRegionModule.cs b/OpenSim/Region/Environment/Interfaces/IRegionModule.cs index 2c7c742..410d66d 100644 --- a/OpenSim/Region/Environment/Interfaces/IRegionModule.cs +++ b/OpenSim/Region/Environment/Interfaces/IRegionModule.cs | |||
@@ -6,8 +6,8 @@ namespace OpenSim.Region.Environment.Interfaces | |||
6 | { | 6 | { |
7 | void Initialise(Scene scene); | 7 | void Initialise(Scene scene); |
8 | void PostInitialise(); | 8 | void PostInitialise(); |
9 | void CloseDown(); | 9 | void Close(); |
10 | string GetName(); | 10 | string Name { get; } |
11 | bool IsSharedModule(); | 11 | bool IsSharedModule { get; } |
12 | } | 12 | } |
13 | } \ No newline at end of file | 13 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs index 43c1aae..b24b651 100644 --- a/OpenSim/Region/Environment/ModuleLoader.cs +++ b/OpenSim/Region/Environment/ModuleLoader.cs | |||
@@ -1,162 +1,209 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.IO; | 3 | using System.IO; |
4 | using System.Reflection; | 4 | using System.Reflection; |
5 | using OpenSim.Region.Environment.Interfaces; | 5 | using OpenSim.Framework.Console; |
6 | using OpenSim.Region.Environment.Modules; | 6 | using OpenSim.Region.Environment.Interfaces; |
7 | using OpenSim.Region.Environment.Scenes; | 7 | using OpenSim.Region.Environment.Modules; |
8 | 8 | using OpenSim.Region.Environment.Scenes; | |
9 | namespace OpenSim.Region.Environment | 9 | |
10 | { | 10 | namespace OpenSim.Region.Environment |
11 | public class ModuleLoader | 11 | { |
12 | { | 12 | public class ModuleLoader |
13 | public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>(); | 13 | { |
14 | 14 | public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>(); | |
15 | public List<IRegionModule> LoadedModules = new List<IRegionModule>(); | 15 | |
16 | public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>(); | 16 | public List<IRegionModule> LoadedModules = new List<IRegionModule>(); |
17 | 17 | public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>(); | |
18 | public ModuleLoader() | 18 | private readonly LogBase m_log; |
19 | { | 19 | |
20 | } | 20 | public ModuleLoader(LogBase log) |
21 | 21 | { | |
22 | /// <summary> | 22 | m_log = log; |
23 | /// Should have a module factory? | 23 | } |
24 | /// </summary> | 24 | |
25 | /// <param name="scene"></param> | 25 | /// <summary> |
26 | public void CreateDefaultModules(Scene scene, string exceptModules) | 26 | /// Should have a module factory? |
27 | { | 27 | /// </summary> |
28 | IRegionModule module = new XferModule(); | 28 | /// <param name="scene"></param> |
29 | InitialiseModule(module, scene); | 29 | //public void CreateDefaultModules(Scene scene, string exceptModules) |
30 | 30 | //{ | |
31 | module = new ChatModule(); | 31 | // IRegionModule module = new XferModule(); |
32 | InitialiseModule(module, scene); | 32 | // InitializeModule(module, scene); |
33 | 33 | ||
34 | module = new AvatarProfilesModule(); | 34 | // module = new ChatModule(); |
35 | InitialiseModule(module, scene); | 35 | // InitializeModule(module, scene); |
36 | 36 | ||
37 | module = new XMLRPCModule(); | 37 | // module = new AvatarProfilesModule(); |
38 | InitialiseModule(module, scene); | 38 | // InitializeModule(module, scene); |
39 | 39 | ||
40 | module = new WorldCommModule(); | 40 | // module = new XMLRPCModule(); |
41 | InitialiseModule(module, scene); | 41 | // InitializeModule(module, scene); |
42 | 42 | ||
43 | LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); | 43 | // module = new WorldCommModule(); |
44 | 44 | // InitializeModule(module, scene); | |
45 | string lslPath = Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); | 45 | |
46 | LoadRegionModule(lslPath, "LSLScriptingModule", scene); | 46 | // LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); |
47 | } | 47 | |
48 | 48 | // string lslPath = Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); | |
49 | 49 | // LoadRegionModule(lslPath, "LSLScriptingModule", scene); | |
50 | public void LoadDefaultSharedModules(string exceptModules) | 50 | //} |
51 | { | 51 | |
52 | DynamicTextureModule dynamicModule = new DynamicTextureModule(); | 52 | public void PickupModules(Scene scene) |
53 | LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule); | 53 | { |
54 | } | 54 | string moduleDir = "."; |
55 | 55 | ||
56 | public void InitialiseSharedModules(Scene scene) | 56 | DirectoryInfo dir = new DirectoryInfo(moduleDir); |
57 | { | 57 | |
58 | foreach (IRegionModule module in LoadedSharedModules.Values) | 58 | foreach (FileInfo fileInfo in dir.GetFiles("*.dll")) |
59 | { | 59 | { |
60 | module.Initialise(scene); | 60 | LoadRegionModules(fileInfo.FullName, scene); |
61 | scene.AddModule(module.GetName(), module); //should be doing this? | 61 | } |
62 | } | 62 | } |
63 | } | 63 | |
64 | 64 | public void LoadDefaultSharedModules(string exceptModules) | |
65 | private void InitialiseModule(IRegionModule module, Scene scene) | 65 | { |
66 | { | 66 | DynamicTextureModule dynamicModule = new DynamicTextureModule(); |
67 | module.Initialise(scene); | 67 | LoadedSharedModules.Add(dynamicModule.Name, dynamicModule); |
68 | scene.AddModule(module.GetName(), module); | 68 | } |
69 | LoadedModules.Add(module); | 69 | |
70 | } | 70 | public void InitialiseSharedModules(Scene scene) |
71 | 71 | { | |
72 | /// <summary> | 72 | foreach (IRegionModule module in LoadedSharedModules.Values) |
73 | /// Loads/initialises a Module instance that can be used by mutliple Regions | 73 | { |
74 | /// </summary> | 74 | module.Initialise(scene); |
75 | /// <param name="dllName"></param> | 75 | scene.AddModule(module.Name, module); //should be doing this? |
76 | /// <param name="moduleName"></param> | 76 | } |
77 | /// <param name="scene"></param> | 77 | } |
78 | public void LoadSharedModule(string dllName, string moduleName) | 78 | |
79 | { | 79 | private void InitializeModule(IRegionModule module, Scene scene) |
80 | IRegionModule module = LoadModule(dllName, moduleName); | 80 | { |
81 | if (module != null) | 81 | module.Initialise(scene); |
82 | { | 82 | scene.AddModule(module.Name, module); |
83 | LoadedSharedModules.Add(module.GetName(), module); | 83 | LoadedModules.Add(module); |
84 | } | 84 | } |
85 | } | 85 | |
86 | 86 | /// <summary> | |
87 | public void LoadRegionModule(string dllName, string moduleName, Scene scene) | 87 | /// Loads/initialises a Module instance that can be used by mutliple Regions |
88 | { | 88 | /// </summary> |
89 | IRegionModule module = LoadModule(dllName, moduleName); | 89 | /// <param name="dllName"></param> |
90 | if (module != null) | 90 | /// <param name="moduleName"></param> |
91 | { | 91 | /// <param name="scene"></param> |
92 | InitialiseModule(module, scene); | 92 | public void LoadSharedModule(string dllName, string moduleName) |
93 | } | 93 | { |
94 | } | 94 | IRegionModule module = LoadModule(dllName, moduleName); |
95 | 95 | if (module != null) | |
96 | /// <summary> | 96 | { |
97 | /// Loads a external Module (if not already loaded) and creates a new instance of it. | 97 | LoadedSharedModules.Add(module.Name, module); |
98 | /// </summary> | 98 | } |
99 | /// <param name="dllName"></param> | 99 | } |
100 | /// <param name="moduleName"></param> | 100 | |
101 | /// <param name="scene"></param> | 101 | public void LoadRegionModules(string dllName, Scene scene) |
102 | public IRegionModule LoadModule(string dllName, string moduleName) | 102 | { |
103 | { | 103 | IRegionModule[] modules = LoadModules(dllName); |
104 | Assembly pluginAssembly = null; | 104 | |
105 | if (LoadedAssemblys.ContainsKey(dllName)) | 105 | if (modules.Length > 0) |
106 | { | 106 | { |
107 | pluginAssembly = LoadedAssemblys[dllName]; | 107 | m_log.Verbose("MODULES", "Found Module Library [{0}]", dllName ); |
108 | } | 108 | foreach (IRegionModule module in modules) |
109 | else | 109 | { |
110 | { | 110 | m_log.Verbose("MODULES", " [{0}]: Initializing.", module.Name); |
111 | pluginAssembly = Assembly.LoadFrom(dllName); | 111 | InitializeModule(module, scene); |
112 | LoadedAssemblys.Add(dllName, pluginAssembly); | 112 | } |
113 | } | 113 | } |
114 | 114 | } | |
115 | IRegionModule module = null; | 115 | |
116 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 116 | public void LoadRegionModule(string dllName, string moduleName, Scene scene) |
117 | { | 117 | { |
118 | if (pluginType.IsPublic) | 118 | IRegionModule module = LoadModule(dllName, moduleName); |
119 | { | 119 | if (module != null) |
120 | if (!pluginType.IsAbstract) | 120 | { |
121 | { | 121 | InitializeModule(module, scene); |
122 | Type typeInterface = pluginType.GetInterface("IRegionModule", true); | 122 | } |
123 | 123 | } | |
124 | if (typeInterface != null) | 124 | |
125 | { | 125 | /// <summary> |
126 | module = | 126 | /// Loads a external Module (if not already loaded) and creates a new instance of it. |
127 | (IRegionModule) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 127 | /// </summary> |
128 | break; | 128 | /// <param name="dllName"></param> |
129 | } | 129 | /// <param name="moduleName"></param> |
130 | typeInterface = null; | 130 | /// <param name="scene"></param> |
131 | } | 131 | public IRegionModule LoadModule(string dllName, string moduleName) |
132 | } | 132 | { |
133 | } | 133 | IRegionModule[] modules = LoadModules(dllName); |
134 | pluginAssembly = null; | 134 | |
135 | 135 | foreach (IRegionModule module in modules) | |
136 | if ((module != null) || (module.GetName() == moduleName)) | 136 | { |
137 | { | 137 | if ((module != null) && (module.Name == moduleName)) |
138 | return module; | 138 | { |
139 | } | 139 | return module; |
140 | 140 | } | |
141 | return null; | 141 | } |
142 | } | 142 | |
143 | 143 | return null; | |
144 | public void PostInitialise() | 144 | } |
145 | { | 145 | |
146 | foreach (IRegionModule module in LoadedSharedModules.Values) | 146 | public IRegionModule[] LoadModules(string dllName) |
147 | { | 147 | { |
148 | module.PostInitialise(); | 148 | List<IRegionModule> modules = new List<IRegionModule>(); |
149 | } | 149 | |
150 | 150 | Assembly pluginAssembly; | |
151 | foreach (IRegionModule module in LoadedModules) | 151 | if (!LoadedAssemblys.TryGetValue(dllName, out pluginAssembly )) |
152 | { | 152 | { |
153 | module.PostInitialise(); | 153 | try |
154 | } | 154 | { |
155 | } | 155 | pluginAssembly = Assembly.LoadFrom(dllName); |
156 | 156 | LoadedAssemblys.Add(dllName, pluginAssembly); | |
157 | public void ClearCache() | 157 | } |
158 | { | 158 | catch( BadImageFormatException e ) |
159 | LoadedAssemblys.Clear(); | 159 | { |
160 | } | 160 | m_log.Error( "MODULES", "The file [{0}] is not a valid assembly.", e.FileName ); |
161 | } | 161 | } |
162 | } | 162 | } |
163 | |||
164 | |||
165 | if (pluginAssembly != null) | ||
166 | { | ||
167 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
168 | { | ||
169 | if (pluginType.IsPublic) | ||
170 | { | ||
171 | if (!pluginType.IsAbstract) | ||
172 | { | ||
173 | //if (dllName.Contains("OpenSim.Region.Environment")) | ||
174 | //{ | ||
175 | // int i = 1; | ||
176 | // i++; | ||
177 | //} | ||
178 | |||
179 | if( pluginType.GetInterface("IRegionModule") != null ) | ||
180 | { | ||
181 | modules.Add((IRegionModule) Activator.CreateInstance(pluginType)); | ||
182 | } | ||
183 | } | ||
184 | } | ||
185 | } | ||
186 | } | ||
187 | |||
188 | return modules.ToArray(); | ||
189 | } | ||
190 | |||
191 | public void PostInitialise() | ||
192 | { | ||
193 | foreach (IRegionModule module in LoadedSharedModules.Values) | ||
194 | { | ||
195 | module.PostInitialise(); | ||
196 | } | ||
197 | |||
198 | foreach (IRegionModule module in LoadedModules) | ||
199 | { | ||
200 | module.PostInitialise(); | ||
201 | } | ||
202 | } | ||
203 | |||
204 | public void ClearCache() | ||
205 | { | ||
206 | LoadedAssemblys.Clear(); | ||
207 | } | ||
208 | } | ||
209 | } | ||
diff --git a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs index 7d789f9..e4ae647 100644 --- a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs | |||
@@ -1,43 +1,43 @@ | |||
1 | using OpenSim.Framework.Interfaces; | 1 | using OpenSim.Framework.Interfaces; |
2 | using OpenSim.Region.Environment.Interfaces; | 2 | using OpenSim.Region.Environment.Interfaces; |
3 | using OpenSim.Region.Environment.Scenes; | 3 | using OpenSim.Region.Environment.Scenes; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment.Modules | 5 | namespace OpenSim.Region.Environment.Modules |
6 | { | 6 | { |
7 | public class AssetDownloadModule : IRegionModule | 7 | public class AssetDownloadModule : IRegionModule |
8 | { | 8 | { |
9 | private Scene m_scene; | 9 | private Scene m_scene; |
10 | 10 | ||
11 | public AssetDownloadModule() | 11 | public AssetDownloadModule() |
12 | { | 12 | { |
13 | } | 13 | } |
14 | 14 | ||
15 | public void Initialise(Scene scene) | 15 | public void Initialise(Scene scene) |
16 | { | 16 | { |
17 | m_scene = scene; | 17 | m_scene = scene; |
18 | m_scene.EventManager.OnNewClient += NewClient; | 18 | m_scene.EventManager.OnNewClient += NewClient; |
19 | } | 19 | } |
20 | 20 | ||
21 | public void PostInitialise() | 21 | public void PostInitialise() |
22 | { | 22 | { |
23 | } | 23 | } |
24 | 24 | ||
25 | public void CloseDown() | 25 | public void Close() |
26 | { | 26 | { |
27 | } | 27 | } |
28 | 28 | ||
29 | public string GetName() | 29 | public string Name |
30 | { | 30 | { |
31 | return "AssetDownloadModule"; | 31 | get { return "AssetDownloadModule"; } |
32 | } | 32 | } |
33 | 33 | ||
34 | public bool IsSharedModule() | 34 | public bool IsSharedModule |
35 | { | 35 | { |
36 | return false; | 36 | get { return false; } |
37 | } | 37 | } |
38 | 38 | ||
39 | public void NewClient(IClientAPI client) | 39 | public void NewClient(IClientAPI client) |
40 | { | 40 | { |
41 | } | 41 | } |
42 | } | 42 | } |
43 | } \ No newline at end of file | 43 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs index aaa9261..d8e4234 100644 --- a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs +++ b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs | |||
@@ -1,65 +1,65 @@ | |||
1 | using libsecondlife; | 1 | using libsecondlife; |
2 | using OpenSim.Framework.Interfaces; | 2 | using OpenSim.Framework.Interfaces; |
3 | using OpenSim.Region.Environment.Interfaces; | 3 | using OpenSim.Region.Environment.Interfaces; |
4 | using OpenSim.Region.Environment.Scenes; | 4 | using OpenSim.Region.Environment.Scenes; |
5 | 5 | ||
6 | namespace OpenSim.Region.Environment.Modules | 6 | namespace OpenSim.Region.Environment.Modules |
7 | { | 7 | { |
8 | public class AvatarProfilesModule : IRegionModule | 8 | public class AvatarProfilesModule : IRegionModule |
9 | { | 9 | { |
10 | private Scene m_scene; | 10 | private Scene m_scene; |
11 | 11 | ||
12 | public AvatarProfilesModule() | 12 | public AvatarProfilesModule() |
13 | { | 13 | { |
14 | } | 14 | } |
15 | 15 | ||
16 | public void Initialise(Scene scene) | 16 | public void Initialise(Scene scene) |
17 | { | 17 | { |
18 | m_scene = scene; | 18 | m_scene = scene; |
19 | m_scene.EventManager.OnNewClient += NewClient; | 19 | m_scene.EventManager.OnNewClient += NewClient; |
20 | } | 20 | } |
21 | 21 | ||
22 | public void PostInitialise() | 22 | public void PostInitialise() |
23 | { | 23 | { |
24 | } | 24 | } |
25 | 25 | ||
26 | public void CloseDown() | 26 | public void Close() |
27 | { | 27 | { |
28 | } | 28 | } |
29 | 29 | ||
30 | public string GetName() | 30 | public string Name |
31 | { | 31 | { |
32 | return "AvatarProfilesModule"; | 32 | get { return "AvatarProfilesModule"; } |
33 | } | 33 | } |
34 | 34 | ||
35 | public bool IsSharedModule() | 35 | public bool IsSharedModule |
36 | { | 36 | { |
37 | return false; | 37 | get { return false; } |
38 | } | 38 | } |
39 | 39 | ||
40 | public void NewClient(IClientAPI client) | 40 | public void NewClient(IClientAPI client) |
41 | { | 41 | { |
42 | client.OnRequestAvatarProperties += RequestAvatarProperty; | 42 | client.OnRequestAvatarProperties += RequestAvatarProperty; |
43 | } | 43 | } |
44 | 44 | ||
45 | public void RemoveClient(IClientAPI client) | 45 | public void RemoveClient(IClientAPI client) |
46 | { | 46 | { |
47 | client.OnRequestAvatarProperties -= RequestAvatarProperty; | 47 | client.OnRequestAvatarProperties -= RequestAvatarProperty; |
48 | } | 48 | } |
49 | 49 | ||
50 | /// <summary> | 50 | /// <summary> |
51 | /// | 51 | /// |
52 | /// </summary> | 52 | /// </summary> |
53 | /// <param name="remoteClient"></param> | 53 | /// <param name="remoteClient"></param> |
54 | /// <param name="avatarID"></param> | 54 | /// <param name="avatarID"></param> |
55 | public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID) | 55 | public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID) |
56 | { | 56 | { |
57 | string about = "OpenSim crash test dummy"; | 57 | string about = "OpenSim crash test dummy"; |
58 | string bornOn = "Before now"; | 58 | string bornOn = "Before now"; |
59 | string flAbout = "First life? What is one of those? OpenSim is my life!"; | 59 | string flAbout = "First life? What is one of those? OpenSim is my life!"; |
60 | LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000"); | 60 | LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000"); |
61 | remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "", | 61 | remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "", |
62 | partner); | 62 | partner); |
63 | } | 63 | } |
64 | } | 64 | } |
65 | } \ No newline at end of file | 65 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index 2eac7d6..453fa76 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs | |||
@@ -1,214 +1,214 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.IO; | 2 | using System.IO; |
3 | using System.Net.Sockets; | 3 | using System.Net.Sockets; |
4 | using System.Threading; | 4 | using System.Threading; |
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | using OpenSim.Framework.Interfaces; | 6 | using OpenSim.Framework.Interfaces; |
7 | using OpenSim.Framework.Utilities; | 7 | using OpenSim.Framework.Utilities; |
8 | using OpenSim.Region.Environment.Interfaces; | 8 | using OpenSim.Region.Environment.Interfaces; |
9 | using OpenSim.Region.Environment.Scenes; | 9 | using OpenSim.Region.Environment.Scenes; |
10 | 10 | ||
11 | namespace OpenSim.Region.Environment.Modules | 11 | namespace OpenSim.Region.Environment.Modules |
12 | { | 12 | { |
13 | public class ChatModule : IRegionModule, ISimChat | 13 | public class ChatModule : IRegionModule, ISimChat |
14 | { | 14 | { |
15 | private Scene m_scene; | 15 | private Scene m_scene; |
16 | 16 | ||
17 | private string m_server = "irc2.choopa.net"; | 17 | private string m_server = "irc2.choopa.net"; |
18 | 18 | ||
19 | // private int m_port = 6668; | 19 | // private int m_port = 6668; |
20 | //private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; | 20 | //private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; |
21 | private string m_nick = "OSimBot"; | 21 | private string m_nick = "OSimBot"; |
22 | private string m_channel = "#opensim"; | 22 | private string m_channel = "#opensim"; |
23 | 23 | ||
24 | // private NetworkStream m_stream; | 24 | // private NetworkStream m_stream; |
25 | private TcpClient m_irc; | 25 | private TcpClient m_irc; |
26 | private StreamWriter m_ircWriter; | 26 | private StreamWriter m_ircWriter; |
27 | private StreamReader m_ircReader; | 27 | private StreamReader m_ircReader; |
28 | 28 | ||
29 | // private Thread pingSender; | 29 | // private Thread pingSender; |
30 | // private Thread listener; | 30 | // private Thread listener; |
31 | 31 | ||
32 | private bool connected = false; | 32 | private bool connected = false; |
33 | 33 | ||
34 | public ChatModule() | 34 | public ChatModule() |
35 | { | 35 | { |
36 | m_nick = "OSimBot" + Util.RandomClass.Next(1, 99); | 36 | m_nick = "OSimBot" + Util.RandomClass.Next(1, 99); |
37 | m_irc = null; | 37 | m_irc = null; |
38 | m_ircWriter = null; | 38 | m_ircWriter = null; |
39 | m_ircReader = null; | 39 | m_ircReader = null; |
40 | } | 40 | } |
41 | 41 | ||
42 | public void Initialise(Scene scene) | 42 | public void Initialise(Scene scene) |
43 | { | 43 | { |
44 | m_scene = scene; | 44 | m_scene = scene; |
45 | m_scene.EventManager.OnNewClient += NewClient; | 45 | m_scene.EventManager.OnNewClient += NewClient; |
46 | 46 | ||
47 | m_scene.RegisterModuleInterface<ISimChat>(this); | 47 | m_scene.RegisterModuleInterface<ISimChat>(this); |
48 | } | 48 | } |
49 | 49 | ||
50 | public void PostInitialise() | 50 | public void PostInitialise() |
51 | { | 51 | { |
52 | /* | 52 | /* |
53 | try | 53 | try |
54 | { | 54 | { |
55 | m_irc = new TcpClient(m_server, m_port); | 55 | m_irc = new TcpClient(m_server, m_port); |
56 | m_stream = m_irc.GetStream(); | 56 | m_stream = m_irc.GetStream(); |
57 | m_ircReader = new StreamReader(m_stream); | 57 | m_ircReader = new StreamReader(m_stream); |
58 | m_ircWriter = new StreamWriter(m_stream); | 58 | m_ircWriter = new StreamWriter(m_stream); |
59 | 59 | ||
60 | pingSender = new Thread(new ThreadStart(this.PingRun)); | 60 | pingSender = new Thread(new ThreadStart(this.PingRun)); |
61 | pingSender.Start(); | 61 | pingSender.Start(); |
62 | 62 | ||
63 | listener = new Thread(new ThreadStart(this.ListenerRun)); | 63 | listener = new Thread(new ThreadStart(this.ListenerRun)); |
64 | listener.Start(); | 64 | listener.Start(); |
65 | 65 | ||
66 | m_ircWriter.WriteLine(m_user); | 66 | m_ircWriter.WriteLine(m_user); |
67 | m_ircWriter.Flush(); | 67 | m_ircWriter.Flush(); |
68 | m_ircWriter.WriteLine("NICK " + m_nick); | 68 | m_ircWriter.WriteLine("NICK " + m_nick); |
69 | m_ircWriter.Flush(); | 69 | m_ircWriter.Flush(); |
70 | m_ircWriter.WriteLine("JOIN " + m_channel); | 70 | m_ircWriter.WriteLine("JOIN " + m_channel); |
71 | m_ircWriter.Flush(); | 71 | m_ircWriter.Flush(); |
72 | connected = true; | 72 | connected = true; |
73 | } | 73 | } |
74 | catch (Exception e) | 74 | catch (Exception e) |
75 | { | 75 | { |
76 | Console.WriteLine(e.ToString()); | 76 | Console.WriteLine(e.ToString()); |
77 | } | 77 | } |
78 | */ | 78 | */ |
79 | } | 79 | } |
80 | 80 | ||
81 | public void CloseDown() | 81 | public void Close() |
82 | { | 82 | { |
83 | m_ircWriter.Close(); | 83 | m_ircWriter.Close(); |
84 | m_ircReader.Close(); | 84 | m_ircReader.Close(); |
85 | m_irc.Close(); | 85 | m_irc.Close(); |
86 | } | 86 | } |
87 | 87 | ||
88 | public string GetName() | 88 | public string Name |
89 | { | 89 | { |
90 | return "ChatModule"; | 90 | get { return "ChatModule"; } |
91 | } | 91 | } |
92 | 92 | ||
93 | public bool IsSharedModule() | 93 | public bool IsSharedModule |
94 | { | 94 | { |
95 | return false; | 95 | get { return false; } |
96 | } | 96 | } |
97 | 97 | ||
98 | public void NewClient(IClientAPI client) | 98 | public void NewClient(IClientAPI client) |
99 | { | 99 | { |
100 | client.OnChatFromViewer += SimChat; | 100 | client.OnChatFromViewer += SimChat; |
101 | } | 101 | } |
102 | 102 | ||
103 | public void PingRun() | 103 | public void PingRun() |
104 | { | 104 | { |
105 | while (true) | 105 | while (true) |
106 | { | 106 | { |
107 | m_ircWriter.WriteLine("PING :" + m_server); | 107 | m_ircWriter.WriteLine("PING :" + m_server); |
108 | m_ircWriter.Flush(); | 108 | m_ircWriter.Flush(); |
109 | Thread.Sleep(15000); | 109 | Thread.Sleep(15000); |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
113 | public void ListenerRun() | 113 | public void ListenerRun() |
114 | { | 114 | { |
115 | string inputLine; | 115 | string inputLine; |
116 | LLVector3 pos = new LLVector3(128, 128, 20); | 116 | LLVector3 pos = new LLVector3(128, 128, 20); |
117 | while (true) | 117 | while (true) |
118 | { | 118 | { |
119 | while ((inputLine = m_ircReader.ReadLine()) != null) | 119 | while ((inputLine = m_ircReader.ReadLine()) != null) |
120 | { | 120 | { |
121 | Console.WriteLine(inputLine); | 121 | Console.WriteLine(inputLine); |
122 | if (inputLine.Contains(m_channel)) | 122 | if (inputLine.Contains(m_channel)) |
123 | { | 123 | { |
124 | string mess = inputLine.Substring(inputLine.IndexOf(m_channel)); | 124 | string mess = inputLine.Substring(inputLine.IndexOf(m_channel)); |
125 | m_scene.Broadcast(delegate(IClientAPI client) | 125 | m_scene.Broadcast(delegate(IClientAPI client) |
126 | { | 126 | { |
127 | client.SendChatMessage( | 127 | client.SendChatMessage( |
128 | Helpers.StringToField(mess), 255, pos, "IRC:", | 128 | Helpers.StringToField(mess), 255, pos, "IRC:", |
129 | LLUUID.Zero); | 129 | LLUUID.Zero); |
130 | }); | 130 | }); |
131 | } | 131 | } |
132 | } | 132 | } |
133 | } | 133 | } |
134 | } | 134 | } |
135 | 135 | ||
136 | public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, | 136 | public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, |
137 | LLUUID fromAgentID) | 137 | LLUUID fromAgentID) |
138 | { | 138 | { |
139 | ScenePresence avatar = null; | 139 | ScenePresence avatar = null; |
140 | avatar = m_scene.GetScenePresence(fromAgentID); | 140 | avatar = m_scene.GetScenePresence(fromAgentID); |
141 | if (avatar != null) | 141 | if (avatar != null) |
142 | { | 142 | { |
143 | fromPos = avatar.AbsolutePosition; | 143 | fromPos = avatar.AbsolutePosition; |
144 | fromName = avatar.Firstname + " " + avatar.Lastname; | 144 | fromName = avatar.Firstname + " " + avatar.Lastname; |
145 | avatar = null; | 145 | avatar = null; |
146 | } | 146 | } |
147 | 147 | ||
148 | if (connected) | 148 | if (connected) |
149 | { | 149 | { |
150 | m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " + | 150 | m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " + |
151 | Util.FieldToString(message)); | 151 | Util.FieldToString(message)); |
152 | m_ircWriter.Flush(); | 152 | m_ircWriter.Flush(); |
153 | } | 153 | } |
154 | 154 | ||
155 | if (channel == 0) | 155 | if (channel == 0) |
156 | { | 156 | { |
157 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) | 157 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) |
158 | { | 158 | { |
159 | int dis = -1000; | 159 | int dis = -1000; |
160 | 160 | ||
161 | //err ??? the following code seems to be request a scenePresence when it already has a ref to it | 161 | //err ??? the following code seems to be request a scenePresence when it already has a ref to it |
162 | avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId); | 162 | avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId); |
163 | if (avatar != null) | 163 | if (avatar != null) |
164 | { | 164 | { |
165 | dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos); | 165 | dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos); |
166 | } | 166 | } |
167 | 167 | ||
168 | switch (type) | 168 | switch (type) |
169 | { | 169 | { |
170 | case 0: // Whisper | 170 | case 0: // Whisper |
171 | if ((dis < 10) && (dis > -10)) | 171 | if ((dis < 10) && (dis > -10)) |
172 | { | 172 | { |
173 | //should change so the message is sent through the avatar rather than direct to the ClientView | 173 | //should change so the message is sent through the avatar rather than direct to the ClientView |
174 | presence.ControllingClient.SendChatMessage(message, | 174 | presence.ControllingClient.SendChatMessage(message, |
175 | type, | 175 | type, |
176 | fromPos, | 176 | fromPos, |
177 | fromName, | 177 | fromName, |
178 | fromAgentID); | 178 | fromAgentID); |
179 | } | 179 | } |
180 | break; | 180 | break; |
181 | case 1: // Say | 181 | case 1: // Say |
182 | if ((dis < 30) && (dis > -30)) | 182 | if ((dis < 30) && (dis > -30)) |
183 | { | 183 | { |
184 | //Console.WriteLine("sending chat"); | 184 | //Console.WriteLine("sending chat"); |
185 | presence.ControllingClient.SendChatMessage(message, | 185 | presence.ControllingClient.SendChatMessage(message, |
186 | type, | 186 | type, |
187 | fromPos, | 187 | fromPos, |
188 | fromName, | 188 | fromName, |
189 | fromAgentID); | 189 | fromAgentID); |
190 | } | 190 | } |
191 | break; | 191 | break; |
192 | case 2: // Shout | 192 | case 2: // Shout |
193 | if ((dis < 100) && (dis > -100)) | 193 | if ((dis < 100) && (dis > -100)) |
194 | { | 194 | { |
195 | presence.ControllingClient.SendChatMessage(message, | 195 | presence.ControllingClient.SendChatMessage(message, |
196 | type, | 196 | type, |
197 | fromPos, | 197 | fromPos, |
198 | fromName, | 198 | fromName, |
199 | fromAgentID); | 199 | fromAgentID); |
200 | } | 200 | } |
201 | break; | 201 | break; |
202 | 202 | ||
203 | case 0xff: // Broadcast | 203 | case 0xff: // Broadcast |
204 | presence.ControllingClient.SendChatMessage(message, type, | 204 | presence.ControllingClient.SendChatMessage(message, type, |
205 | fromPos, | 205 | fromPos, |
206 | fromName, | 206 | fromName, |
207 | fromAgentID); | 207 | fromAgentID); |
208 | break; | 208 | break; |
209 | } | 209 | } |
210 | }); | 210 | }); |
211 | } | 211 | } |
212 | } | 212 | } |
213 | } | 213 | } |
214 | } \ No newline at end of file | 214 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs index 5f8824c..d08e552 100644 --- a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs +++ b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs | |||
@@ -1,157 +1,157 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using libsecondlife; | 3 | using libsecondlife; |
4 | using OpenSim.Framework.Types; | 4 | using OpenSim.Framework.Types; |
5 | using OpenSim.Framework.Utilities; | 5 | using OpenSim.Framework.Utilities; |
6 | using OpenSim.Region.Environment.Interfaces; | 6 | using OpenSim.Region.Environment.Interfaces; |
7 | using OpenSim.Region.Environment.Scenes; | 7 | using OpenSim.Region.Environment.Scenes; |
8 | 8 | ||
9 | namespace OpenSim.Region.Environment.Modules | 9 | namespace OpenSim.Region.Environment.Modules |
10 | { | 10 | { |
11 | public class DynamicTextureModule : IRegionModule, IDynamicTextureManager | 11 | public class DynamicTextureModule : IRegionModule, IDynamicTextureManager |
12 | { | 12 | { |
13 | private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); | 13 | private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); |
14 | 14 | ||
15 | private Dictionary<string, IDynamicTextureRender> RenderPlugins = | 15 | private Dictionary<string, IDynamicTextureRender> RenderPlugins = |
16 | new Dictionary<string, IDynamicTextureRender>(); | 16 | new Dictionary<string, IDynamicTextureRender>(); |
17 | 17 | ||
18 | private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>(); | 18 | private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>(); |
19 | 19 | ||
20 | public void Initialise(Scene scene) | 20 | public void Initialise(Scene scene) |
21 | { | 21 | { |
22 | if (!RegisteredScenes.ContainsKey(scene.RegionInfo.SimUUID)) | 22 | if (!RegisteredScenes.ContainsKey(scene.RegionInfo.SimUUID)) |
23 | { | 23 | { |
24 | RegisteredScenes.Add(scene.RegionInfo.SimUUID, scene); | 24 | RegisteredScenes.Add(scene.RegionInfo.SimUUID, scene); |
25 | scene.RegisterModuleInterface<IDynamicTextureManager>(this); | 25 | scene.RegisterModuleInterface<IDynamicTextureManager>(this); |
26 | } | 26 | } |
27 | } | 27 | } |
28 | 28 | ||
29 | public void PostInitialise() | 29 | public void PostInitialise() |
30 | { | 30 | { |
31 | } | 31 | } |
32 | 32 | ||
33 | public void CloseDown() | 33 | public void Close() |
34 | { | 34 | { |
35 | } | 35 | } |
36 | 36 | ||
37 | public string GetName() | 37 | public string Name |
38 | { | 38 | { |
39 | return "DynamicTextureModule"; | 39 | get { return "DynamicTextureModule"; } |
40 | } | 40 | } |
41 | 41 | ||
42 | public bool IsSharedModule() | 42 | public bool IsSharedModule |
43 | { | 43 | { |
44 | return true; | 44 | get { return true; } |
45 | } | 45 | } |
46 | 46 | ||
47 | public void RegisterRender(string handleType, IDynamicTextureRender render) | 47 | public void RegisterRender(string handleType, IDynamicTextureRender render) |
48 | { | 48 | { |
49 | if (!RenderPlugins.ContainsKey(handleType)) | 49 | if (!RenderPlugins.ContainsKey(handleType)) |
50 | { | 50 | { |
51 | RenderPlugins.Add(handleType, render); | 51 | RenderPlugins.Add(handleType, render); |
52 | } | 52 | } |
53 | } | 53 | } |
54 | 54 | ||
55 | public void ReturnData(LLUUID id, byte[] data) | 55 | public void ReturnData(LLUUID id, byte[] data) |
56 | { | 56 | { |
57 | if (Updaters.ContainsKey(id)) | 57 | if (Updaters.ContainsKey(id)) |
58 | { | 58 | { |
59 | DynamicTextureUpdater updater = Updaters[id]; | 59 | DynamicTextureUpdater updater = Updaters[id]; |
60 | if (RegisteredScenes.ContainsKey(updater.SimUUID)) | 60 | if (RegisteredScenes.ContainsKey(updater.SimUUID)) |
61 | { | 61 | { |
62 | Scene scene = RegisteredScenes[updater.SimUUID]; | 62 | Scene scene = RegisteredScenes[updater.SimUUID]; |
63 | updater.DataReceived(data, scene); | 63 | updater.DataReceived(data, scene); |
64 | } | 64 | } |
65 | } | 65 | } |
66 | } | 66 | } |
67 | 67 | ||
68 | public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, | 68 | public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, |
69 | string extraParams, int updateTimer) | 69 | string extraParams, int updateTimer) |
70 | { | 70 | { |
71 | Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); | 71 | Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); |
72 | if (RenderPlugins.ContainsKey(contentType)) | 72 | if (RenderPlugins.ContainsKey(contentType)) |
73 | { | 73 | { |
74 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); | 74 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); |
75 | updater.SimUUID = simID; | 75 | updater.SimUUID = simID; |
76 | updater.PrimID = primID; | 76 | updater.PrimID = primID; |
77 | updater.ContentType = contentType; | 77 | updater.ContentType = contentType; |
78 | updater.Url = url; | 78 | updater.Url = url; |
79 | updater.UpdateTimer = updateTimer; | 79 | updater.UpdateTimer = updateTimer; |
80 | updater.UpdaterID = LLUUID.Random(); | 80 | updater.UpdaterID = LLUUID.Random(); |
81 | updater.Params = extraParams; | 81 | updater.Params = extraParams; |
82 | 82 | ||
83 | if (!Updaters.ContainsKey(updater.UpdaterID)) | 83 | if (!Updaters.ContainsKey(updater.UpdaterID)) |
84 | { | 84 | { |
85 | Updaters.Add(updater.UpdaterID, updater); | 85 | Updaters.Add(updater.UpdaterID, updater); |
86 | } | 86 | } |
87 | 87 | ||
88 | RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams); | 88 | RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams); |
89 | return updater.UpdaterID; | 89 | return updater.UpdaterID; |
90 | } | 90 | } |
91 | return LLUUID.Zero; | 91 | return LLUUID.Zero; |
92 | } | 92 | } |
93 | 93 | ||
94 | public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, | 94 | public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, |
95 | string extraParams, int updateTimer) | 95 | string extraParams, int updateTimer) |
96 | { | 96 | { |
97 | if (RenderPlugins.ContainsKey(contentType)) | 97 | if (RenderPlugins.ContainsKey(contentType)) |
98 | { | 98 | { |
99 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); | 99 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); |
100 | updater.SimUUID = simID; | 100 | updater.SimUUID = simID; |
101 | updater.PrimID = primID; | 101 | updater.PrimID = primID; |
102 | updater.ContentType = contentType; | 102 | updater.ContentType = contentType; |
103 | updater.BodyData = data; | 103 | updater.BodyData = data; |
104 | updater.UpdateTimer = updateTimer; | 104 | updater.UpdateTimer = updateTimer; |
105 | updater.UpdaterID = LLUUID.Random(); | 105 | updater.UpdaterID = LLUUID.Random(); |
106 | updater.Params = extraParams; | 106 | updater.Params = extraParams; |
107 | 107 | ||
108 | if (!Updaters.ContainsKey(updater.UpdaterID)) | 108 | if (!Updaters.ContainsKey(updater.UpdaterID)) |
109 | { | 109 | { |
110 | Updaters.Add(updater.UpdaterID, updater); | 110 | Updaters.Add(updater.UpdaterID, updater); |
111 | } | 111 | } |
112 | 112 | ||
113 | RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams); | 113 | RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams); |
114 | return updater.UpdaterID; | 114 | return updater.UpdaterID; |
115 | } | 115 | } |
116 | return LLUUID.Zero; | 116 | return LLUUID.Zero; |
117 | } | 117 | } |
118 | 118 | ||
119 | public class DynamicTextureUpdater | 119 | public class DynamicTextureUpdater |
120 | { | 120 | { |
121 | public LLUUID SimUUID; | 121 | public LLUUID SimUUID; |
122 | public LLUUID UpdaterID; | 122 | public LLUUID UpdaterID; |
123 | public string ContentType; | 123 | public string ContentType; |
124 | public string Url; | 124 | public string Url; |
125 | public string BodyData; | 125 | public string BodyData; |
126 | public LLUUID PrimID; | 126 | public LLUUID PrimID; |
127 | public int UpdateTimer; | 127 | public int UpdateTimer; |
128 | public LLUUID LastAssetID; | 128 | public LLUUID LastAssetID; |
129 | public string Params; | 129 | public string Params; |
130 | 130 | ||
131 | public DynamicTextureUpdater() | 131 | public DynamicTextureUpdater() |
132 | { | 132 | { |
133 | LastAssetID = LLUUID.Zero; | 133 | LastAssetID = LLUUID.Zero; |
134 | UpdateTimer = 0; | 134 | UpdateTimer = 0; |
135 | BodyData = null; | 135 | BodyData = null; |
136 | } | 136 | } |
137 | 137 | ||
138 | public void DataReceived(byte[] data, Scene scene) | 138 | public void DataReceived(byte[] data, Scene scene) |
139 | { | 139 | { |
140 | //TODO delete the last asset(data), if it was a dynamic texture | 140 | //TODO delete the last asset(data), if it was a dynamic texture |
141 | 141 | ||
142 | AssetBase asset = new AssetBase(); | 142 | AssetBase asset = new AssetBase(); |
143 | asset.FullID = LLUUID.Random(); | 143 | asset.FullID = LLUUID.Random(); |
144 | asset.Data = data; | 144 | asset.Data = data; |
145 | asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); | 145 | asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); |
146 | asset.Type = 0; | 146 | asset.Type = 0; |
147 | scene.commsManager.AssetCache.AddAsset(asset); | 147 | scene.commsManager.AssetCache.AddAsset(asset); |
148 | 148 | ||
149 | LastAssetID = asset.FullID; | 149 | LastAssetID = asset.FullID; |
150 | 150 | ||
151 | SceneObjectPart part = scene.GetSceneObjectPart(PrimID); | 151 | SceneObjectPart part = scene.GetSceneObjectPart(PrimID); |
152 | part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes(); | 152 | part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes(); |
153 | part.ScheduleFullUpdate(); | 153 | part.ScheduleFullUpdate(); |
154 | } | 154 | } |
155 | } | 155 | } |
156 | } | 156 | } |
157 | } \ No newline at end of file | 157 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs index 767b4b0..20b509a 100644 --- a/OpenSim/Region/Environment/Modules/FriendsModule.cs +++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs | |||
@@ -1,33 +1,33 @@ | |||
1 | using OpenSim.Region.Environment.Interfaces; | 1 | using OpenSim.Region.Environment.Interfaces; |
2 | using OpenSim.Region.Environment.Scenes; | 2 | using OpenSim.Region.Environment.Scenes; |
3 | 3 | ||
4 | namespace OpenSim.Region.Environment.Modules | 4 | namespace OpenSim.Region.Environment.Modules |
5 | { | 5 | { |
6 | public class FriendsModule : IRegionModule | 6 | public class FriendsModule : IRegionModule |
7 | { | 7 | { |
8 | private Scene m_scene; | 8 | private Scene m_scene; |
9 | 9 | ||
10 | public void Initialise(Scene scene) | 10 | public void Initialise(Scene scene) |
11 | { | 11 | { |
12 | m_scene = scene; | 12 | m_scene = scene; |
13 | } | 13 | } |
14 | 14 | ||
15 | public void PostInitialise() | 15 | public void PostInitialise() |
16 | { | 16 | { |
17 | } | 17 | } |
18 | 18 | ||
19 | public void CloseDown() | 19 | public void Close() |
20 | { | 20 | { |
21 | } | 21 | } |
22 | 22 | ||
23 | public string GetName() | 23 | public string Name |
24 | { | 24 | { |
25 | return "FriendsModule"; | 25 | get { return "FriendsModule"; } |
26 | } | 26 | } |
27 | 27 | ||
28 | public bool IsSharedModule() | 28 | public bool IsSharedModule |
29 | { | 29 | { |
30 | return false; | 30 | get { return false; } |
31 | } | 31 | } |
32 | } | 32 | } |
33 | } \ No newline at end of file | 33 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/GroupsModule.cs b/OpenSim/Region/Environment/Modules/GroupsModule.cs index fa5804e..e489207 100644 --- a/OpenSim/Region/Environment/Modules/GroupsModule.cs +++ b/OpenSim/Region/Environment/Modules/GroupsModule.cs | |||
@@ -1,33 +1,33 @@ | |||
1 | using OpenSim.Region.Environment.Interfaces; | 1 | using OpenSim.Region.Environment.Interfaces; |
2 | using OpenSim.Region.Environment.Scenes; | 2 | using OpenSim.Region.Environment.Scenes; |
3 | 3 | ||
4 | namespace OpenSim.Region.Environment.Modules | 4 | namespace OpenSim.Region.Environment.Modules |
5 | { | 5 | { |
6 | public class GroupsModule : IRegionModule | 6 | public class GroupsModule : IRegionModule |
7 | { | 7 | { |
8 | private Scene m_scene; | 8 | private Scene m_scene; |
9 | 9 | ||
10 | public void Initialise(Scene scene) | 10 | public void Initialise(Scene scene) |
11 | { | 11 | { |
12 | m_scene = scene; | 12 | m_scene = scene; |
13 | } | 13 | } |
14 | 14 | ||
15 | public void PostInitialise() | 15 | public void PostInitialise() |
16 | { | 16 | { |
17 | } | 17 | } |
18 | 18 | ||
19 | public void CloseDown() | 19 | public void Close() |
20 | { | 20 | { |
21 | } | 21 | } |
22 | 22 | ||
23 | public string GetName() | 23 | public string Name |
24 | { | 24 | { |
25 | return "GroupsModule"; | 25 | get { return "GroupsModule"; } |
26 | } | 26 | } |
27 | 27 | ||
28 | public bool IsSharedModule() | 28 | public bool IsSharedModule |
29 | { | 29 | { |
30 | return false; | 30 | get { return false; } |
31 | } | 31 | } |
32 | } | 32 | } |
33 | } \ No newline at end of file | 33 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs index 44cb3d5..acf7cce 100644 --- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs +++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs | |||
@@ -1,33 +1,33 @@ | |||
1 | using OpenSim.Region.Environment.Interfaces; | 1 | using OpenSim.Region.Environment.Interfaces; |
2 | using OpenSim.Region.Environment.Scenes; | 2 | using OpenSim.Region.Environment.Scenes; |
3 | 3 | ||
4 | namespace OpenSim.Region.Environment.Modules | 4 | namespace OpenSim.Region.Environment.Modules |
5 | { | 5 | { |
6 | public class InstantMessageModule : IRegionModule | 6 | public class InstantMessageModule : IRegionModule |
7 | { | 7 | { |
8 | private Scene m_scene; | 8 | private Scene m_scene; |
9 | 9 | ||
10 | public void Initialise(Scene scene) | 10 | public void Initialise(Scene scene) |
11 | { | 11 | { |
12 | m_scene = scene; | 12 | m_scene = scene; |
13 | } | 13 | } |
14 | 14 | ||
15 | public void PostInitialise() | 15 | public void PostInitialise() |
16 | { | 16 | { |
17 | } | 17 | } |
18 | 18 | ||
19 | public void CloseDown() | 19 | public void Close() |
20 | { | 20 | { |
21 | } | 21 | } |
22 | 22 | ||
23 | public string GetName() | 23 | public string Name |
24 | { | 24 | { |
25 | return "InstantMessageModule"; | 25 | get { return "InstantMessageModule"; } |
26 | } | 26 | } |
27 | 27 | ||
28 | public bool IsSharedModule() | 28 | public bool IsSharedModule |
29 | { | 29 | { |
30 | return false; | 30 | get { return false; } |
31 | } | 31 | } |
32 | } | 32 | } |
33 | } \ No newline at end of file | 33 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/InventoryModule.cs b/OpenSim/Region/Environment/Modules/InventoryModule.cs index 527731d..0c6ed69 100644 --- a/OpenSim/Region/Environment/Modules/InventoryModule.cs +++ b/OpenSim/Region/Environment/Modules/InventoryModule.cs | |||
@@ -1,33 +1,33 @@ | |||
1 | using OpenSim.Region.Environment.Interfaces; | 1 | using OpenSim.Region.Environment.Interfaces; |
2 | using OpenSim.Region.Environment.Scenes; | 2 | using OpenSim.Region.Environment.Scenes; |
3 | 3 | ||
4 | namespace OpenSim.Region.Environment.Modules | 4 | namespace OpenSim.Region.Environment.Modules |
5 | { | 5 | { |
6 | public class InventoryModule : IRegionModule | 6 | public class InventoryModule : IRegionModule |
7 | { | 7 | { |
8 | private Scene m_scene; | 8 | private Scene m_scene; |
9 | 9 | ||
10 | public void Initialise(Scene scene) | 10 | public void Initialise(Scene scene) |
11 | { | 11 | { |
12 | m_scene = scene; | 12 | m_scene = scene; |
13 | } | 13 | } |
14 | 14 | ||
15 | public void PostInitialise() | 15 | public void PostInitialise() |
16 | { | 16 | { |
17 | } | 17 | } |
18 | 18 | ||
19 | public void CloseDown() | 19 | public void Close() |
20 | { | 20 | { |
21 | } | 21 | } |
22 | 22 | ||
23 | public string GetName() | 23 | public string Name |
24 | { | 24 | { |
25 | return "InventoryModule"; | 25 | get { return "InventoryModule"; } |
26 | } | 26 | } |
27 | 27 | ||
28 | public bool IsSharedModule() | 28 | public bool IsSharedModule |
29 | { | 29 | { |
30 | return false; | 30 | get { return false; } |
31 | } | 31 | } |
32 | } | 32 | } |
33 | } \ No newline at end of file | 33 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs index 38c7d9b..921dbb1 100644 --- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs | |||
@@ -1,48 +1,48 @@ | |||
1 | using libsecondlife; | 1 | using libsecondlife; |
2 | using OpenSim.Framework.Interfaces; | 2 | using OpenSim.Framework.Interfaces; |
3 | using OpenSim.Region.Environment.Interfaces; | 3 | using OpenSim.Region.Environment.Interfaces; |
4 | using OpenSim.Region.Environment.Scenes; | 4 | using OpenSim.Region.Environment.Scenes; |
5 | 5 | ||
6 | namespace OpenSim.Region.Environment.Modules | 6 | namespace OpenSim.Region.Environment.Modules |
7 | { | 7 | { |
8 | public class TextureDownloadModule : IRegionModule | 8 | public class TextureDownloadModule : IRegionModule |
9 | { | 9 | { |
10 | private Scene m_scene; | 10 | private Scene m_scene; |
11 | 11 | ||
12 | public TextureDownloadModule() | 12 | public TextureDownloadModule() |
13 | { | 13 | { |
14 | } | 14 | } |
15 | 15 | ||
16 | public void Initialise(Scene scene) | 16 | public void Initialise(Scene scene) |
17 | { | 17 | { |
18 | m_scene = scene; | 18 | m_scene = scene; |
19 | m_scene.EventManager.OnNewClient += NewClient; | 19 | m_scene.EventManager.OnNewClient += NewClient; |
20 | } | 20 | } |
21 | 21 | ||
22 | public void PostInitialise() | 22 | public void PostInitialise() |
23 | { | 23 | { |
24 | } | 24 | } |
25 | 25 | ||
26 | public void CloseDown() | 26 | public void Close() |
27 | { | 27 | { |
28 | } | 28 | } |
29 | 29 | ||
30 | public string GetName() | 30 | public string Name |
31 | { | 31 | { |
32 | return "TextureDownloadModule"; | 32 | get { return "TextureDownloadModule"; } |
33 | } | 33 | } |
34 | 34 | ||
35 | public bool IsSharedModule() | 35 | public bool IsSharedModule |
36 | { | 36 | { |
37 | return false; | 37 | get { return false; } |
38 | } | 38 | } |
39 | 39 | ||
40 | public void NewClient(IClientAPI client) | 40 | public void NewClient(IClientAPI client) |
41 | { | 41 | { |
42 | } | 42 | } |
43 | 43 | ||
44 | public void TextureAssetCallback(LLUUID texture, byte[] data) | 44 | public void TextureAssetCallback(LLUUID texture, byte[] data) |
45 | { | 45 | { |
46 | } | 46 | } |
47 | } | 47 | } |
48 | } \ No newline at end of file | 48 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/WorldCommModule.cs b/OpenSim/Region/Environment/Modules/WorldCommModule.cs index c2ec699..cf0c2ca 100644 --- a/OpenSim/Region/Environment/Modules/WorldCommModule.cs +++ b/OpenSim/Region/Environment/Modules/WorldCommModule.cs | |||
@@ -71,18 +71,18 @@ namespace OpenSim.Region.Environment.Modules | |||
71 | { | 71 | { |
72 | } | 72 | } |
73 | 73 | ||
74 | public void CloseDown() | 74 | public void Close() |
75 | { | 75 | { |
76 | } | 76 | } |
77 | 77 | ||
78 | public string GetName() | 78 | public string Name |
79 | { | 79 | { |
80 | return m_name; | 80 | get { return m_name; } |
81 | } | 81 | } |
82 | 82 | ||
83 | public bool IsSharedModule() | 83 | public bool IsSharedModule |
84 | { | 84 | { |
85 | return false; | 85 | get { return false; } |
86 | } | 86 | } |
87 | 87 | ||
88 | public void NewClient(IClientAPI client) | 88 | public void NewClient(IClientAPI client) |
diff --git a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs index 50ed776..879a1ff 100644 --- a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs +++ b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs | |||
@@ -85,18 +85,18 @@ namespace OpenSim.Region.Environment.Modules | |||
85 | { | 85 | { |
86 | } | 86 | } |
87 | 87 | ||
88 | public void CloseDown() | 88 | public void Close() |
89 | { | 89 | { |
90 | } | 90 | } |
91 | 91 | ||
92 | public string GetName() | 92 | public string Name |
93 | { | 93 | { |
94 | return m_name; | 94 | get { return m_name; } |
95 | } | 95 | } |
96 | 96 | ||
97 | public bool IsSharedModule() | 97 | public bool IsSharedModule |
98 | { | 98 | { |
99 | return false; | 99 | get { return false; } |
100 | } | 100 | } |
101 | 101 | ||
102 | /********************************************** | 102 | /********************************************** |
diff --git a/OpenSim/Region/Environment/Modules/XferModule.cs b/OpenSim/Region/Environment/Modules/XferModule.cs index 9f93c1e..819e894 100644 --- a/OpenSim/Region/Environment/Modules/XferModule.cs +++ b/OpenSim/Region/Environment/Modules/XferModule.cs | |||
@@ -1,173 +1,173 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using libsecondlife; | 3 | using libsecondlife; |
4 | using OpenSim.Framework.Interfaces; | 4 | using OpenSim.Framework.Interfaces; |
5 | using OpenSim.Region.Environment.Interfaces; | 5 | using OpenSim.Region.Environment.Interfaces; |
6 | using OpenSim.Region.Environment.Scenes; | 6 | using OpenSim.Region.Environment.Scenes; |
7 | 7 | ||
8 | namespace OpenSim.Region.Environment.Modules | 8 | namespace OpenSim.Region.Environment.Modules |
9 | { | 9 | { |
10 | public class XferModule : IRegionModule, IXfer | 10 | public class XferModule : IRegionModule, IXfer |
11 | { | 11 | { |
12 | public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); | 12 | public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); |
13 | public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); | 13 | public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); |
14 | 14 | ||
15 | private Scene m_scene; | 15 | private Scene m_scene; |
16 | 16 | ||
17 | public XferModule() | 17 | public XferModule() |
18 | { | 18 | { |
19 | } | 19 | } |
20 | 20 | ||
21 | public void Initialise(Scene scene) | 21 | public void Initialise(Scene scene) |
22 | { | 22 | { |
23 | m_scene = scene; | 23 | m_scene = scene; |
24 | m_scene.EventManager.OnNewClient += NewClient; | 24 | m_scene.EventManager.OnNewClient += NewClient; |
25 | 25 | ||
26 | m_scene.RegisterModuleInterface<IXfer>(this); | 26 | m_scene.RegisterModuleInterface<IXfer>(this); |
27 | } | 27 | } |
28 | 28 | ||
29 | public void PostInitialise() | 29 | public void PostInitialise() |
30 | { | 30 | { |
31 | } | 31 | } |
32 | 32 | ||
33 | public void CloseDown() | 33 | public void Close() |
34 | { | 34 | { |
35 | } | 35 | } |
36 | 36 | ||
37 | public string GetName() | 37 | public string Name |
38 | { | 38 | { |
39 | return "XferModule"; | 39 | get { return "XferModule"; } |
40 | } | 40 | } |
41 | 41 | ||
42 | public bool IsSharedModule() | 42 | public bool IsSharedModule |
43 | { | 43 | { |
44 | return false; | 44 | get { return false; } |
45 | } | 45 | } |
46 | 46 | ||
47 | public void NewClient(IClientAPI client) | 47 | public void NewClient(IClientAPI client) |
48 | { | 48 | { |
49 | client.OnRequestXfer += RequestXfer; | 49 | client.OnRequestXfer += RequestXfer; |
50 | client.OnConfirmXfer += AckPacket; | 50 | client.OnConfirmXfer += AckPacket; |
51 | } | 51 | } |
52 | 52 | ||
53 | /// <summary> | 53 | /// <summary> |
54 | /// | 54 | /// |
55 | /// </summary> | 55 | /// </summary> |
56 | /// <param name="remoteClient"></param> | 56 | /// <param name="remoteClient"></param> |
57 | /// <param name="xferID"></param> | 57 | /// <param name="xferID"></param> |
58 | /// <param name="fileName"></param> | 58 | /// <param name="fileName"></param> |
59 | public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName) | 59 | public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName) |
60 | { | 60 | { |
61 | lock (NewFiles) | 61 | lock (NewFiles) |
62 | { | 62 | { |
63 | if (NewFiles.ContainsKey(fileName)) | 63 | if (NewFiles.ContainsKey(fileName)) |
64 | { | 64 | { |
65 | if (!Transfers.ContainsKey(xferID)) | 65 | if (!Transfers.ContainsKey(xferID)) |
66 | { | 66 | { |
67 | byte[] fileData = NewFiles[fileName]; | 67 | byte[] fileData = NewFiles[fileName]; |
68 | XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient); | 68 | XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient); |
69 | Transfers.Add(xferID, transaction); | 69 | Transfers.Add(xferID, transaction); |
70 | NewFiles.Remove(fileName); | 70 | NewFiles.Remove(fileName); |
71 | transaction.StartSend(); | 71 | transaction.StartSend(); |
72 | } | 72 | } |
73 | } | 73 | } |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet) | 77 | public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet) |
78 | { | 78 | { |
79 | if (Transfers.ContainsKey(xferID)) | 79 | if (Transfers.ContainsKey(xferID)) |
80 | { | 80 | { |
81 | Transfers[xferID].AckPacket(packet); | 81 | Transfers[xferID].AckPacket(packet); |
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
85 | public bool AddNewFile(string fileName, byte[] data) | 85 | public bool AddNewFile(string fileName, byte[] data) |
86 | { | 86 | { |
87 | lock (NewFiles) | 87 | lock (NewFiles) |
88 | { | 88 | { |
89 | if (NewFiles.ContainsKey(fileName)) | 89 | if (NewFiles.ContainsKey(fileName)) |
90 | { | 90 | { |
91 | NewFiles[fileName] = data; | 91 | NewFiles[fileName] = data; |
92 | } | 92 | } |
93 | else | 93 | else |
94 | { | 94 | { |
95 | NewFiles.Add(fileName, data); | 95 | NewFiles.Add(fileName, data); |
96 | } | 96 | } |
97 | } | 97 | } |
98 | return true; | 98 | return true; |
99 | } | 99 | } |
100 | 100 | ||
101 | 101 | ||
102 | public class XferDownLoad | 102 | public class XferDownLoad |
103 | { | 103 | { |
104 | public byte[] Data = new byte[0]; | 104 | public byte[] Data = new byte[0]; |
105 | public string FileName = ""; | 105 | public string FileName = ""; |
106 | public ulong XferID = 0; | 106 | public ulong XferID = 0; |
107 | public int DataPointer = 0; | 107 | public int DataPointer = 0; |
108 | public uint Packet = 0; | 108 | public uint Packet = 0; |
109 | public IClientAPI Client; | 109 | public IClientAPI Client; |
110 | public uint Serial = 1; | 110 | public uint Serial = 1; |
111 | private bool complete = false; | 111 | private bool complete = false; |
112 | 112 | ||
113 | public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client) | 113 | public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client) |
114 | { | 114 | { |
115 | FileName = fileName; | 115 | FileName = fileName; |
116 | Data = data; | 116 | Data = data; |
117 | XferID = xferID; | 117 | XferID = xferID; |
118 | Client = client; | 118 | Client = client; |
119 | } | 119 | } |
120 | 120 | ||
121 | public XferDownLoad() | 121 | public XferDownLoad() |
122 | { | 122 | { |
123 | } | 123 | } |
124 | 124 | ||
125 | public void StartSend() | 125 | public void StartSend() |
126 | { | 126 | { |
127 | if (Data.Length < 1000) | 127 | if (Data.Length < 1000) |
128 | { | 128 | { |
129 | // for now (testing ) we only support files under 1000 bytes | 129 | // for now (testing ) we only support files under 1000 bytes |
130 | byte[] transferData = new byte[Data.Length + 4]; | 130 | byte[] transferData = new byte[Data.Length + 4]; |
131 | Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); | 131 | Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); |
132 | Array.Copy(Data, 0, transferData, 4, Data.Length); | 132 | Array.Copy(Data, 0, transferData, 4, Data.Length); |
133 | Client.SendXferPacket(XferID, 0 + 0x80000000, transferData); | 133 | Client.SendXferPacket(XferID, 0 + 0x80000000, transferData); |
134 | complete = true; | 134 | complete = true; |
135 | } | 135 | } |
136 | else | 136 | else |
137 | { | 137 | { |
138 | byte[] transferData = new byte[1000 + 4]; | 138 | byte[] transferData = new byte[1000 + 4]; |
139 | Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); | 139 | Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); |
140 | Array.Copy(Data, 0, transferData, 4, 1000); | 140 | Array.Copy(Data, 0, transferData, 4, 1000); |
141 | Client.SendXferPacket(XferID, 0, transferData); | 141 | Client.SendXferPacket(XferID, 0, transferData); |
142 | Packet++; | 142 | Packet++; |
143 | DataPointer = 1000; | 143 | DataPointer = 1000; |
144 | } | 144 | } |
145 | } | 145 | } |
146 | 146 | ||
147 | public void AckPacket(uint packet) | 147 | public void AckPacket(uint packet) |
148 | { | 148 | { |
149 | if (!complete) | 149 | if (!complete) |
150 | { | 150 | { |
151 | if ((Data.Length - DataPointer) > 1000) | 151 | if ((Data.Length - DataPointer) > 1000) |
152 | { | 152 | { |
153 | byte[] transferData = new byte[1000]; | 153 | byte[] transferData = new byte[1000]; |
154 | Array.Copy(Data, DataPointer, transferData, 0, 1000); | 154 | Array.Copy(Data, DataPointer, transferData, 0, 1000); |
155 | Client.SendXferPacket(XferID, Packet, transferData); | 155 | Client.SendXferPacket(XferID, Packet, transferData); |
156 | Packet++; | 156 | Packet++; |
157 | DataPointer += 1000; | 157 | DataPointer += 1000; |
158 | } | 158 | } |
159 | else | 159 | else |
160 | { | 160 | { |
161 | byte[] transferData = new byte[Data.Length - DataPointer]; | 161 | byte[] transferData = new byte[Data.Length - DataPointer]; |
162 | Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer); | 162 | Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer); |
163 | uint endPacket = Packet |= (uint) 0x80000000; | 163 | uint endPacket = Packet |= (uint) 0x80000000; |
164 | Client.SendXferPacket(XferID, endPacket, transferData); | 164 | Client.SendXferPacket(XferID, endPacket, transferData); |
165 | Packet++; | 165 | Packet++; |
166 | DataPointer += (Data.Length - DataPointer); | 166 | DataPointer += (Data.Length - DataPointer); |
167 | complete = true; | 167 | complete = true; |
168 | } | 168 | } |
169 | } | 169 | } |
170 | } | 170 | } |
171 | } | 171 | } |
172 | } | 172 | } |
173 | } \ No newline at end of file | 173 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 288cbee..384ec10 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1337,9 +1337,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1337 | MainLog.Instance.Error("The currently loaded modules in " + RegionInfo.RegionName + " are:"); | 1337 | MainLog.Instance.Error("The currently loaded modules in " + RegionInfo.RegionName + " are:"); |
1338 | foreach (IRegionModule module in Modules.Values) | 1338 | foreach (IRegionModule module in Modules.Values) |
1339 | { | 1339 | { |
1340 | if (!module.IsSharedModule()) | 1340 | if (!module.IsSharedModule) |
1341 | { | 1341 | { |
1342 | MainLog.Instance.Error("Region Module: " + module.GetName()); | 1342 | MainLog.Instance.Error("Region Module: " + module.Name); |
1343 | } | 1343 | } |
1344 | } | 1344 | } |
1345 | break; | 1345 | break; |
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index e05ce87..b8517f7 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs | |||
@@ -62,13 +62,15 @@ namespace SimpleApp | |||
62 | 62 | ||
63 | UDPServer udpServer; | 63 | UDPServer udpServer; |
64 | 64 | ||
65 | m_moduleLoader = new ModuleLoader(); | 65 | m_moduleLoader = new ModuleLoader( m_log ); |
66 | m_moduleLoader.LoadDefaultSharedModules(""); | 66 | m_moduleLoader.LoadDefaultSharedModules(""); |
67 | 67 | ||
68 | Scene scene = SetupScene(regionInfo, out udpServer); | 68 | Scene scene = SetupScene(regionInfo, out udpServer); |
69 | 69 | ||
70 | m_moduleLoader.InitialiseSharedModules(scene); | 70 | m_moduleLoader.InitialiseSharedModules(scene); |
71 | m_moduleLoader.CreateDefaultModules(scene, ""); | 71 | |
72 | // m_moduleLoader.CreateDefaultModules(scene, ""); | ||
73 | |||
72 | scene.SetModuleInterfaces(); | 74 | scene.SetModuleInterfaces(); |
73 | 75 | ||
74 | scene.StartTimer(); | 76 | scene.StartTimer(); |
@@ -131,7 +133,7 @@ namespace SimpleApp | |||
131 | 133 | ||
132 | protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager) | 134 | protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager) |
133 | { | 135 | { |
134 | return new MyWorld(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer, new ModuleLoader()); | 136 | return new MyWorld(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer, new ModuleLoader( m_log )); |
135 | } | 137 | } |
136 | 138 | ||
137 | protected override StorageManager CreateStorageManager(RegionInfo regionInfo) | 139 | protected override StorageManager CreateStorageManager(RegionInfo regionInfo) |
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs index 61e9114..a818155 100644 --- a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs +++ b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs | |||
@@ -1,148 +1,148 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using OpenSim.Framework.Console; | 29 | using OpenSim.Framework.Console; |
30 | using OpenSim.Region.Environment.Interfaces; | 30 | using OpenSim.Region.Environment.Interfaces; |
31 | using OpenSim.Region.Environment.Scenes; | 31 | using OpenSim.Region.Environment.Scenes; |
32 | using OpenSim.Region.ExtensionsScriptModule.CSharp; | 32 | using OpenSim.Region.ExtensionsScriptModule.CSharp; |
33 | using OpenSim.Region.ExtensionsScriptModule.JScript; | 33 | using OpenSim.Region.ExtensionsScriptModule.JScript; |
34 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine; | 34 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine; |
35 | 35 | ||
36 | namespace OpenSim.Region.ExtensionsScriptModule | 36 | namespace OpenSim.Region.ExtensionsScriptModule |
37 | { | 37 | { |
38 | public class ScriptManager : IRegionModule, IExtensionScriptModule | 38 | public class ScriptManager : IRegionModule, IExtensionScriptModule |
39 | { | 39 | { |
40 | readonly List<IScript> scripts = new List<IScript>(); | 40 | readonly List<IScript> scripts = new List<IScript>(); |
41 | Scene m_scene; | 41 | Scene m_scene; |
42 | readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>(); | 42 | readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>(); |
43 | 43 | ||
44 | private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts) | 44 | private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts) |
45 | { | 45 | { |
46 | foreach (KeyValuePair<string, IScript> script in compiledscripts) | 46 | foreach (KeyValuePair<string, IScript> script in compiledscripts) |
47 | { | 47 | { |
48 | ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. | 48 | ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. |
49 | MainLog.Instance.Verbose("Loading " + script.Key); | 49 | MainLog.Instance.Verbose("Loading " + script.Key); |
50 | script.Value.Initialise(scriptInfo); | 50 | script.Value.Initialise(scriptInfo); |
51 | scripts.Add(script.Value); | 51 | scripts.Add(script.Value); |
52 | } | 52 | } |
53 | 53 | ||
54 | MainLog.Instance.Verbose(string.Format("Finished loading {0} script(s)", compiledscripts.Count)); | 54 | MainLog.Instance.Verbose(string.Format("Finished loading {0} script(s)", compiledscripts.Count)); |
55 | } | 55 | } |
56 | 56 | ||
57 | public ScriptManager() | 57 | public ScriptManager() |
58 | { | 58 | { |
59 | // Default Engines | 59 | // Default Engines |
60 | CSharpScriptEngine csharpCompiler = new CSharpScriptEngine(); | 60 | CSharpScriptEngine csharpCompiler = new CSharpScriptEngine(); |
61 | compilers.Add(csharpCompiler.FileExt(), csharpCompiler); | 61 | compilers.Add(csharpCompiler.FileExt(), csharpCompiler); |
62 | 62 | ||
63 | JScriptEngine jscriptCompiler = new JScriptEngine(); | 63 | JScriptEngine jscriptCompiler = new JScriptEngine(); |
64 | compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); | 64 | compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); |
65 | 65 | ||
66 | JavaEngine javaCompiler = new JavaEngine(); | 66 | JavaEngine javaCompiler = new JavaEngine(); |
67 | compilers.Add(javaCompiler.FileExt(), javaCompiler); | 67 | compilers.Add(javaCompiler.FileExt(), javaCompiler); |
68 | } | 68 | } |
69 | 69 | ||
70 | public void Initialise(Scene scene) | 70 | public void Initialise(Scene scene) |
71 | { | 71 | { |
72 | System.Console.WriteLine("Initialising Extensions Scripting Module"); | 72 | System.Console.WriteLine("Initialising Extensions Scripting Module"); |
73 | m_scene = scene; | 73 | m_scene = scene; |
74 | 74 | ||
75 | m_scene.RegisterModuleInterface<IExtensionScriptModule>(this); | 75 | m_scene.RegisterModuleInterface<IExtensionScriptModule>(this); |
76 | } | 76 | } |
77 | 77 | ||
78 | public void PostInitialise() | 78 | public void PostInitialise() |
79 | { | 79 | { |
80 | 80 | ||
81 | } | 81 | } |
82 | 82 | ||
83 | public void CloseDown() | 83 | public void Close() |
84 | { | 84 | { |
85 | 85 | ||
86 | } | 86 | } |
87 | 87 | ||
88 | public string GetName() | 88 | public string Name |
89 | { | 89 | { |
90 | return "ExtensionsScriptingModule"; | 90 | get { return "ExtensionsScriptingModule"; } |
91 | } | 91 | } |
92 | 92 | ||
93 | public bool IsSharedModule() | 93 | public bool IsSharedModule |
94 | { | 94 | { |
95 | return false; | 95 | get { return false; } |
96 | } | 96 | } |
97 | 97 | ||
98 | public bool Compile(string filename) | 98 | public bool Compile(string filename) |
99 | { | 99 | { |
100 | foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers) | 100 | foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers) |
101 | { | 101 | { |
102 | if (filename.EndsWith(compiler.Key)) | 102 | if (filename.EndsWith(compiler.Key)) |
103 | { | 103 | { |
104 | LoadFromCompiler(compiler.Value.compile(filename)); | 104 | LoadFromCompiler(compiler.Value.compile(filename)); |
105 | break; | 105 | break; |
106 | } | 106 | } |
107 | } | 107 | } |
108 | 108 | ||
109 | return true; | 109 | return true; |
110 | } | 110 | } |
111 | 111 | ||
112 | public void RunScriptCmd(string[] args) | 112 | public void RunScriptCmd(string[] args) |
113 | { | 113 | { |
114 | switch (args[0]) | 114 | switch (args[0]) |
115 | { | 115 | { |
116 | case "load": | 116 | case "load": |
117 | Compile(args[1]); | 117 | Compile(args[1]); |
118 | break; | 118 | break; |
119 | 119 | ||
120 | default: | 120 | default: |
121 | MainLog.Instance.Error("Unknown script command"); | 121 | MainLog.Instance.Error("Unknown script command"); |
122 | break; | 122 | break; |
123 | } | 123 | } |
124 | } | 124 | } |
125 | 125 | ||
126 | public bool AddPreCompiledScript(IScript script) | 126 | public bool AddPreCompiledScript(IScript script) |
127 | { | 127 | { |
128 | MainLog.Instance.Verbose("Loading script " + script.Name); | 128 | MainLog.Instance.Verbose("Loading script " + script.Name); |
129 | ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. | 129 | ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. |
130 | script.Initialise(scriptInfo); | 130 | script.Initialise(scriptInfo); |
131 | scripts.Add(script); | 131 | scripts.Add(script); |
132 | 132 | ||
133 | return true; | 133 | return true; |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | public interface IExtensionScriptModule | 137 | public interface IExtensionScriptModule |
138 | { | 138 | { |
139 | bool Compile(string filename); | 139 | bool Compile(string filename); |
140 | bool AddPreCompiledScript(IScript script); | 140 | bool AddPreCompiledScript(IScript script); |
141 | } | 141 | } |
142 | 142 | ||
143 | interface IScriptCompiler | 143 | interface IScriptCompiler |
144 | { | 144 | { |
145 | Dictionary<string, IScript> compile(string filename); | 145 | Dictionary<string, IScript> compile(string filename); |
146 | string FileExt(); | 146 | string FileExt(); |
147 | } | 147 | } |
148 | } | 148 | } |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs index c57e56a..d89a8ad 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs | |||
@@ -1,132 +1,132 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | 31 | using System.Text; |
32 | using OpenSim.Framework.Console; | 32 | using OpenSim.Framework.Console; |
33 | using OpenSim.Region.Environment.Scenes; | 33 | using OpenSim.Region.Environment.Scenes; |
34 | using OpenSim.Region.Environment.Scenes.Scripting; | 34 | using OpenSim.Region.Environment.Scenes.Scripting; |
35 | using OpenSim.Region.Environment.Interfaces; | 35 | using OpenSim.Region.Environment.Interfaces; |
36 | using libsecondlife; | 36 | using libsecondlife; |
37 | 37 | ||
38 | namespace OpenSim.Region.ScriptEngine.DotNetEngine | 38 | namespace OpenSim.Region.ScriptEngine.DotNetEngine |
39 | { | 39 | { |
40 | /// <summary> | 40 | /// <summary> |
41 | /// This is the root object for ScriptEngine | 41 | /// This is the root object for ScriptEngine |
42 | /// </summary> | 42 | /// </summary> |
43 | [Serializable] | 43 | [Serializable] |
44 | public class ScriptEngine :IRegionModule | 44 | public class ScriptEngine :IRegionModule |
45 | { | 45 | { |
46 | 46 | ||
47 | internal OpenSim.Region.Environment.Scenes.Scene World; | 47 | internal OpenSim.Region.Environment.Scenes.Scene World; |
48 | internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim | 48 | internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim |
49 | internal EventQueueManager m_EventQueueManager; // Executes events | 49 | internal EventQueueManager m_EventQueueManager; // Executes events |
50 | internal ScriptManager m_ScriptManager; // Load, unload and execute scripts | 50 | internal ScriptManager m_ScriptManager; // Load, unload and execute scripts |
51 | internal AppDomainManager m_AppDomainManager; | 51 | internal AppDomainManager m_AppDomainManager; |
52 | internal LSLLongCmdHandler m_LSLLongCmdHandler; | 52 | internal LSLLongCmdHandler m_LSLLongCmdHandler; |
53 | 53 | ||
54 | private OpenSim.Framework.Console.LogBase m_log; | 54 | private OpenSim.Framework.Console.LogBase m_log; |
55 | 55 | ||
56 | public ScriptEngine() | 56 | public ScriptEngine() |
57 | { | 57 | { |
58 | //Common.SendToDebug("ScriptEngine Object Initialized"); | 58 | //Common.SendToDebug("ScriptEngine Object Initialized"); |
59 | Common.mySE = this; | 59 | Common.mySE = this; |
60 | } | 60 | } |
61 | 61 | ||
62 | public LogBase Log | 62 | public LogBase Log |
63 | { | 63 | { |
64 | get { return m_log; } | 64 | get { return m_log; } |
65 | } | 65 | } |
66 | 66 | ||
67 | public void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger) | 67 | public void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger) |
68 | { | 68 | { |
69 | 69 | ||
70 | World = Sceneworld; | 70 | World = Sceneworld; |
71 | m_log = logger; | 71 | m_log = logger; |
72 | 72 | ||
73 | Log.Verbose("ScriptEngine", "DotNet & LSL ScriptEngine initializing"); | 73 | Log.Verbose("ScriptEngine", "DotNet & LSL ScriptEngine initializing"); |
74 | 74 | ||
75 | //m_logger.Status("ScriptEngine", "InitializeEngine"); | 75 | //m_logger.Status("ScriptEngine", "InitializeEngine"); |
76 | 76 | ||
77 | // Create all objects we'll be using | 77 | // Create all objects we'll be using |
78 | m_EventQueueManager = new EventQueueManager(this); | 78 | m_EventQueueManager = new EventQueueManager(this); |
79 | m_EventManager = new EventManager(this); | 79 | m_EventManager = new EventManager(this); |
80 | m_ScriptManager = new ScriptManager(this); | 80 | m_ScriptManager = new ScriptManager(this); |
81 | m_AppDomainManager = new AppDomainManager(); | 81 | m_AppDomainManager = new AppDomainManager(); |
82 | m_LSLLongCmdHandler = new LSLLongCmdHandler(this); | 82 | m_LSLLongCmdHandler = new LSLLongCmdHandler(this); |
83 | 83 | ||
84 | // Should we iterate the region for scripts that needs starting? | 84 | // Should we iterate the region for scripts that needs starting? |
85 | // Or can we assume we are loaded before anything else so we can use proper events? | 85 | // Or can we assume we are loaded before anything else so we can use proper events? |
86 | 86 | ||
87 | 87 | ||
88 | } | 88 | } |
89 | 89 | ||
90 | public void Shutdown() | 90 | public void Shutdown() |
91 | { | 91 | { |
92 | // We are shutting down | 92 | // We are shutting down |
93 | } | 93 | } |
94 | 94 | ||
95 | //// !!!FOR DEBUGGING ONLY!!! (for executing script directly from test app) | 95 | //// !!!FOR DEBUGGING ONLY!!! (for executing script directly from test app) |
96 | //[Obsolete("!!!FOR DEBUGGING ONLY!!!")] | 96 | //[Obsolete("!!!FOR DEBUGGING ONLY!!!")] |
97 | //public void StartScript(string ScriptID, IScriptHost ObjectID) | 97 | //public void StartScript(string ScriptID, IScriptHost ObjectID) |
98 | //{ | 98 | //{ |
99 | // this.myEventManager.TEMP_OBJECT_ID = ObjectID; | 99 | // this.myEventManager.TEMP_OBJECT_ID = ObjectID; |
100 | // Log.Status("ScriptEngine", "DEBUG FUNCTION: StartScript: " + ScriptID); | 100 | // Log.Status("ScriptEngine", "DEBUG FUNCTION: StartScript: " + ScriptID); |
101 | // myScriptManager.StartScript(ScriptID, ObjectID); | 101 | // myScriptManager.StartScript(ScriptID, ObjectID); |
102 | //} | 102 | //} |
103 | 103 | ||
104 | #region IRegionModule | 104 | #region IRegionModule |
105 | 105 | ||
106 | public void Initialise(Scene scene) | 106 | public void Initialise(Scene scene) |
107 | { | 107 | { |
108 | this.InitializeEngine(scene, MainLog.Instance); | 108 | this.InitializeEngine(scene, MainLog.Instance); |
109 | } | 109 | } |
110 | 110 | ||
111 | public void PostInitialise() | 111 | public void PostInitialise() |
112 | { | 112 | { |
113 | 113 | ||
114 | } | 114 | } |
115 | 115 | ||
116 | public void CloseDown() | 116 | public void Close() |
117 | { | 117 | { |
118 | } | 118 | } |
119 | 119 | ||
120 | public string GetName() | 120 | public string Name |
121 | { | 121 | { |
122 | return "LSLScriptingModule"; | 122 | get { return "LSLScriptingModule"; } |
123 | } | 123 | } |
124 | 124 | ||
125 | public bool IsSharedModule() | 125 | public bool IsSharedModule |
126 | { | 126 | { |
127 | return false; | 127 | get { return false; } |
128 | } | 128 | } |
129 | 129 | ||
130 | #endregion | 130 | #endregion |
131 | } | 131 | } |
132 | } | 132 | } |