mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 00:46:02 +08:00
* Spring cleaning on Region.Environment.
* Converted a large number of read-only fields to be actually, readonly. * Reformatted code sections. * Removed redundant code.
This commit is contained in:
@@ -40,12 +40,12 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
|
||||
{
|
||||
public class DynamicTextureModule : IRegionModule, IDynamicTextureManager
|
||||
{
|
||||
private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
|
||||
private readonly Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
|
||||
|
||||
private Dictionary<string, IDynamicTextureRender> RenderPlugins =
|
||||
private readonly Dictionary<string, IDynamicTextureRender> RenderPlugins =
|
||||
new Dictionary<string, IDynamicTextureRender>();
|
||||
|
||||
private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>();
|
||||
private readonly Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>();
|
||||
|
||||
#region IDynamicTextureManager Members
|
||||
|
||||
@@ -176,14 +176,14 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
|
||||
|
||||
public class DynamicTextureUpdater
|
||||
{
|
||||
public bool BlendWithOldTexture = false;
|
||||
public bool BlendWithOldTexture;
|
||||
public string BodyData;
|
||||
public string ContentType;
|
||||
public byte FrontAlpha = 255;
|
||||
public LLUUID LastAssetID;
|
||||
public string Params;
|
||||
public LLUUID PrimID;
|
||||
public bool SetNewFrontAlpha = false;
|
||||
public bool SetNewFrontAlpha;
|
||||
public LLUUID SimUUID;
|
||||
public LLUUID UpdaterID;
|
||||
public int UpdateTimer;
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
|
||||
{
|
||||
public class HttpRequestModule : IRegionModule, IHttpRequests
|
||||
{
|
||||
private object HttpListLock = new object();
|
||||
private readonly object HttpListLock = new object();
|
||||
private int httpTimeout = 30000;
|
||||
private string m_name = "HttpScriptRequests";
|
||||
|
||||
@@ -93,10 +93,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
|
||||
private Scene m_scene;
|
||||
private Queue<HttpRequestClass> rpcQueue = new Queue<HttpRequestClass>();
|
||||
|
||||
public HttpRequestModule()
|
||||
{
|
||||
}
|
||||
|
||||
#region IHttpRequests Members
|
||||
|
||||
public LLUUID MakeHttpRequest(string url, string parameters, string body)
|
||||
|
||||
@@ -120,9 +120,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
|
||||
|
||||
private void MakeHttpRequest(string url, LLUUID requestID)
|
||||
{
|
||||
WebRequest request = HttpWebRequest.Create(url);
|
||||
WebRequest request = WebRequest.Create(url);
|
||||
RequestState state = new RequestState((HttpWebRequest) request, requestID);
|
||||
IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state);
|
||||
IAsyncResult result = request.BeginGetResponse(HttpRequestReturn, state);
|
||||
|
||||
TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
|
||||
state.TimeOfRequest = (int) t.TotalSeconds;
|
||||
@@ -131,7 +131,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
|
||||
private void HttpRequestReturn(IAsyncResult result)
|
||||
{
|
||||
RequestState state = (RequestState) result.AsyncState;
|
||||
WebRequest request = (WebRequest) state.Request;
|
||||
WebRequest request = state.Request;
|
||||
HttpWebResponse response = (HttpWebResponse) request.EndGetResponse(result);
|
||||
if (response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
@@ -175,9 +175,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
|
||||
|
||||
public class RequestState
|
||||
{
|
||||
public HttpWebRequest Request = null;
|
||||
public HttpWebRequest Request;
|
||||
public LLUUID RequestID = LLUUID.Zero;
|
||||
public int TimeOfRequest = 0;
|
||||
public int TimeOfRequest;
|
||||
|
||||
public RequestState(HttpWebRequest request, LLUUID requestID)
|
||||
{
|
||||
|
||||
@@ -48,10 +48,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
|
||||
private Scene m_scene;
|
||||
private IDynamicTextureManager m_textureManager;
|
||||
|
||||
public VectorRenderModule()
|
||||
{
|
||||
}
|
||||
|
||||
#region IDynamicTextureRender Members
|
||||
|
||||
public string GetContentType()
|
||||
@@ -138,7 +134,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
|
||||
catch (Exception e)
|
||||
{
|
||||
//Ckrinke: Add a WriteLine to remove the warning about 'e' defined but not used
|
||||
Console.WriteLine("Problem with Draw. Please verify parameters." + e.ToString());
|
||||
Console.WriteLine("Problem with Draw. Please verify parameters." + e);
|
||||
}
|
||||
|
||||
if ((size < 128) || (size > 1024))
|
||||
@@ -260,7 +256,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
|
||||
endPoint.X = (int) x;
|
||||
endPoint.Y = (int) y;
|
||||
Image image = ImageHttpRequest(nextLine);
|
||||
graph.DrawImage(image, (float) startPoint.X, (float) startPoint.Y, x, y);
|
||||
graph.DrawImage(image, startPoint.X, startPoint.Y, x, y);
|
||||
startPoint.X += endPoint.X;
|
||||
startPoint.Y += endPoint.Y;
|
||||
}
|
||||
@@ -353,7 +349,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
|
||||
|
||||
private Bitmap ImageHttpRequest(string url)
|
||||
{
|
||||
WebRequest request = HttpWebRequest.Create(url);
|
||||
WebRequest request = WebRequest.Create(url);
|
||||
//Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used.
|
||||
//Ckrinke Stream str = null;
|
||||
HttpWebResponse response = (HttpWebResponse) (request).GetResponse();
|
||||
|
||||
@@ -75,10 +75,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
|
||||
private Queue m_pendingQ;
|
||||
private Scene m_scene;
|
||||
|
||||
public WorldCommModule()
|
||||
{
|
||||
}
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
@@ -324,8 +320,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
|
||||
public class ListenerManager
|
||||
{
|
||||
//private Dictionary<int, ListenerInfo> m_listeners;
|
||||
private readonly Hashtable m_listeners = Hashtable.Synchronized(new Hashtable());
|
||||
private object ListenersLock = new object();
|
||||
private Hashtable m_listeners = Hashtable.Synchronized(new Hashtable());
|
||||
private int m_MaxListeners = 100;
|
||||
|
||||
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
|
||||
|
||||
public class ListenerInfo
|
||||
{
|
||||
private readonly LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message
|
||||
private bool m_active; // Listener is active or not
|
||||
private int m_channel; // Channel
|
||||
private int m_handle; // Assigned handle of this listener
|
||||
@@ -494,7 +491,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
|
||||
private uint m_localID; // Local ID from script engine
|
||||
private string m_message; // The message
|
||||
private string m_name; // Object name to filter messages from
|
||||
private LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message
|
||||
|
||||
public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message)
|
||||
{
|
||||
|
||||
@@ -78,20 +78,20 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
|
||||
public class XMLRPCModule : IRegionModule, IXMLRPC
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private readonly List<Scene> m_scenes = new List<Scene>();
|
||||
private readonly object XMLRPCListLock = new object();
|
||||
|
||||
private string m_name = "XMLRPCModule";
|
||||
|
||||
// <channel id, RPCChannelInfo>
|
||||
private Dictionary<LLUUID, RPCChannelInfo> m_openChannels;
|
||||
private Dictionary<LLUUID, SendRemoteDataRequest> m_pendingSRDResponses;
|
||||
private int m_remoteDataPort = 0;
|
||||
private int m_remoteDataPort;
|
||||
|
||||
private Dictionary<LLUUID, RPCRequestInfo> m_rpcPending;
|
||||
private Dictionary<LLUUID, RPCRequestInfo> m_rpcPendingResponses;
|
||||
private List<Scene> m_scenes = new List<Scene>();
|
||||
private int RemoteReplyScriptTimeout = 9000;
|
||||
private int RemoteReplyScriptWait = 300;
|
||||
private object XMLRPCListLock = new object();
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
@@ -428,15 +428,15 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
|
||||
|
||||
public class RPCRequestInfo
|
||||
{
|
||||
private LLUUID m_ChannelKey;
|
||||
private string m_IntVal;
|
||||
private LLUUID m_ItemID;
|
||||
private uint m_localID;
|
||||
private LLUUID m_MessageID;
|
||||
private readonly LLUUID m_ChannelKey;
|
||||
private readonly string m_IntVal;
|
||||
private readonly LLUUID m_ItemID;
|
||||
private readonly uint m_localID;
|
||||
private readonly LLUUID m_MessageID;
|
||||
private readonly string m_StrVal;
|
||||
private bool m_processed;
|
||||
private int m_respInt;
|
||||
private string m_respStr;
|
||||
private string m_StrVal;
|
||||
|
||||
public RPCRequestInfo(uint localID, LLUUID itemID, LLUUID channelKey, string strVal, string intVal)
|
||||
{
|
||||
@@ -514,9 +514,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
|
||||
|
||||
public class RPCChannelInfo
|
||||
{
|
||||
private LLUUID m_ChannelKey;
|
||||
private LLUUID m_itemID;
|
||||
private uint m_localID;
|
||||
private readonly LLUUID m_ChannelKey;
|
||||
private readonly LLUUID m_itemID;
|
||||
private readonly uint m_localID;
|
||||
|
||||
public RPCChannelInfo(uint localID, LLUUID itemID, LLUUID channelID)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user