diff options
author | Adam Frisby | 2008-05-01 16:35:00 +0000 |
---|---|---|
committer | Adam Frisby | 2008-05-01 16:35:00 +0000 |
commit | 13526097f24b7a8ad63b1d482c44b44397fa055f (patch) | |
tree | 7a82c20ed7c63e2aea5ad3863325e37f64e1cbea /OpenSim/Region/Environment/Modules/Scripting | |
parent | * Breaking all the code, breaking all the code..! (diff) | |
download | opensim-SC_OLD-13526097f24b7a8ad63b1d482c44b44397fa055f.zip opensim-SC_OLD-13526097f24b7a8ad63b1d482c44b44397fa055f.tar.gz opensim-SC_OLD-13526097f24b7a8ad63b1d482c44b44397fa055f.tar.bz2 opensim-SC_OLD-13526097f24b7a8ad63b1d482c44b44397fa055f.tar.xz |
* Spring cleaning on Region.Environment.
* Converted a large number of read-only fields to be actually, readonly.
* Reformatted code sections.
* Removed redundant code.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Scripting')
6 files changed, 28 insertions, 40 deletions
diff --git a/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs index c0e3d3b..d926714 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs | |||
@@ -40,12 +40,12 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture | |||
40 | { | 40 | { |
41 | public class DynamicTextureModule : IRegionModule, IDynamicTextureManager | 41 | public class DynamicTextureModule : IRegionModule, IDynamicTextureManager |
42 | { | 42 | { |
43 | private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); | 43 | private readonly Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); |
44 | 44 | ||
45 | private Dictionary<string, IDynamicTextureRender> RenderPlugins = | 45 | private readonly Dictionary<string, IDynamicTextureRender> RenderPlugins = |
46 | new Dictionary<string, IDynamicTextureRender>(); | 46 | new Dictionary<string, IDynamicTextureRender>(); |
47 | 47 | ||
48 | private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>(); | 48 | private readonly Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>(); |
49 | 49 | ||
50 | #region IDynamicTextureManager Members | 50 | #region IDynamicTextureManager Members |
51 | 51 | ||
@@ -176,14 +176,14 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture | |||
176 | 176 | ||
177 | public class DynamicTextureUpdater | 177 | public class DynamicTextureUpdater |
178 | { | 178 | { |
179 | public bool BlendWithOldTexture = false; | 179 | public bool BlendWithOldTexture; |
180 | public string BodyData; | 180 | public string BodyData; |
181 | public string ContentType; | 181 | public string ContentType; |
182 | public byte FrontAlpha = 255; | 182 | public byte FrontAlpha = 255; |
183 | public LLUUID LastAssetID; | 183 | public LLUUID LastAssetID; |
184 | public string Params; | 184 | public string Params; |
185 | public LLUUID PrimID; | 185 | public LLUUID PrimID; |
186 | public bool SetNewFrontAlpha = false; | 186 | public bool SetNewFrontAlpha; |
187 | public LLUUID SimUUID; | 187 | public LLUUID SimUUID; |
188 | public LLUUID UpdaterID; | 188 | public LLUUID UpdaterID; |
189 | public int UpdateTimer; | 189 | public int UpdateTimer; |
diff --git a/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs index e1339a3..4bde33b 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs | |||
@@ -84,7 +84,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | |||
84 | { | 84 | { |
85 | public class HttpRequestModule : IRegionModule, IHttpRequests | 85 | public class HttpRequestModule : IRegionModule, IHttpRequests |
86 | { | 86 | { |
87 | private object HttpListLock = new object(); | 87 | private readonly object HttpListLock = new object(); |
88 | private int httpTimeout = 30000; | 88 | private int httpTimeout = 30000; |
89 | private string m_name = "HttpScriptRequests"; | 89 | private string m_name = "HttpScriptRequests"; |
90 | 90 | ||
@@ -93,10 +93,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | |||
93 | private Scene m_scene; | 93 | private Scene m_scene; |
94 | private Queue<HttpRequestClass> rpcQueue = new Queue<HttpRequestClass>(); | 94 | private Queue<HttpRequestClass> rpcQueue = new Queue<HttpRequestClass>(); |
95 | 95 | ||
96 | public HttpRequestModule() | ||
97 | { | ||
98 | } | ||
99 | |||
100 | #region IHttpRequests Members | 96 | #region IHttpRequests Members |
101 | 97 | ||
102 | public LLUUID MakeHttpRequest(string url, string parameters, string body) | 98 | public LLUUID MakeHttpRequest(string url, string parameters, string body) |
diff --git a/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs index c828ef0..f39f16d 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs | |||
@@ -120,9 +120,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL | |||
120 | 120 | ||
121 | private void MakeHttpRequest(string url, LLUUID requestID) | 121 | private void MakeHttpRequest(string url, LLUUID requestID) |
122 | { | 122 | { |
123 | WebRequest request = HttpWebRequest.Create(url); | 123 | WebRequest request = WebRequest.Create(url); |
124 | RequestState state = new RequestState((HttpWebRequest) request, requestID); | 124 | RequestState state = new RequestState((HttpWebRequest) request, requestID); |
125 | IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state); | 125 | IAsyncResult result = request.BeginGetResponse(HttpRequestReturn, state); |
126 | 126 | ||
127 | TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); | 127 | TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); |
128 | state.TimeOfRequest = (int) t.TotalSeconds; | 128 | state.TimeOfRequest = (int) t.TotalSeconds; |
@@ -131,7 +131,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL | |||
131 | private void HttpRequestReturn(IAsyncResult result) | 131 | private void HttpRequestReturn(IAsyncResult result) |
132 | { | 132 | { |
133 | RequestState state = (RequestState) result.AsyncState; | 133 | RequestState state = (RequestState) result.AsyncState; |
134 | WebRequest request = (WebRequest) state.Request; | 134 | WebRequest request = state.Request; |
135 | HttpWebResponse response = (HttpWebResponse) request.EndGetResponse(result); | 135 | HttpWebResponse response = (HttpWebResponse) request.EndGetResponse(result); |
136 | if (response.StatusCode == HttpStatusCode.OK) | 136 | if (response.StatusCode == HttpStatusCode.OK) |
137 | { | 137 | { |
@@ -175,9 +175,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL | |||
175 | 175 | ||
176 | public class RequestState | 176 | public class RequestState |
177 | { | 177 | { |
178 | public HttpWebRequest Request = null; | 178 | public HttpWebRequest Request; |
179 | public LLUUID RequestID = LLUUID.Zero; | 179 | public LLUUID RequestID = LLUUID.Zero; |
180 | public int TimeOfRequest = 0; | 180 | public int TimeOfRequest; |
181 | 181 | ||
182 | public RequestState(HttpWebRequest request, LLUUID requestID) | 182 | public RequestState(HttpWebRequest request, LLUUID requestID) |
183 | { | 183 | { |
diff --git a/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs index 626c60f..8e434c7 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs | |||
@@ -48,10 +48,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender | |||
48 | private Scene m_scene; | 48 | private Scene m_scene; |
49 | private IDynamicTextureManager m_textureManager; | 49 | private IDynamicTextureManager m_textureManager; |
50 | 50 | ||
51 | public VectorRenderModule() | ||
52 | { | ||
53 | } | ||
54 | |||
55 | #region IDynamicTextureRender Members | 51 | #region IDynamicTextureRender Members |
56 | 52 | ||
57 | public string GetContentType() | 53 | public string GetContentType() |
@@ -138,7 +134,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender | |||
138 | catch (Exception e) | 134 | catch (Exception e) |
139 | { | 135 | { |
140 | //Ckrinke: Add a WriteLine to remove the warning about 'e' defined but not used | 136 | //Ckrinke: Add a WriteLine to remove the warning about 'e' defined but not used |
141 | Console.WriteLine("Problem with Draw. Please verify parameters." + e.ToString()); | 137 | Console.WriteLine("Problem with Draw. Please verify parameters." + e); |
142 | } | 138 | } |
143 | 139 | ||
144 | if ((size < 128) || (size > 1024)) | 140 | if ((size < 128) || (size > 1024)) |
@@ -260,7 +256,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender | |||
260 | endPoint.X = (int) x; | 256 | endPoint.X = (int) x; |
261 | endPoint.Y = (int) y; | 257 | endPoint.Y = (int) y; |
262 | Image image = ImageHttpRequest(nextLine); | 258 | Image image = ImageHttpRequest(nextLine); |
263 | graph.DrawImage(image, (float) startPoint.X, (float) startPoint.Y, x, y); | 259 | graph.DrawImage(image, startPoint.X, startPoint.Y, x, y); |
264 | startPoint.X += endPoint.X; | 260 | startPoint.X += endPoint.X; |
265 | startPoint.Y += endPoint.Y; | 261 | startPoint.Y += endPoint.Y; |
266 | } | 262 | } |
@@ -353,7 +349,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender | |||
353 | 349 | ||
354 | private Bitmap ImageHttpRequest(string url) | 350 | private Bitmap ImageHttpRequest(string url) |
355 | { | 351 | { |
356 | WebRequest request = HttpWebRequest.Create(url); | 352 | WebRequest request = WebRequest.Create(url); |
357 | //Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used. | 353 | //Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used. |
358 | //Ckrinke Stream str = null; | 354 | //Ckrinke Stream str = null; |
359 | HttpWebResponse response = (HttpWebResponse) (request).GetResponse(); | 355 | HttpWebResponse response = (HttpWebResponse) (request).GetResponse(); |
diff --git a/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs index e79b2bd..c4c1718 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs | |||
@@ -75,10 +75,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm | |||
75 | private Queue m_pendingQ; | 75 | private Queue m_pendingQ; |
76 | private Scene m_scene; | 76 | private Scene m_scene; |
77 | 77 | ||
78 | public WorldCommModule() | ||
79 | { | ||
80 | } | ||
81 | |||
82 | #region IRegionModule Members | 78 | #region IRegionModule Members |
83 | 79 | ||
84 | public void Initialise(Scene scene, IConfigSource config) | 80 | public void Initialise(Scene scene, IConfigSource config) |
@@ -324,8 +320,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm | |||
324 | public class ListenerManager | 320 | public class ListenerManager |
325 | { | 321 | { |
326 | //private Dictionary<int, ListenerInfo> m_listeners; | 322 | //private Dictionary<int, ListenerInfo> m_listeners; |
323 | private readonly Hashtable m_listeners = Hashtable.Synchronized(new Hashtable()); | ||
327 | private object ListenersLock = new object(); | 324 | private object ListenersLock = new object(); |
328 | private Hashtable m_listeners = Hashtable.Synchronized(new Hashtable()); | ||
329 | private int m_MaxListeners = 100; | 325 | private int m_MaxListeners = 100; |
330 | 326 | ||
331 | public int AddListener(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg) | 327 | public int AddListener(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg) |
@@ -485,6 +481,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm | |||
485 | 481 | ||
486 | public class ListenerInfo | 482 | public class ListenerInfo |
487 | { | 483 | { |
484 | private readonly LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message | ||
488 | private bool m_active; // Listener is active or not | 485 | private bool m_active; // Listener is active or not |
489 | private int m_channel; // Channel | 486 | private int m_channel; // Channel |
490 | private int m_handle; // Assigned handle of this listener | 487 | private int m_handle; // Assigned handle of this listener |
@@ -494,7 +491,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm | |||
494 | private uint m_localID; // Local ID from script engine | 491 | private uint m_localID; // Local ID from script engine |
495 | private string m_message; // The message | 492 | private string m_message; // The message |
496 | private string m_name; // Object name to filter messages from | 493 | private string m_name; // Object name to filter messages from |
497 | private LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message | ||
498 | 494 | ||
499 | public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message) | 495 | public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message) |
500 | { | 496 | { |
diff --git a/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs index a039d42..4f6808e 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs | |||
@@ -78,20 +78,20 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC | |||
78 | public class XMLRPCModule : IRegionModule, IXMLRPC | 78 | public class XMLRPCModule : IRegionModule, IXMLRPC |
79 | { | 79 | { |
80 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 80 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
81 | private readonly List<Scene> m_scenes = new List<Scene>(); | ||
82 | private readonly object XMLRPCListLock = new object(); | ||
81 | 83 | ||
82 | private string m_name = "XMLRPCModule"; | 84 | private string m_name = "XMLRPCModule"; |
83 | 85 | ||
84 | // <channel id, RPCChannelInfo> | 86 | // <channel id, RPCChannelInfo> |
85 | private Dictionary<LLUUID, RPCChannelInfo> m_openChannels; | 87 | private Dictionary<LLUUID, RPCChannelInfo> m_openChannels; |
86 | private Dictionary<LLUUID, SendRemoteDataRequest> m_pendingSRDResponses; | 88 | private Dictionary<LLUUID, SendRemoteDataRequest> m_pendingSRDResponses; |
87 | private int m_remoteDataPort = 0; | 89 | private int m_remoteDataPort; |
88 | 90 | ||
89 | private Dictionary<LLUUID, RPCRequestInfo> m_rpcPending; | 91 | private Dictionary<LLUUID, RPCRequestInfo> m_rpcPending; |
90 | private Dictionary<LLUUID, RPCRequestInfo> m_rpcPendingResponses; | 92 | private Dictionary<LLUUID, RPCRequestInfo> m_rpcPendingResponses; |
91 | private List<Scene> m_scenes = new List<Scene>(); | ||
92 | private int RemoteReplyScriptTimeout = 9000; | 93 | private int RemoteReplyScriptTimeout = 9000; |
93 | private int RemoteReplyScriptWait = 300; | 94 | private int RemoteReplyScriptWait = 300; |
94 | private object XMLRPCListLock = new object(); | ||
95 | 95 | ||
96 | #region IRegionModule Members | 96 | #region IRegionModule Members |
97 | 97 | ||
@@ -428,15 +428,15 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC | |||
428 | 428 | ||
429 | public class RPCRequestInfo | 429 | public class RPCRequestInfo |
430 | { | 430 | { |
431 | private LLUUID m_ChannelKey; | 431 | private readonly LLUUID m_ChannelKey; |
432 | private string m_IntVal; | 432 | private readonly string m_IntVal; |
433 | private LLUUID m_ItemID; | 433 | private readonly LLUUID m_ItemID; |
434 | private uint m_localID; | 434 | private readonly uint m_localID; |
435 | private LLUUID m_MessageID; | 435 | private readonly LLUUID m_MessageID; |
436 | private readonly string m_StrVal; | ||
436 | private bool m_processed; | 437 | private bool m_processed; |
437 | private int m_respInt; | 438 | private int m_respInt; |
438 | private string m_respStr; | 439 | private string m_respStr; |
439 | private string m_StrVal; | ||
440 | 440 | ||
441 | public RPCRequestInfo(uint localID, LLUUID itemID, LLUUID channelKey, string strVal, string intVal) | 441 | public RPCRequestInfo(uint localID, LLUUID itemID, LLUUID channelKey, string strVal, string intVal) |
442 | { | 442 | { |
@@ -514,9 +514,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC | |||
514 | 514 | ||
515 | public class RPCChannelInfo | 515 | public class RPCChannelInfo |
516 | { | 516 | { |
517 | private LLUUID m_ChannelKey; | 517 | private readonly LLUUID m_ChannelKey; |
518 | private LLUUID m_itemID; | 518 | private readonly LLUUID m_itemID; |
519 | private uint m_localID; | 519 | private readonly uint m_localID; |
520 | 520 | ||
521 | public RPCChannelInfo(uint localID, LLUUID itemID, LLUUID channelID) | 521 | public RPCChannelInfo(uint localID, LLUUID itemID, LLUUID channelID) |
522 | { | 522 | { |