From 6ec680918bc6876f1c1382fb534b653fc34da052 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Sun, 18 May 2008 23:06:50 +0000 Subject: Formatting cleanup, minor refactoring. Fixed some comparisons of value types and null. --- .../DotNetEngine/Compiler/LSL/LSL2CSConverter.cs | 15 +++------------ .../ScriptEngine/RemoteServer/RemoteServer.cs | 21 ++++++++++----------- 2 files changed, 13 insertions(+), 23 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs index 2469107..765eb5d 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs @@ -39,13 +39,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL //private Regex rnw = new Regex(@"[a-zA-Z0-9_\-]", RegexOptions.Compiled); private Dictionary dataTypes = new Dictionary(); private Dictionary quotes = new Dictionary(); - // c Style + // c Style private Regex cstylecomments = new Regex(@"/\*(.|[\r\n])*?\*/", RegexOptions.Compiled | RegexOptions.Multiline); - // c# one liners + // c# one liners private Regex conelinecomments = new Regex(@".?([\/]{2}[^\n]*)|([\n]{1,}[\/]{2}[^\n]*)", RegexOptions.Compiled | RegexOptions.Multiline); // ([^\"])((?:[a-zA-Z])\.[a-zA-Z].?)([^\"]) - - // value we're looking for: (?:[a-zA-Z])\.[a-zA-Z] public LSL2CSConverter() @@ -89,16 +87,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL bool last_was_escape = false; int quote_replaced_count = 0; - - string removecomments = conelinecomments.Replace(Script, ""); removecomments = cstylecomments.Replace(removecomments, ""); string[] localscript = removecomments.Split('"'); string checkscript = String.Empty; bool flip = true; - - for (int p = 0; p < localscript.Length; p++) { if (localscript[p].Length >= 1) @@ -115,7 +109,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL if (!flip) checkscript += "\"" + localscript[p]; } - + //System.Console.WriteLine("SCRIPT:" + checkscript); // checks for alpha.alpha way of referring to objects in C# @@ -132,9 +126,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL if (SecurityM.Success) throw new Exception("CS0103: 'The object.GetType method isn't allowed in LSL'"); - - - for (int p = 0; p < Script.Length; p++) { C = Script.Substring(p, 1); diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/RemoteServer.cs b/OpenSim/Region/ScriptEngine/RemoteServer/RemoteServer.cs index 603808e..2a51b91 100644 --- a/OpenSim/Region/ScriptEngine/RemoteServer/RemoteServer.cs +++ b/OpenSim/Region/ScriptEngine/RemoteServer/RemoteServer.cs @@ -45,27 +45,25 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer ChannelServices.RegisterChannel(chan, true); } + /// + /// Create a channel for communicating w/ the remote object + /// Notice no port is specified on the client + /// public ScriptServerInterfaces.ServerRemotingObject Connect(string hostname, int port) { - // Create a channel for communicating w/ the remote object - // Notice no port is specified on the client - + ScriptServerInterfaces.ServerRemotingObject obj = null; + try { // Create an instance of the remote object - ScriptServerInterfaces.ServerRemotingObject obj = (ScriptServerInterfaces.ServerRemotingObject)Activator.GetObject( + obj = (ScriptServerInterfaces.ServerRemotingObject)Activator.GetObject( typeof(ScriptServerInterfaces.ServerRemotingObject), "tcp://" + hostname + ":" + port + "/DotNetEngine"); - // Use the object - if (obj.Equals(null)) + if (obj == null) { Console.WriteLine("Error: unable to locate server"); } - else - { - return obj; - } } catch (SocketException) { @@ -75,7 +73,8 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer { Console.WriteLine("Error: unable to connect to server"); } - return null; + + return obj; } } } -- cgit v1.1