From fc6c4dc399587f6f920d3f0759b1bd7a8b9b4ac8 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 1 May 2008 16:41:01 +0000 Subject: * Cleaning code still. --- OpenSim/Grid/ScriptServer/Application.cs | 6 +++--- OpenSim/Grid/ScriptServer/FakeScene.cs | 4 ++-- OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs | 2 +- OpenSim/Grid/ScriptServer/RemotingObject.cs | 6 +++++- OpenSim/Grid/ScriptServer/RemotingServer.cs | 9 +++++---- .../Grid/ScriptServer/ScriptServer/Region/RegionBase.cs | 5 +++++ .../ScriptServer/Region/RegionConnectionManager.cs | 2 +- .../Grid/ScriptServer/ScriptServer/RegionCommManager.cs | 6 ++---- .../Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs | 6 +++--- .../ScriptServer/ScriptServer/ScriptEnginesManager.cs | 6 +++--- OpenSim/Grid/ScriptServer/ScriptServerMain.cs | 16 ++++++++-------- 11 files changed, 38 insertions(+), 30 deletions(-) (limited to 'OpenSim/Grid/ScriptServer') diff --git a/OpenSim/Grid/ScriptServer/Application.cs b/OpenSim/Grid/ScriptServer/Application.cs index ef93f65..dc0bf62 100644 --- a/OpenSim/Grid/ScriptServer/Application.cs +++ b/OpenSim/Grid/ScriptServer/Application.cs @@ -39,7 +39,7 @@ namespace OpenSim.Grid.ScriptServer XmlConfigurator.Configure(); AppDomain.CurrentDomain.UnhandledException += - new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); + CurrentDomain_UnhandledException; // Application is starting SE = new ScriptServerMain(); @@ -50,9 +50,9 @@ namespace OpenSim.Grid.ScriptServer Console.WriteLine(String.Empty); Console.WriteLine("APPLICATION EXCEPTION DETECTED"); Console.WriteLine(String.Empty); - Console.WriteLine("Application is terminating: " + e.IsTerminating.ToString()); + Console.WriteLine("Application is terminating: " + e.IsTerminating); //Console.WriteLine("Exception:"); //Console.WriteLine(e.ExceptionObject.ToString()); } } -} +} \ No newline at end of file diff --git a/OpenSim/Grid/ScriptServer/FakeScene.cs b/OpenSim/Grid/ScriptServer/FakeScene.cs index 480050d..e037698 100644 --- a/OpenSim/Grid/ScriptServer/FakeScene.cs +++ b/OpenSim/Grid/ScriptServer/FakeScene.cs @@ -34,7 +34,7 @@ using OpenSim.Region.Environment.Scenes; namespace OpenSim.Grid.ScriptServer { - public class FakeScene: Scene + public class FakeScene : Scene { public FakeScene(RegionInfo regInfo, AgentCircuitManager authen, PermissionManager permissionManager, CommunicationsManager commsMan, SceneCommunicationService sceneGridService, @@ -48,4 +48,4 @@ namespace OpenSim.Grid.ScriptServer // What does a scene have to do? :P } -} +} \ No newline at end of file diff --git a/OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs index e4161d3..bb33e02 100644 --- a/OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs +++ b/OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs @@ -60,4 +60,4 @@ using System.Runtime.InteropServices; // [assembly : AssemblyVersion("1.0.0.0")] -[assembly : AssemblyFileVersion("1.0.0.0")] +[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/OpenSim/Grid/ScriptServer/RemotingObject.cs b/OpenSim/Grid/ScriptServer/RemotingObject.cs index 9d3065b..6686b26 100644 --- a/OpenSim/Grid/ScriptServer/RemotingObject.cs +++ b/OpenSim/Grid/ScriptServer/RemotingObject.cs @@ -34,9 +34,13 @@ namespace OpenSim.Grid.ScriptServer { // This object will be exposed over remoting. It is a singleton, so it exists only in as one instance. + #region ServerRemotingObject Members + ScriptServerInterfaces.RemoteEvents ScriptServerInterfaces.ServerRemotingObject.Events() { return ScriptServerMain.Engine.EventManager(); } + + #endregion } -} +} \ No newline at end of file diff --git a/OpenSim/Grid/ScriptServer/RemotingServer.cs b/OpenSim/Grid/ScriptServer/RemotingServer.cs index 7d0e334..9d75a83 100644 --- a/OpenSim/Grid/ScriptServer/RemotingServer.cs +++ b/OpenSim/Grid/ScriptServer/RemotingServer.cs @@ -31,9 +31,10 @@ using System.Runtime.Remoting.Channels.Tcp; namespace OpenSim.Grid.ScriptServer { - class RemotingServer + internal class RemotingServer { - TcpChannel channel; + private readonly TcpChannel channel; + public RemotingServer(int port, string instanceName) { // Create an instance of a channel @@ -42,9 +43,9 @@ namespace OpenSim.Grid.ScriptServer // Register as an available service with the name HelloWorld RemotingConfiguration.RegisterWellKnownServiceType( - typeof(RemotingObject), + typeof (RemotingObject), instanceName, WellKnownObjectMode.Singleton); } } -} +} \ No newline at end of file diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs index a02429c..4f9f2e7 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs @@ -32,8 +32,13 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer.Region // These are events that the region needs to have // TEMP: Using System.Delegate -- needs replacing with a real delegate + + #region Delegates + public delegate void DefaultDelegate(); + #endregion + public event DefaultDelegate onScriptRez; public event DefaultDelegate onstate_entry; public event DefaultDelegate onstate_exit; diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs index 8c31b9b..3c20272 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs @@ -29,8 +29,8 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer.Region { public class RegionConnectionManager : RegionBase { - private ScriptServerMain m_ScriptServerMain; private object m_Connection; + private ScriptServerMain m_ScriptServerMain; public RegionConnectionManager(ScriptServerMain scm, object Connection) { diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs index 8422bea..c1449bf 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs @@ -34,12 +34,10 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer { internal class RegionCommManager { + private readonly ScriptServerMain m_ScriptServerMain; + private readonly List Regions = new List(); private Thread listenThread; - private List Regions = new List(); - - private ScriptServerMain m_ScriptServerMain; - public RegionCommManager(ScriptServerMain scm) { m_ScriptServerMain = scm; diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs index 4d8c559..dce92ce 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs @@ -51,7 +51,7 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer { m_log.Error("[ScriptEngine]: " + "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " + - e.StackTrace.ToString()); + e.StackTrace); } return ret; } @@ -104,7 +104,7 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer ScriptServerInterfaces.ScriptEngine ret; //try //{ - ret = (ScriptServerInterfaces.ScriptEngine)Activator.CreateInstance(t); + ret = (ScriptServerInterfaces.ScriptEngine) Activator.CreateInstance(t); //} //catch (Exception e) //{ @@ -114,4 +114,4 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer return ret; } } -} +} \ No newline at end of file diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs index 9d67602..9ecd179 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs @@ -32,8 +32,8 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer { internal class ScriptEngineManager { - private ScriptEngineLoader ScriptEngineLoader; - private List scriptEngines = new List(); + private readonly ScriptEngineLoader ScriptEngineLoader; + private readonly List scriptEngines = new List(); private ScriptServerMain m_ScriptServerMain; // Initialize @@ -58,4 +58,4 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer return sei; } } -} +} \ No newline at end of file diff --git a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs index 528b51c..131ff34 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs @@ -44,20 +44,20 @@ namespace OpenSim.Grid.ScriptServer // // Root object. Creates objects used. // - private int listenPort = 8010; // TEMP public static ScriptServerInterfaces.ScriptEngine Engine; + private int listenPort = 8010; //public static FakeScene m_Scene = new FakeScene(null,null,null,null,null,null,null,null,null,false, false, false); // Objects we use - internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region - internal ScriptEngineManager ScriptEngines; // Loads scriptengines //internal RemotingServer m_RemotingServer; internal TCPServer m_TCPServer; + internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region internal TRPC_Remote RPC; + internal ScriptEngineManager ScriptEngines; // Loads scriptengines - public ScriptServerMain() + public ScriptServerMain() { m_console = CreateConsole(); @@ -68,13 +68,13 @@ namespace OpenSim.Grid.ScriptServer Engine = ScriptEngines.LoadEngine("DotNetEngine"); Engine.InitializeEngine(null, null, false, Engine.GetScriptManager()); - + // Set up server //m_RemotingServer = new RemotingServer(listenPort, "DotNetEngine"); m_TCPServer = new TCPServer(listenPort); RPC = new TRPC_Remote(m_TCPServer); - RPC.ReceiveCommand += new TRPC_Remote.ReceiveCommandDelegate(RPC_ReceiveCommand); + RPC.ReceiveCommand += RPC_ReceiveCommand; m_TCPServer.StartListen(); Console.ReadLine(); @@ -93,7 +93,7 @@ namespace OpenSim.Grid.ScriptServer if (Command == "OnRezScript") { - Engine.EventManager().OnRezScript((uint)p[0], new LLUUID((string)p[1]), (string)p[2]); + Engine.EventManager().OnRezScript((uint) p[0], new LLUUID((string) p[1]), (string) p[2]); } } @@ -106,4 +106,4 @@ namespace OpenSim.Grid.ScriptServer return new ConsoleBase("ScriptServer", this); } } -} +} \ No newline at end of file -- cgit v1.1