aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJeff Ames2008-06-04 09:59:27 +0000
committerJeff Ames2008-06-04 09:59:27 +0000
commit4ec4e16c809cf86a63b736d2b7b6ad7291595a5f (patch)
treecfa896ef9057228171e2ee39c4807060101ba90b /OpenSim
parent* If a ThreadAbortException reaches AuthUser() then let it pass through unmol... (diff)
downloadopensim-SC_OLD-4ec4e16c809cf86a63b736d2b7b6ad7291595a5f.zip
opensim-SC_OLD-4ec4e16c809cf86a63b736d2b7b6ad7291595a5f.tar.gz
opensim-SC_OLD-4ec4e16c809cf86a63b736d2b7b6ad7291595a5f.tar.bz2
opensim-SC_OLD-4ec4e16c809cf86a63b736d2b7b6ad7291595a5f.tar.xz
Formatting cleanup, minor refactoring, svn properties.
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs10
-rw-r--r--OpenSim/Framework/ClientManager.cs1
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs30
-rw-r--r--OpenSim/Framework/TaskInventoryItem.cs4
-rw-r--r--OpenSim/Grid/GridServer/GridServerBase.cs14
-rw-r--r--OpenSim/Grid/MessagingServer/MessageService.cs26
-rw-r--r--OpenSim/Grid/MessagingServer/PresenceInformer.cs16
-rw-r--r--OpenSim/Grid/MessagingServer/UserManager.cs8
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs6
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs8
-rw-r--r--OpenSim/Region/Application/OpenSimBackground.cs16
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs8
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs12
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs38
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs48
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequest.cs20
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveReader.cs68
-rw-r--r--OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs18
-rw-r--r--OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs16
-rw-r--r--OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs18
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs12
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs6
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs2
-rw-r--r--OpenSim/Region/Physics/Meshing/Extruder.cs27
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/YP2CSConverter.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Atom.cs22
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/BagofAnswers.cs28
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/FindallAnswers.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Functor.cs24
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Functor1.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Functor2.cs22
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Functor3.cs22
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/IndexedAnswers.cs22
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/ListPair.cs26
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Parser.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/PrologException.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/UndefinedPredicateException.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Variable.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/YP.cs34
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/YPCompiler.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/AsyncCommandManager.cs22
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Dataserver.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Eventstream.cs7
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/HttpRequest.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/SensorRepeat.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Timer.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/XmlRequest.cs12
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Compiler.cs43
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/EventManager.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Executor.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs300
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Script/AssemblyResolver.cs14
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Script/BuiltIn_Commands_BaseClass.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Script/LSL_Types.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs420
59 files changed, 848 insertions, 831 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index 7ebc806..a2215ef 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -120,7 +120,7 @@ namespace OpenSim.Data.MySQL
120 //m_log.Info("[ASSET DB]: Asset exists already, ignoring."); 120 //m_log.Info("[ASSET DB]: Asset exists already, ignoring.");
121 return; 121 return;
122 } 122 }
123 123
124 MySqlCommand cmd = 124 MySqlCommand cmd =
125 new MySqlCommand( 125 new MySqlCommand(
126 "REPLACE INTO assets(id, name, description, assetType, invType, local, temporary, data)" + 126 "REPLACE INTO assets(id, name, description, assetType, invType, local, temporary, data)" +
@@ -164,7 +164,7 @@ namespace OpenSim.Data.MySQL
164 override public bool ExistsAsset(LLUUID uuid) 164 override public bool ExistsAsset(LLUUID uuid)
165 { 165 {
166 bool assetExists = false; 166 bool assetExists = false;
167 167
168 lock (_dbConnection) 168 lock (_dbConnection)
169 { 169 {
170 MySqlCommand cmd = 170 MySqlCommand cmd =
@@ -182,7 +182,7 @@ namespace OpenSim.Data.MySQL
182 { 182 {
183 assetExists = true; 183 assetExists = true;
184 } 184 }
185 185
186 dbReader.Close(); 186 dbReader.Close();
187 cmd.Dispose(); 187 cmd.Dispose();
188 } 188 }
@@ -195,8 +195,8 @@ namespace OpenSim.Data.MySQL
195 _dbConnection.Reconnect(); 195 _dbConnection.Reconnect();
196 } 196 }
197 } 197 }
198 198
199 return assetExists; 199 return assetExists;
200 } 200 }
201 201
202 /// <summary> 202 /// <summary>
diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs
index a70f7fa..b557ec1 100644
--- a/OpenSim/Framework/ClientManager.cs
+++ b/OpenSim/Framework/ClientManager.cs
@@ -137,6 +137,7 @@ namespace OpenSim.Framework
137 } 137 }
138 } 138 }
139 } 139 }
140
140 [Obsolete("Using Obsolete to drive development is invalid. Obsolete presumes that something new has already been created to replace this.")] 141 [Obsolete("Using Obsolete to drive development is invalid. Obsolete presumes that something new has already been created to replace this.")]
141 public uint[] GetAllCircuits(LLUUID agentId) 142 public uint[] GetAllCircuits(LLUUID agentId)
142 { 143 {
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 6753a21..0ee21ac 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -40,14 +40,14 @@ namespace OpenSim.Framework.Servers
40 public abstract class BaseOpenSimServer 40 public abstract class BaseOpenSimServer
41 { 41 {
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43 43
44 protected ConsoleBase m_console; 44 protected ConsoleBase m_console;
45 45
46 /// <summary> 46 /// <summary>
47 /// Time at which this server was started 47 /// Time at which this server was started
48 /// </summary> 48 /// </summary>
49 protected DateTime m_startuptime; 49 protected DateTime m_startuptime;
50 50
51 /// <summary> 51 /// <summary>
52 /// Server version information. Usually VersionInfo + information about svn revision, operating system, etc. 52 /// Server version information. Usually VersionInfo + information about svn revision, operating system, etc.
53 /// </summary> 53 /// </summary>
@@ -66,19 +66,19 @@ namespace OpenSim.Framework.Servers
66 66
67 public BaseOpenSimServer() 67 public BaseOpenSimServer()
68 { 68 {
69 m_startuptime = DateTime.Now; 69 m_startuptime = DateTime.Now;
70 m_version = VersionInfo.Version; 70 m_version = VersionInfo.Version;
71 } 71 }
72 72
73 /// <summary> 73 /// <summary>
74 /// Performs initialisation of the scene, such as loading configuration from disk. 74 /// Performs initialisation of the scene, such as loading configuration from disk.
75 /// </summary> 75 /// </summary>
76 public virtual void Startup() 76 public virtual void Startup()
77 { 77 {
78 m_log.Info("[STARTUP]: Beginning startup processing"); 78 m_log.Info("[STARTUP]: Beginning startup processing");
79 79
80 EnhanceVersionInformation(); 80 EnhanceVersionInformation();
81 81
82 m_log.Info("[STARTUP]: Version " + m_version + "\n"); 82 m_log.Info("[STARTUP]: Version " + m_version + "\n");
83 } 83 }
84 84
@@ -86,9 +86,9 @@ namespace OpenSim.Framework.Servers
86 /// Should be overriden and referenced by descendents if they need to perform extra shutdown processing 86 /// Should be overriden and referenced by descendents if they need to perform extra shutdown processing
87 /// </summary> 87 /// </summary>
88 public virtual void Shutdown() 88 public virtual void Shutdown()
89 { 89 {
90 m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting..."); 90 m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting...");
91 91
92 Environment.Exit(0); 92 Environment.Exit(0);
93 } 93 }
94 94
@@ -110,7 +110,7 @@ namespace OpenSim.Framework.Servers
110 Notice("show uptime - show server startup time and uptime."); 110 Notice("show uptime - show server startup time and uptime.");
111 Notice("show version - show server version."); 111 Notice("show version - show server version.");
112 Notice("shutdown - shutdown the server.\n"); 112 Notice("shutdown - shutdown the server.\n");
113 113
114 break; 114 break;
115 115
116 case "show": 116 case "show":
@@ -146,10 +146,10 @@ namespace OpenSim.Framework.Servers
146 Notice("Server has been running since " + m_startuptime.DayOfWeek + ", " + m_startuptime.ToString()); 146 Notice("Server has been running since " + m_startuptime.DayOfWeek + ", " + m_startuptime.ToString());
147 Notice("That is an elapsed time of " + (DateTime.Now - m_startuptime).ToString()); 147 Notice("That is an elapsed time of " + (DateTime.Now - m_startuptime).ToString());
148 break; 148 break;
149 149
150 case "version": 150 case "version":
151 m_console.Notice("This is " + m_version); 151 m_console.Notice("This is " + m_version);
152 break; 152 break;
153 } 153 }
154 } 154 }
155 155
@@ -172,7 +172,7 @@ namespace OpenSim.Framework.Servers
172 protected void EnhanceVersionInformation() 172 protected void EnhanceVersionInformation()
173 { 173 {
174 string buildVersion = string.Empty; 174 string buildVersion = string.Empty;
175 175
176 // Add subversion revision information if available 176 // Add subversion revision information if available
177 // FIXME: Making an assumption about the directory we're currently in - we do this all over the place 177 // FIXME: Making an assumption about the directory we're currently in - we do this all over the place
178 // elsewhere as well 178 // elsewhere as well
@@ -227,6 +227,6 @@ namespace OpenSim.Framework.Servers
227 } 227 }
228 228
229 m_version += ", OS " + OSString; 229 m_version += ", OS " + OSString;
230 } 230 }
231 } 231 }
232} 232}
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs
index 4994fd4..1105242 100644
--- a/OpenSim/Framework/TaskInventoryItem.cs
+++ b/OpenSim/Framework/TaskInventoryItem.cs
@@ -90,7 +90,7 @@ namespace OpenSim.Framework
90 // see IXmlSerializable 90 // see IXmlSerializable
91 public void ReadXml(XmlReader reader) 91 public void ReadXml(XmlReader reader)
92 { 92 {
93 // m_log.DebugFormat("[TASK INVENTORY]: ReadXml current node before actions, {0}", reader.Name); 93 // m_log.DebugFormat("[TASK INVENTORY]: ReadXml current node before actions, {0}", reader.Name);
94 94
95 if (!reader.IsEmptyElement) 95 if (!reader.IsEmptyElement)
96 { 96 {
@@ -114,7 +114,7 @@ namespace OpenSim.Framework
114 // of the element wrapping this object so that the rest of the serialization can complete normally. 114 // of the element wrapping this object so that the rest of the serialization can complete normally.
115 reader.Read(); 115 reader.Read();
116 116
117 // m_log.DebugFormat("[TASK INVENTORY]: ReadXml current node after actions, {0}", reader.Name); 117 // m_log.DebugFormat("[TASK INVENTORY]: ReadXml current node after actions, {0}", reader.Name);
118 } 118 }
119 119
120 // see IXmlSerializable 120 // see IXmlSerializable
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs
index 8ca4296..7891c29 100644
--- a/OpenSim/Grid/GridServer/GridServerBase.cs
+++ b/OpenSim/Grid/GridServer/GridServerBase.cs
@@ -43,7 +43,7 @@ namespace OpenSim.Grid.GridServer
43 public class GridServerBase : BaseOpenSimServer, conscmd_callback 43 public class GridServerBase : BaseOpenSimServer, conscmd_callback
44 { 44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 protected GridConfig m_config; 47 protected GridConfig m_config;
48 protected GridManager m_gridManager; 48 protected GridManager m_gridManager;
49 protected List<IGridPlugin> m_plugins = new List<IGridPlugin>(); 49 protected List<IGridPlugin> m_plugins = new List<IGridPlugin>();
@@ -121,12 +121,12 @@ namespace OpenSim.Grid.GridServer
121 // Temporary hack to stop mono-addins scanning warnings from coming out on the console 121 // Temporary hack to stop mono-addins scanning warnings from coming out on the console
122 TextWriter oldOutput = Console.Out; 122 TextWriter oldOutput = Console.Out;
123 Console.SetOut(new StreamWriter(Stream.Null)); 123 Console.SetOut(new StreamWriter(Stream.Null));
124 124
125 AddinManager.Initialize("."); 125 AddinManager.Initialize(".");
126 AddinManager.Registry.Update(null); 126 AddinManager.Registry.Update(null);
127 127
128 // Returns the console.writelines back to the console's stream 128 // Returns the console.writelines back to the console's stream
129 Console.SetOut(oldOutput); 129 Console.SetOut(oldOutput);
130 130
131 ExtensionNodeList nodes = AddinManager.GetExtensionNodes("/OpenSim/GridServer"); 131 ExtensionNodeList nodes = AddinManager.GetExtensionNodes("/OpenSim/GridServer");
132 foreach (TypeExtensionNode node in nodes) 132 foreach (TypeExtensionNode node in nodes)
@@ -175,7 +175,7 @@ namespace OpenSim.Grid.GridServer
175 catch 175 catch
176 { 176 {
177 } 177 }
178 178
179 if (SimResponse == "OK") 179 if (SimResponse == "OK")
180 { 180 {
181 m_simProfileManager.SimProfiles[sim.UUID].online = true; 181 m_simProfileManager.SimProfiles[sim.UUID].online = true;
@@ -187,11 +187,11 @@ namespace OpenSim.Grid.GridServer
187 } 187 }
188 */ 188 */
189 } 189 }
190 190
191 public override void Shutdown() 191 public override void Shutdown()
192 { 192 {
193 foreach (IGridPlugin plugin in m_plugins) plugin.Close(); 193 foreach (IGridPlugin plugin in m_plugins) plugin.Close();
194 194
195 base.Shutdown(); 195 base.Shutdown();
196 } 196 }
197 } 197 }
diff --git a/OpenSim/Grid/MessagingServer/MessageService.cs b/OpenSim/Grid/MessagingServer/MessageService.cs
index 0abb89d..cec596f 100644
--- a/OpenSim/Grid/MessagingServer/MessageService.cs
+++ b/OpenSim/Grid/MessagingServer/MessageService.cs
@@ -67,12 +67,12 @@ namespace OpenSim.Grid.MessagingServer
67 UserConfig uc = new UserConfig(); 67 UserConfig uc = new UserConfig();
68 uc.DatabaseConnect = cfg.DatabaseConnect; 68 uc.DatabaseConnect = cfg.DatabaseConnect;
69 uc.DatabaseProvider = cfg.DatabaseProvider; 69 uc.DatabaseProvider = cfg.DatabaseProvider;
70 70
71 m_userManager._config = uc; 71 m_userManager._config = uc;
72 m_userManager.AddPlugin(cfg.DatabaseProvider, cfg.DatabaseConnect); 72 m_userManager.AddPlugin(cfg.DatabaseProvider, cfg.DatabaseConnect);
73 } 73 }
74 74
75 75
76 76
77 #region FriendList Methods 77 #region FriendList Methods
78 78
@@ -152,7 +152,7 @@ namespace OpenSim.Grid.MessagingServer
152 friendlistupdater.OnDone += PresenceUpdateDone; 152 friendlistupdater.OnDone += PresenceUpdateDone;
153 WaitCallback cb = new WaitCallback(friendlistupdater.go); 153 WaitCallback cb = new WaitCallback(friendlistupdater.go);
154 ThreadPool.QueueUserWorkItem(cb); 154 ThreadPool.QueueUserWorkItem(cb);
155 155
156 } 156 }
157 else 157 else
158 { 158 {
@@ -173,7 +173,7 @@ namespace OpenSim.Grid.MessagingServer
173 { 173 {
174 // we need to send out online status update, but the user is already subscribed 174 // we need to send out online status update, but the user is already subscribed
175 } 175 }
176 176
177 UserAgentData p2Handle = m_userManager.GetUserAgentData(friendpresence.agentData.AgentID); 177 UserAgentData p2Handle = m_userManager.GetUserAgentData(friendpresence.agentData.AgentID);
178 178
179 if (p2Handle != null) 179 if (p2Handle != null)
@@ -196,7 +196,7 @@ namespace OpenSim.Grid.MessagingServer
196 // skip, agent doesn't appear to exist anymore 196 // skip, agent doesn't appear to exist anymore
197 } 197 }
198 198
199 199
200 200
201 //SendRegionPresenceUpdate(userpresence, friendpresence); 201 //SendRegionPresenceUpdate(userpresence, friendpresence);
202 } 202 }
@@ -315,8 +315,8 @@ namespace OpenSim.Grid.MessagingServer
315 UserAgentData p2Handle = m_userManager.GetUserAgentData(friendd.agentData.AgentID); 315 UserAgentData p2Handle = m_userManager.GetUserAgentData(friendd.agentData.AgentID);
316 if (p2Handle != null) 316 if (p2Handle != null)
317 { 317 {
318 318
319 319
320 friendd.regionData.regionHandle = p2Handle.Handle; 320 friendd.regionData.regionHandle = p2Handle.Handle;
321 PresenceInformer friendlistupdater = new PresenceInformer(); 321 PresenceInformer friendlistupdater = new PresenceInformer();
322 friendlistupdater.presence1 = AgentData; 322 friendlistupdater.presence1 = AgentData;
@@ -328,11 +328,11 @@ namespace OpenSim.Grid.MessagingServer
328 328
329 friendlistupdater.OnGetRegionData += GetRegionInfo; 329 friendlistupdater.OnGetRegionData += GetRegionInfo;
330 friendlistupdater.OnDone += PresenceUpdateDone; 330 friendlistupdater.OnDone += PresenceUpdateDone;
331 331
332 WaitCallback cb3 = new WaitCallback(friendlistupdater.go); 332 WaitCallback cb3 = new WaitCallback(friendlistupdater.go);
333 ThreadPool.QueueUserWorkItem(cb3); 333 ThreadPool.QueueUserWorkItem(cb3);
334 334
335 335
336 336
337 } 337 }
338 else 338 else
@@ -519,14 +519,14 @@ namespace OpenSim.Grid.MessagingServer
519 else 519 else
520 { 520 {
521 // Don't lock the cache while we're looking up the region! 521 // Don't lock the cache while we're looking up the region!
522 lookup = true; 522 lookup = true;
523 } 523 }
524 } 524 }
525 525
526 if (lookup) 526 if (lookup)
527 { 527 {
528 regionInfo = RequestRegionInfo(regionhandle); 528 regionInfo = RequestRegionInfo(regionhandle);
529 529
530 if (regionInfo != null) 530 if (regionInfo != null)
531 { 531 {
532 lock (m_regionInfoCache) 532 lock (m_regionInfoCache)
@@ -542,7 +542,7 @@ namespace OpenSim.Grid.MessagingServer
542 } 542 }
543 } 543 }
544 } 544 }
545 545
546 return regionInfo; 546 return regionInfo;
547 } 547 }
548 548
@@ -555,7 +555,7 @@ namespace OpenSim.Grid.MessagingServer
555 cachecount = m_regionInfoCache.Count; 555 cachecount = m_regionInfoCache.Count;
556 m_regionInfoCache.Clear(); 556 m_regionInfoCache.Clear();
557 } 557 }
558 558
559 return cachecount; 559 return cachecount;
560 } 560 }
561 561
diff --git a/OpenSim/Grid/MessagingServer/PresenceInformer.cs b/OpenSim/Grid/MessagingServer/PresenceInformer.cs
index 3e35f20..e02aa06 100644
--- a/OpenSim/Grid/MessagingServer/PresenceInformer.cs
+++ b/OpenSim/Grid/MessagingServer/PresenceInformer.cs
@@ -36,13 +36,13 @@ namespace OpenSim.Grid.MessagingServer
36{ 36{
37 public delegate RegionProfileData GetRegionData(ulong region_handle); 37 public delegate RegionProfileData GetRegionData(ulong region_handle);
38 public delegate void Done(PresenceInformer obj); 38 public delegate void Done(PresenceInformer obj);
39 39
40 40
41 public class PresenceInformer 41 public class PresenceInformer
42 { 42 {
43 public event GetRegionData OnGetRegionData; 43 public event GetRegionData OnGetRegionData;
44 public event Done OnDone; 44 public event Done OnDone;
45 45
46 private GetRegionData handlerGetRegionData = null; 46 private GetRegionData handlerGetRegionData = null;
47 private Done handlerDone = null; 47 private Done handlerDone = null;
48 48
@@ -102,10 +102,10 @@ namespace OpenSim.Grid.MessagingServer
102 PresenceParams.Add("notify_id",UserToUpdate.agentData.AgentID.ToString()); 102 PresenceParams.Add("notify_id",UserToUpdate.agentData.AgentID.ToString());
103 if (TalkingAbout.OnlineYN) 103 if (TalkingAbout.OnlineYN)
104 PresenceParams.Add("status","TRUE"); 104 PresenceParams.Add("status","TRUE");
105 else 105 else
106 PresenceParams.Add("status","FALSE"); 106 PresenceParams.Add("status","FALSE");
107 107
108 108
109 109
110 110
111 ArrayList SendParams = new ArrayList(); 111 ArrayList SendParams = new ArrayList();
@@ -123,12 +123,12 @@ namespace OpenSim.Grid.MessagingServer
123 catch (WebException) 123 catch (WebException)
124 { 124 {
125 m_log.WarnFormat("[INFORM]: failed notifying region {0} containing user {1} about {2}", whichRegion.regionName, UserToUpdate.agentData.firstname + " " + UserToUpdate.agentData.lastname, TalkingAbout.agentData.firstname + " " + TalkingAbout.agentData.lastname); 125 m_log.WarnFormat("[INFORM]: failed notifying region {0} containing user {1} about {2}", whichRegion.regionName, UserToUpdate.agentData.firstname + " " + UserToUpdate.agentData.lastname, TalkingAbout.agentData.firstname + " " + TalkingAbout.agentData.lastname);
126 } 126 }
127 } 127 }
128 else 128 else
129 { 129 {
130 m_log.Info("[PRESENCEUPDATER]: Region data was null skipping"); 130 m_log.Info("[PRESENCEUPDATER]: Region data was null skipping");
131 131
132 } 132 }
133 133
134 handlerDone = OnDone; 134 handlerDone = OnDone;
diff --git a/OpenSim/Grid/MessagingServer/UserManager.cs b/OpenSim/Grid/MessagingServer/UserManager.cs
index 605c3fb..de41756 100644
--- a/OpenSim/Grid/MessagingServer/UserManager.cs
+++ b/OpenSim/Grid/MessagingServer/UserManager.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Grid.MessagingServer
44 public UserAgentData GetUserAgentData(LLUUID AgentID) 44 public UserAgentData GetUserAgentData(LLUUID AgentID)
45 { 45 {
46 UserProfileData userProfile = GetUserProfile(AgentID); 46 UserProfileData userProfile = GetUserProfile(AgentID);
47 47
48 if (userProfile != null) 48 if (userProfile != null)
49 { 49 {
50 return userProfile.CurrentAgent; 50 return userProfile.CurrentAgent;
@@ -58,19 +58,19 @@ namespace OpenSim.Grid.MessagingServer
58 public override UserProfileData SetupMasterUser(string firstName, string lastName) 58 public override UserProfileData SetupMasterUser(string firstName, string lastName)
59 { 59 {
60 //throw new Exception("The method or operation is not implemented."); 60 //throw new Exception("The method or operation is not implemented.");
61 return null; 61 return null;
62 } 62 }
63 63
64 public override UserProfileData SetupMasterUser(string firstName, string lastName, string password) 64 public override UserProfileData SetupMasterUser(string firstName, string lastName, string password)
65 { 65 {
66 //throw new Exception("The method or operation is not implemented."); 66 //throw new Exception("The method or operation is not implemented.");
67 return null; 67 return null;
68 } 68 }
69 69
70 public override UserProfileData SetupMasterUser(LLUUID uuid) 70 public override UserProfileData SetupMasterUser(LLUUID uuid)
71 { 71 {
72 //throw new Exception("The method or operation is not implemented."); 72 //throw new Exception("The method or operation is not implemented.");
73 return null; 73 return null;
74 } 74 }
75 } 75 }
76} 76}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
index ad1b989..9cd3fb1 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
@@ -224,14 +224,14 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
224 LSL_Types.Quaternion a2 = new LSL_Types.Quaternion(0.0, by, 0.0, bw); 224 LSL_Types.Quaternion a2 = new LSL_Types.Quaternion(0.0, by, 0.0, bw);
225 LSL_Types.Quaternion a3 = new LSL_Types.Quaternion(ax, 0.0, 0.0, aw); 225 LSL_Types.Quaternion a3 = new LSL_Types.Quaternion(ax, 0.0, 0.0, aw);
226 LSL_Types.Quaternion a = new LSL_Types.Quaternion(); 226 LSL_Types.Quaternion a = new LSL_Types.Quaternion();
227 //This multiplication doesnt compile, yet. a = a1 * a2 * a3; 227 //This multiplication doesn't compile, yet. a = a1 * a2 * a3;
228 LSL_Types.Quaternion b = new LSL_Types.Quaternion(ax*bw*cw + aw*by*cz, 228 LSL_Types.Quaternion b = new LSL_Types.Quaternion(ax*bw*cw + aw*by*cz,
229 aw*by*cw - ax*bw*cz, aw*bw*cz + ax*by*cw, 229 aw*by*cw - ax*bw*cz, aw*bw*cz + ax*by*cw,
230 aw*bw*cw - ax*by*cz); 230 aw*bw*cw - ax*by*cz);
231 LSL_Types.Quaternion c = new LSL_Types.Quaternion(); 231 LSL_Types.Quaternion c = new LSL_Types.Quaternion();
232 //This addition doesnt compile yet c = a + b; 232 //This addition doesn't compile yet c = a + b;
233 LSL_Types.Quaternion d = new LSL_Types.Quaternion(); 233 LSL_Types.Quaternion d = new LSL_Types.Quaternion();
234 //This addition doesnt compile yet d = a - b; 234 //This addition doesn't compile yet d = a - b;
235 if ((Math.Abs(c.X) > err && Math.Abs(d.X) > err) || 235 if ((Math.Abs(c.X) > err && Math.Abs(d.X) > err) ||
236 (Math.Abs(c.Y) > err && Math.Abs(d.Y) > err) || 236 (Math.Abs(c.Y) > err && Math.Abs(d.Y) > err) ||
237 (Math.Abs(c.Z) > err && Math.Abs(d.Z) > err) || 237 (Math.Abs(c.Z) > err && Math.Abs(d.Z) > err) ||
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index a78876c..907a530 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -430,9 +430,9 @@ namespace OpenSim.Grid.UserServer
430 if (requestData.Contains("avatar_uuid")) 430 if (requestData.Contains("avatar_uuid"))
431 { 431 {
432 LLUUID guess = LLUUID.Zero; 432 LLUUID guess = LLUUID.Zero;
433 433
434 Helpers.TryParse((string)requestData["avatar_uuid"],out guess); 434 Helpers.TryParse((string)requestData["avatar_uuid"],out guess);
435 435
436 if (guess == LLUUID.Zero) 436 if (guess == LLUUID.Zero)
437 { 437 {
438 return CreateUnknownUserErrorResponse(); 438 return CreateUnknownUserErrorResponse();
@@ -444,7 +444,7 @@ namespace OpenSim.Grid.UserServer
444 { 444 {
445 return CreateUnknownUserErrorResponse(); 445 return CreateUnknownUserErrorResponse();
446 } 446 }
447 447
448 // no agent??? 448 // no agent???
449 if (userProfile.CurrentAgent == null) 449 if (userProfile.CurrentAgent == null)
450 { 450 {
@@ -456,7 +456,7 @@ namespace OpenSim.Grid.UserServer
456 responseData["session"]=userProfile.CurrentAgent.SessionID.ToString(); 456 responseData["session"]=userProfile.CurrentAgent.SessionID.ToString();
457 if (userProfile.CurrentAgent.AgentOnline) 457 if (userProfile.CurrentAgent.AgentOnline)
458 responseData["agent_online"]="TRUE"; 458 responseData["agent_online"]="TRUE";
459 else 459 else
460 responseData["agent_online"]="FALSE"; 460 responseData["agent_online"]="FALSE";
461 461
462 response.Value = responseData; 462 response.Value = responseData;
diff --git a/OpenSim/Region/Application/OpenSimBackground.cs b/OpenSim/Region/Application/OpenSimBackground.cs
index 51a5b67..bfecf3b 100644
--- a/OpenSim/Region/Application/OpenSimBackground.cs
+++ b/OpenSim/Region/Application/OpenSimBackground.cs
@@ -31,20 +31,20 @@ using log4net;
31using Nini.Config; 31using Nini.Config;
32 32
33namespace OpenSim 33namespace OpenSim
34{ 34{
35 /// <summary> 35 /// <summary>
36 /// Consoleless OpenSim region server 36 /// Consoleless OpenSim region server
37 /// </summary> 37 /// </summary>
38 public class OpenSimBackground : OpenSimBase 38 public class OpenSimBackground : OpenSimBase
39 { 39 {
40 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 40 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
41 41
42 private ManualResetEvent WorldHasComeToAnEnd = new ManualResetEvent(false); 42 private ManualResetEvent WorldHasComeToAnEnd = new ManualResetEvent(false);
43 43
44 public OpenSimBackground(IConfigSource configSource) : base(configSource) 44 public OpenSimBackground(IConfigSource configSource) : base(configSource)
45 { 45 {
46 } 46 }
47 47
48 /// <summary> 48 /// <summary>
49 /// Performs initialisation of the scene, such as loading configuration from disk. 49 /// Performs initialisation of the scene, such as loading configuration from disk.
50 /// </summary> 50 /// </summary>
@@ -65,8 +65,8 @@ namespace OpenSim
65 m_clientServers.Count.ToString(), m_clientServers.Count > 1 ? "s" : ""); 65 m_clientServers.Count.ToString(), m_clientServers.Count > 1 ? "s" : "");
66 66
67 WorldHasComeToAnEnd.WaitOne(); 67 WorldHasComeToAnEnd.WaitOne();
68 } 68 }
69 69
70 /// <summary> 70 /// <summary>
71 /// Performs any last-minute sanity checking and shuts down the region server 71 /// Performs any last-minute sanity checking and shuts down the region server
72 /// </summary> 72 /// </summary>
@@ -75,6 +75,6 @@ namespace OpenSim
75 WorldHasComeToAnEnd.Set(); 75 WorldHasComeToAnEnd.Set();
76 76
77 base.Shutdown(); 77 base.Shutdown();
78 } 78 }
79 } 79 }
80} 80}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 0daabc5..85ab99c 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -624,14 +624,14 @@ namespace OpenSim.Region.Communications.OGS1
624 LLUUID agentID = LLUUID.Zero; 624 LLUUID agentID = LLUUID.Zero;
625 LLUUID RegionSecret = LLUUID.Zero; 625 LLUUID RegionSecret = LLUUID.Zero;
626 Helpers.TryParse((string)requestData["agent_id"], out agentID); 626 Helpers.TryParse((string)requestData["agent_id"], out agentID);
627 Helpers.TryParse((string)requestData["region_secret"], out RegionSecret); 627 Helpers.TryParse((string)requestData["region_secret"], out RegionSecret);
628 628
629 ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); 629 ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]);
630 630
631 631
632 m_localBackend.TriggerLogOffUser(regionHandle, agentID, RegionSecret,message); 632 m_localBackend.TriggerLogOffUser(regionHandle, agentID, RegionSecret,message);
633 633
634 634
635 635
636 return new XmlRpcResponse(); 636 return new XmlRpcResponse();
637 } 637 }
@@ -647,7 +647,7 @@ namespace OpenSim.Region.Communications.OGS1
647 try 647 try
648 { 648 {
649 ch = new TcpChannel((int)NetworkServersInfo.RemotingListenerPort); 649 ch = new TcpChannel((int)NetworkServersInfo.RemotingListenerPort);
650 ChannelServices.RegisterChannel(ch, false); // Disabled security as Mono doesnt support this. 650 ChannelServices.RegisterChannel(ch, false); // Disabled security as Mono doesn't support this.
651 } 651 }
652 catch (Exception ex) 652 catch (Exception ex)
653 { 653 {
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index d486c40..a31570e 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -85,8 +85,8 @@ namespace OpenSim.Region.Communications.OGS1
85 (float) Convert.ToDecimal((string) data["home_look_z"])); 85 (float) Convert.ToDecimal((string) data["home_look_z"]));
86 86
87 return userData; 87 return userData;
88 } 88 }
89 89
90 /// <summary> 90 /// <summary>
91 /// Get a user agent from the user server 91 /// Get a user agent from the user server
92 /// </summary> 92 /// </summary>
@@ -126,7 +126,7 @@ namespace OpenSim.Region.Communications.OGS1
126 { 126 {
127 userAgent.AgentOnline = false; 127 userAgent.AgentOnline = false;
128 } 128 }
129 129
130 return userAgent; 130 return userAgent;
131 } 131 }
132 catch (Exception e) 132 catch (Exception e)
@@ -259,7 +259,7 @@ namespace OpenSim.Region.Communications.OGS1
259 XmlRpcRequest req = new XmlRpcRequest("update_user_current_region", parameters); 259 XmlRpcRequest req = new XmlRpcRequest("update_user_current_region", parameters);
260 260
261 XmlRpcResponse resp; 261 XmlRpcResponse resp;
262 262
263 try 263 try
264 { 264 {
265 resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); 265 resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
@@ -278,8 +278,8 @@ namespace OpenSim.Region.Communications.OGS1
278 return; 278 return;
279 } 279 }
280 } 280 }
281 281
282 if( resp == null ) 282 if (resp == null)
283 { 283 {
284 m_log.Warn("[OSG1 USER SERVICES]: Got no response, Grid server may not be updated."); 284 m_log.Warn("[OSG1 USER SERVICES]: Got no response, Grid server may not be updated.");
285 return; 285 return;
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs
index 7ee7eda..16fd753 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs
@@ -644,7 +644,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
644 } 644 }
645 catch (IOException) 645 catch (IOException)
646 { 646 {
647 if (m_enabled) 647 if (m_enabled)
648 { 648 {
649 m_log.Error("[IRC]: ListenerRun IOException. Disconnected from IRC server ??? (ListenerRun)"); 649 m_log.Error("[IRC]: ListenerRun IOException. Disconnected from IRC server ??? (ListenerRun)");
650 Reconnect(); 650 Reconnect();
@@ -848,7 +848,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
848 848
849 public void Close() 849 public void Close()
850 { 850 {
851 m_writer.WriteLine(String.Format("QUIT :{0} to {1} wormhole to {2} closing", 851 m_writer.WriteLine(String.Format("QUIT :{0} to {1} wormhole to {2} closing",
852 m_nick, m_channel, m_server)); 852 m_nick, m_channel, m_server));
853 m_writer.Flush(); 853 m_writer.Flush();
854 854
diff --git a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs
index 36184d2..b22ca79 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
50 #region IRegionModule Members 50 #region IRegionModule Members
51 51
52 private bool gridmode = false; 52 private bool gridmode = false;
53 53
54 54
55 public void Initialise(Scene scene, IConfigSource config) 55 public void Initialise(Scene scene, IConfigSource config)
56 { 56 {
@@ -183,13 +183,13 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
183 } 183 }
184 } 184 }
185 185
186 186
187 } 187 }
188 188
189 // Trusty OSG1 called method. This method also gets called from the FriendsModule 189 // Trusty OSG1 called method. This method also gets called from the FriendsModule
190 // Turns out the sim has to send an instant message to the user to get it to show an accepted friend. 190 // Turns out the sim has to send an instant message to the user to get it to show an accepted friend.
191 /// <summary> 191 /// <summary>
192 /// 192 ///
193 /// </summary> 193 /// </summary>
194 /// <param name="msg"></param> 194 /// <param name="msg"></param>
195 private void OnGridInstantMessage(GridInstantMessage msg) 195 private void OnGridInstantMessage(GridInstantMessage msg)
@@ -207,7 +207,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
207 /// Process a XMLRPC Grid Instant Message 207 /// Process a XMLRPC Grid Instant Message
208 /// </summary> 208 /// </summary>
209 /// <param name="request">XMLRPC parameters from_agent_id from_agent_session to_agent_id im_session_id timestamp 209 /// <param name="request">XMLRPC parameters from_agent_id from_agent_session to_agent_id im_session_id timestamp
210 /// from_agent_name message dialog from_group offline parent_estate_id position_x position_y position_z region_id 210 /// from_agent_name message dialog from_group offline parent_estate_id position_x position_y position_z region_id
211 /// binary_bucket region_handle</param> 211 /// binary_bucket region_handle</param>
212 /// <returns>Nothing much</returns> 212 /// <returns>Nothing much</returns>
213 protected virtual XmlRpcResponse processXMLRPCGridInstantMessage(XmlRpcRequest request) 213 protected virtual XmlRpcResponse processXMLRPCGridInstantMessage(XmlRpcRequest request)
@@ -221,7 +221,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
221 uint timestamp = 0; 221 uint timestamp = 0;
222 string fromAgentName = ""; 222 string fromAgentName = "";
223 string message = ""; 223 string message = "";
224 byte dialog = (byte)0; 224 byte dialog = (byte)0;
225 bool fromGroup = false; 225 bool fromGroup = false;
226 byte offline = (byte)0; 226 byte offline = (byte)0;
227 uint ParentEstateID=0; 227 uint ParentEstateID=0;
@@ -237,14 +237,14 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
237 237
238 Hashtable requestData = (Hashtable)request.Params[0]; 238 Hashtable requestData = (Hashtable)request.Params[0];
239 // Check if it's got all the data 239 // Check if it's got all the data
240 if (requestData.ContainsKey("from_agent_id") && requestData.ContainsKey("from_agent_session") 240 if (requestData.ContainsKey("from_agent_id") && requestData.ContainsKey("from_agent_session")
241 && requestData.ContainsKey("to_agent_id") && requestData.ContainsKey("im_session_id") 241 && requestData.ContainsKey("to_agent_id") && requestData.ContainsKey("im_session_id")
242 && requestData.ContainsKey("timestamp") && requestData.ContainsKey("from_agent_name") 242 && requestData.ContainsKey("timestamp") && requestData.ContainsKey("from_agent_name")
243 && requestData.ContainsKey("message") && requestData.ContainsKey("dialog") 243 && requestData.ContainsKey("message") && requestData.ContainsKey("dialog")
244 && requestData.ContainsKey("from_group") 244 && requestData.ContainsKey("from_group")
245 && requestData.ContainsKey("offline") && requestData.ContainsKey("parent_estate_id") 245 && requestData.ContainsKey("offline") && requestData.ContainsKey("parent_estate_id")
246 && requestData.ContainsKey("position_x") && requestData.ContainsKey("position_y") 246 && requestData.ContainsKey("position_x") && requestData.ContainsKey("position_y")
247 && requestData.ContainsKey("position_z") && requestData.ContainsKey("region_id") 247 && requestData.ContainsKey("position_z") && requestData.ContainsKey("region_id")
248 && requestData.ContainsKey("binary_bucket") && requestData.ContainsKey("region_handle")) 248 && requestData.ContainsKey("binary_bucket") && requestData.ContainsKey("region_handle"))
249 { 249 {
250 // Do the easy way of validating the UUIDs 250 // Do the easy way of validating the UUIDs
@@ -276,7 +276,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
276 // Bytes don't transfer well over XMLRPC, so, we Base64 Encode them. 276 // Bytes don't transfer well over XMLRPC, so, we Base64 Encode them.
277 byte[] dialogdata = Convert.FromBase64String((string)requestData["dialog"]); 277 byte[] dialogdata = Convert.FromBase64String((string)requestData["dialog"]);
278 dialog = dialogdata[0]; 278 dialog = dialogdata[0];
279 279
280 if ((string)requestData["from_group"] == "TRUE") 280 if ((string)requestData["from_group"] == "TRUE")
281 fromGroup = true; 281 fromGroup = true;
282 282
@@ -365,7 +365,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
365 gim.Position = new sLLVector3(Position); 365 gim.Position = new sLLVector3(Position);
366 gim.binaryBucket = binaryBucket; 366 gim.binaryBucket = binaryBucket;
367 367
368 368
369 // Trigger the Instant message in the scene. 369 // Trigger the Instant message in the scene.
370 foreach (Scene scene in m_scenes) 370 foreach (Scene scene in m_scenes)
371 { 371 {
@@ -381,7 +381,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
381 } 381 }
382 } 382 }
383 //OnGridInstantMessage(gim); 383 //OnGridInstantMessage(gim);
384 384
385 } 385 }
386 386
387 //Send response back to region calling if it was successful 387 //Send response back to region calling if it was successful
@@ -482,7 +482,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
482 else 482 else
483 { 483 {
484 lookupAgent = true; 484 lookupAgent = true;
485 485
486 486
487 } 487 }
488 } 488 }
@@ -564,7 +564,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
564 else 564 else
565 { 565 {
566 // try again, but lookup user this time. 566 // try again, but lookup user this time.
567 // Warning, this must call the Async version 567 // Warning, this must call the Async version
568 // of this method or we'll be making thousands of threads 568 // of this method or we'll be making thousands of threads
569 // The version within the spawned thread is SendGridInstantMessageViaXMLRPCAsync 569 // The version within the spawned thread is SendGridInstantMessageViaXMLRPCAsync
570 // The version that spawns the thread is SendGridInstantMessageViaXMLRPC 570 // The version that spawns the thread is SendGridInstantMessageViaXMLRPC
@@ -686,7 +686,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
686 686
687 if (msg.fromGroup) 687 if (msg.fromGroup)
688 gim["from_group"] = "TRUE"; 688 gim["from_group"] = "TRUE";
689 else 689 else
690 gim["from_group"] = "FALSE"; 690 gim["from_group"] = "FALSE";
691 byte[] offlinedata = new byte[1]; offlinedata[0] = msg.offline; 691 byte[] offlinedata = new byte[1]; offlinedata[0] = msg.offline;
692 gim["offline"] = Convert.ToBase64String(offlinedata, Base64FormattingOptions.None); 692 gim["offline"] = Convert.ToBase64String(offlinedata, Base64FormattingOptions.None);
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
index 0c5edaa..6a3b519 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
@@ -41,10 +41,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
41 /// </summary> 41 /// </summary>
42 public class ArchiveReadRequest 42 public class ArchiveReadRequest
43 { 43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 protected static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding(); 46 protected static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding();
47 47
48 private Scene m_scene; 48 private Scene m_scene;
49 private string m_loadPath; 49 private string m_loadPath;
50 50
@@ -55,22 +55,22 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
55 55
56 DearchiveRegion(); 56 DearchiveRegion();
57 } 57 }
58 58
59 protected void DearchiveRegion() 59 protected void DearchiveRegion()
60 { 60 {
61 TarArchiveReader archive = new TarArchiveReader(m_loadPath); 61 TarArchiveReader archive = new TarArchiveReader(m_loadPath);
62 62
63 string serializedPrims = string.Empty; 63 string serializedPrims = string.Empty;
64 64
65 // Just test for now by reading first file 65 // Just test for now by reading first file
66 string filePath = "ERROR"; 66 string filePath = "ERROR";
67 67
68 byte[] data; 68 byte[] data;
69 while ((data = archive.ReadEntry(out filePath)) != null) 69 while ((data = archive.ReadEntry(out filePath)) != null)
70 { 70 {
71 m_log.DebugFormat( 71 m_log.DebugFormat(
72 "[ARCHIVER]: Successfully read {0} ({1} bytes) from archive {2}", filePath, data.Length, m_loadPath); 72 "[ARCHIVER]: Successfully read {0} ({1} bytes) from archive {2}", filePath, data.Length, m_loadPath);
73 73
74 if (filePath.Equals(ArchiveConstants.PRIMS_PATH)) 74 if (filePath.Equals(ArchiveConstants.PRIMS_PATH))
75 { 75 {
76 serializedPrims = m_asciiEncoding.GetString(data); 76 serializedPrims = m_asciiEncoding.GetString(data);
@@ -78,37 +78,37 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
78 else if (filePath.StartsWith(ArchiveConstants.TEXTURES_PATH)) 78 else if (filePath.StartsWith(ArchiveConstants.TEXTURES_PATH))
79 { 79 {
80 // Right now we're nastily obtaining the lluuid from the filename 80 // Right now we're nastily obtaining the lluuid from the filename
81 string rawId = filePath.Remove(0, ArchiveConstants.TEXTURES_PATH.Length); 81 string rawId = filePath.Remove(0, ArchiveConstants.TEXTURES_PATH.Length);
82 rawId = rawId.Remove(rawId.Length - ArchiveConstants.TEXTURE_EXTENSION.Length); 82 rawId = rawId.Remove(rawId.Length - ArchiveConstants.TEXTURE_EXTENSION.Length);
83 83
84 m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", rawId); 84 m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", rawId);
85 85
86 // Not preserving asset name or description as of yet 86 // Not preserving asset name or description as of yet
87 AssetBase asset = new AssetBase(new LLUUID(rawId), "imported name"); 87 AssetBase asset = new AssetBase(new LLUUID(rawId), "imported name");
88 asset.Description = "imported description"; 88 asset.Description = "imported description";
89 89
90 asset.Type = (sbyte)AssetType.Texture; 90 asset.Type = (sbyte)AssetType.Texture;
91 asset.InvType = (sbyte)InventoryType.Texture; 91 asset.InvType = (sbyte)InventoryType.Texture;
92 92
93 asset.Data = data; 93 asset.Data = data;
94 94
95 m_scene.AssetCache.AddAsset(asset); 95 m_scene.AssetCache.AddAsset(asset);
96 } 96 }
97 } 97 }
98 98
99 m_log.DebugFormat("[ARCHIVER]: Reached end of archive"); 99 m_log.DebugFormat("[ARCHIVER]: Reached end of archive");
100 100
101 archive.Close(); 101 archive.Close();
102 102
103 if (serializedPrims.Equals(string.Empty)) 103 if (serializedPrims.Equals(string.Empty))
104 { 104 {
105 m_log.ErrorFormat("[ARCHIVER]: Archive did not contain a {0} file", ArchiveConstants.PRIMS_PATH); 105 m_log.ErrorFormat("[ARCHIVER]: Archive did not contain a {0} file", ArchiveConstants.PRIMS_PATH);
106 return; 106 return;
107 } 107 }
108 108
109 // Reload serialized prims 109 // Reload serialized prims
110 m_log.InfoFormat("[ARCHIVER]: Loading prim data"); 110 m_log.InfoFormat("[ARCHIVER]: Loading prim data");
111 111
112 IRegionSerialiser serialiser = m_scene.RequestModuleInterface<IRegionSerialiser>(); 112 IRegionSerialiser serialiser = m_scene.RequestModuleInterface<IRegionSerialiser>();
113 serialiser.LoadPrimsFromXml2(m_scene, new StringReader(serializedPrims)); 113 serialiser.LoadPrimsFromXml2(m_scene, new StringReader(serializedPrims));
114 } 114 }
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequest.cs
index 1cc8877..6c341c6 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequest.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequest.cs
@@ -80,16 +80,16 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
80 { 80 {
81 // XXX: Not a great way to iterate through face textures, but there's no 81 // XXX: Not a great way to iterate through face textures, but there's no
82 // other way to tell how many faces there actually are 82 // other way to tell how many faces there actually are
83 //int i = 0; 83 //int i = 0;
84 foreach (LLObject.TextureEntryFace texture in part.Shape.Textures.FaceTextures) 84 foreach (LLObject.TextureEntryFace texture in part.Shape.Textures.FaceTextures)
85 { 85 {
86 if (texture != null) 86 if (texture != null)
87 { 87 {
88 //m_log.DebugFormat("[ARCHIVER]: Got face {0}", i++); 88 //m_log.DebugFormat("[ARCHIVER]: Got face {0}", i++);
89 textureUuids[texture.TextureID] = 1; 89 textureUuids[texture.TextureID] = 1;
90 } 90 }
91 } 91 }
92 92
93 foreach (TaskInventoryItem tit in part.TaskInventory.Values) 93 foreach (TaskInventoryItem tit in part.TaskInventory.Values)
94 { 94 {
95 if (tit.Type == (int)InventoryType.Texture) 95 if (tit.Type == (int)InventoryType.Texture)
@@ -123,7 +123,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
123 TarArchiveWriter archive = new TarArchiveWriter(); 123 TarArchiveWriter archive = new TarArchiveWriter();
124 124
125 archive.AddFile(ArchiveConstants.PRIMS_PATH, m_serializedEntities); 125 archive.AddFile(ArchiveConstants.PRIMS_PATH, m_serializedEntities);
126 126
127 // It appears that gtar, at least, doesn't need the intermediate directory entries in the tar 127 // It appears that gtar, at least, doesn't need the intermediate directory entries in the tar
128 //archive.AddDir("assets"); 128 //archive.AddDir("assets");
129 129
@@ -132,7 +132,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
132 if (assets[uuid] != null) 132 if (assets[uuid] != null)
133 { 133 {
134 archive.AddFile( 134 archive.AddFile(
135 ArchiveConstants.TEXTURES_PATH + uuid.ToString() + ArchiveConstants.TEXTURE_EXTENSION, 135 ArchiveConstants.TEXTURES_PATH + uuid.ToString() + ArchiveConstants.TEXTURE_EXTENSION,
136 assets[uuid].Data); 136 assets[uuid].Data);
137 } 137 }
138 else 138 else
@@ -142,7 +142,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
142 } 142 }
143 143
144 archive.WriteTar(m_savePath); 144 archive.WriteTar(m_savePath);
145 145
146 m_log.InfoFormat("[ARCHIVER]: Wrote out OpenSimulator archive {0}", m_savePath); 146 m_log.InfoFormat("[ARCHIVER]: Wrote out OpenSimulator archive {0}", m_savePath);
147 } 147 }
148 148
@@ -232,11 +232,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
232 newThread.Start(); 232 newThread.Start();
233 } 233 }
234 } 234 }
235 235
236 /// <summary> 236 /// <summary>
237 /// Perform the callback on the original requester of the assets 237 /// Perform the callback on the original requester of the assets
238 /// </summary> 238 /// </summary>
239 protected void PerformAssetsRequestCallback() 239 protected void PerformAssetsRequestCallback()
240 { 240 {
241 m_assetsRequestCallback(m_assets); 241 m_assetsRequestCallback(m_assets);
242 } 242 }
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveReader.cs b/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveReader.cs
index b199d5f..463e172 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveReader.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveReader.cs
@@ -39,24 +39,24 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
39 public class TarArchiveReader 39 public class TarArchiveReader
40 { 40 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 42
43 protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding(); 43 protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding();
44 44
45 /// <summary> 45 /// <summary>
46 /// Binary reader for the underlying stream 46 /// Binary reader for the underlying stream
47 /// </summary> 47 /// </summary>
48 protected BinaryReader m_br; 48 protected BinaryReader m_br;
49 49
50 /// <summary> 50 /// <summary>
51 /// Used to trim off null chars 51 /// Used to trim off null chars
52 /// </summary> 52 /// </summary>
53 protected char[] m_nullCharArray = new char[] { '\0' }; 53 protected char[] m_nullCharArray = new char[] { '\0' };
54 54
55 public TarArchiveReader(string archivePath) 55 public TarArchiveReader(string archivePath)
56 { 56 {
57 m_br = new BinaryReader(new FileStream(archivePath, FileMode.Open)); 57 m_br = new BinaryReader(new FileStream(archivePath, FileMode.Open));
58 } 58 }
59 59
60 /// <summary> 60 /// <summary>
61 /// Are we at the end of the archive? 61 /// Are we at the end of the archive?
62 /// </summary> 62 /// </summary>
@@ -64,13 +64,13 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
64 public bool AtEof() 64 public bool AtEof()
65 { 65 {
66 // If we've reached the end of the archive we'll be in null block territory, which means 66 // If we've reached the end of the archive we'll be in null block territory, which means
67 // the next byte will be 0 67 // the next byte will be 0
68 if (m_br.PeekChar() == 0) 68 if (m_br.PeekChar() == 0)
69 return true; 69 return true;
70 70
71 return false; 71 return false;
72 } 72 }
73 73
74 /// <summary> 74 /// <summary>
75 /// Read the next entry in the tar file. 75 /// Read the next entry in the tar file.
76 /// </summary> 76 /// </summary>
@@ -79,27 +79,27 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
79 public byte[] ReadEntry(out string filePath) 79 public byte[] ReadEntry(out string filePath)
80 { 80 {
81 filePath = String.Empty; 81 filePath = String.Empty;
82 82
83 if (AtEof()) 83 if (AtEof())
84 return null; 84 return null;
85 85
86 TarHeader header = ReadHeader(); 86 TarHeader header = ReadHeader();
87 87
88 filePath = header.FilePath; 88 filePath = header.FilePath;
89 byte[] data = m_br.ReadBytes(header.FileSize); 89 byte[] data = m_br.ReadBytes(header.FileSize);
90 90
91 m_log.DebugFormat("[TAR ARCHIVE READER]: filePath {0}, fileSize {1}", filePath, header.FileSize); 91 m_log.DebugFormat("[TAR ARCHIVE READER]: filePath {0}, fileSize {1}", filePath, header.FileSize);
92 92
93 // Read the rest of the empty padding in the 512 byte block 93 // Read the rest of the empty padding in the 512 byte block
94 if (header.FileSize % 512 != 0) 94 if (header.FileSize % 512 != 0)
95 { 95 {
96 int paddingLeft = 512 - (header.FileSize % 512); 96 int paddingLeft = 512 - (header.FileSize % 512);
97 97
98 m_log.DebugFormat("[TAR ARCHIVE READER]: Reading {0} padding bytes", paddingLeft); 98 m_log.DebugFormat("[TAR ARCHIVE READER]: Reading {0} padding bytes", paddingLeft);
99 99
100 m_br.ReadBytes(paddingLeft); 100 m_br.ReadBytes(paddingLeft);
101 } 101 }
102 102
103 return data; 103 return data;
104 } 104 }
105 105
@@ -109,44 +109,44 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
109 /// </summary> 109 /// </summary>
110 /// <returns>A tar header struct.</returns> 110 /// <returns>A tar header struct.</returns>
111 protected TarHeader ReadHeader() 111 protected TarHeader ReadHeader()
112 { 112 {
113 TarHeader tarHeader = new TarHeader(); 113 TarHeader tarHeader = new TarHeader();
114 114
115 byte[] header = m_br.ReadBytes(512); 115 byte[] header = m_br.ReadBytes(512);
116 116
117 tarHeader.FilePath = m_asciiEncoding.GetString(header, 0, 100); 117 tarHeader.FilePath = m_asciiEncoding.GetString(header, 0, 100);
118 tarHeader.FilePath = tarHeader.FilePath.Trim(m_nullCharArray); 118 tarHeader.FilePath = tarHeader.FilePath.Trim(m_nullCharArray);
119 tarHeader.FileSize = ConvertOctalBytesToDecimal(header, 124, 11); 119 tarHeader.FileSize = ConvertOctalBytesToDecimal(header, 124, 11);
120 120
121 return tarHeader; 121 return tarHeader;
122 } 122 }
123 123
124 public void Close() 124 public void Close()
125 { 125 {
126 m_br.Close(); 126 m_br.Close();
127 } 127 }
128 128
129 /// <summary> 129 /// <summary>
130 /// Convert octal bytes to a decimal representation 130 /// Convert octal bytes to a decimal representation
131 /// </summary> 131 /// </summary>
132 /// <param name="bytes"></param> 132 /// <param name="bytes"></param>
133 /// <returns></returns> 133 /// <returns></returns>
134 public static int ConvertOctalBytesToDecimal(byte[] bytes, int startIndex, int count) 134 public static int ConvertOctalBytesToDecimal(byte[] bytes, int startIndex, int count)
135 { 135 {
136 string oString = m_asciiEncoding.GetString(bytes, startIndex, count); 136 string oString = m_asciiEncoding.GetString(bytes, startIndex, count);
137 137
138 int d = 0; 138 int d = 0;
139 139
140 foreach (char c in oString) 140 foreach (char c in oString)
141 { 141 {
142 d <<= 3; 142 d <<= 3;
143 d |= c - '0'; 143 d |= c - '0';
144 } 144 }
145 145
146 return d; 146 return d;
147 } 147 }
148 } 148 }
149 149
150 public struct TarHeader 150 public struct TarHeader
151 { 151 {
152 public string FilePath; 152 public string FilePath;
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs
index b7ed9f9..e0d2add 100644
--- a/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs
+++ b/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs
@@ -34,30 +34,30 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
34{ 34{
35 public interface IRegionSerialiser 35 public interface IRegionSerialiser
36 { 36 {
37 List<string> SerialiseRegion(Scene scene, string saveDir); 37 List<string> SerialiseRegion(Scene scene, string saveDir);
38 38
39 void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, LLVector3 loadOffset); 39 void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, LLVector3 loadOffset);
40 40
41 void SavePrimsToXml(Scene scene, string fileName); 41 void SavePrimsToXml(Scene scene, string fileName);
42 42
43 /// <summary> 43 /// <summary>
44 /// Load prims from the xml2 format 44 /// Load prims from the xml2 format
45 /// </summary> 45 /// </summary>
46 /// <param name="scene"></param> 46 /// <param name="scene"></param>
47 /// <param name="fileName"></param> 47 /// <param name="fileName"></param>
48 void LoadPrimsFromXml2(Scene scene, string fileName); 48 void LoadPrimsFromXml2(Scene scene, string fileName);
49 49
50 /// <summary> 50 /// <summary>
51 /// Load prims from the xml2 format 51 /// Load prims from the xml2 format
52 /// </summary> 52 /// </summary>
53 /// <param name="scene"></param> 53 /// <param name="scene"></param>
54 /// <param name="reader"></param> 54 /// <param name="reader"></param>
55 void LoadPrimsFromXml2(Scene scene, TextReader reader); 55 void LoadPrimsFromXml2(Scene scene, TextReader reader);
56 56
57 void SavePrimsToXml2(Scene scene, string fileName); 57 void SavePrimsToXml2(Scene scene, string fileName);
58 58
59 void LoadGroupFromXml2String(Scene scene, string xmlString); 59 void LoadGroupFromXml2String(Scene scene, string xmlString);
60 60
61 string SavePrimGroupToXML2String(SceneObjectGroup grp); 61 string SavePrimGroupToXML2String(SceneObjectGroup grp);
62 } 62 }
63} 63}
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
index 2ac0754..5ec8026 100644
--- a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
+++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
@@ -56,14 +56,14 @@ namespace OpenSim.Region.Environment.Scenes
56 foreach (XmlNode aPrimNode in rootNode.ChildNodes) 56 foreach (XmlNode aPrimNode in rootNode.ChildNodes)
57 { 57 {
58 SceneObjectGroup obj = new SceneObjectGroup(scene, scene.RegionInfo.RegionHandle, aPrimNode.OuterXml); 58 SceneObjectGroup obj = new SceneObjectGroup(scene, scene.RegionInfo.RegionHandle, aPrimNode.OuterXml);
59 59
60 if (newIDS) 60 if (newIDS)
61 { 61 {
62 obj.ResetIDs(); 62 obj.ResetIDs();
63 } 63 }
64 //if we want this to be a import method then we need new uuids for the object to avoid any clashes 64 //if we want this to be a import method then we need new uuids for the object to avoid any clashes
65 //obj.RegenerateFullIDs(); 65 //obj.RegenerateFullIDs();
66 66
67 scene.AddSceneObject(obj); 67 scene.AddSceneObject(obj);
68 68
69 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); 69 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
@@ -156,7 +156,7 @@ namespace OpenSim.Region.Environment.Scenes
156 { 156 {
157 LoadPrimsFromXml2(scene, new XmlTextReader(fileName)); 157 LoadPrimsFromXml2(scene, new XmlTextReader(fileName));
158 } 158 }
159 159
160 /// <summary> 160 /// <summary>
161 /// Load prims from the xml2 format 161 /// Load prims from the xml2 format
162 /// </summary> 162 /// </summary>
@@ -173,24 +173,24 @@ namespace OpenSim.Region.Environment.Scenes
173 /// <param name="scene"></param> 173 /// <param name="scene"></param>
174 /// <param name="reader"></param> 174 /// <param name="reader"></param>
175 protected static void LoadPrimsFromXml2(Scene scene, XmlTextReader reader) 175 protected static void LoadPrimsFromXml2(Scene scene, XmlTextReader reader)
176 { 176 {
177 XmlDocument doc = new XmlDocument(); 177 XmlDocument doc = new XmlDocument();
178 reader.WhitespaceHandling = WhitespaceHandling.None; 178 reader.WhitespaceHandling = WhitespaceHandling.None;
179 doc.Load(reader); 179 doc.Load(reader);
180 reader.Close(); 180 reader.Close();
181 XmlNode rootNode = doc.FirstChild; 181 XmlNode rootNode = doc.FirstChild;
182 182
183 foreach (XmlNode aPrimNode in rootNode.ChildNodes) 183 foreach (XmlNode aPrimNode in rootNode.ChildNodes)
184 { 184 {
185 CreatePrimFromXml(scene, aPrimNode.OuterXml); 185 CreatePrimFromXml(scene, aPrimNode.OuterXml);
186 } 186 }
187 } 187 }
188 188
189 public static void CreatePrimFromXml(Scene scene, string xmlData) 189 public static void CreatePrimFromXml(Scene scene, string xmlData)
190 { 190 {
191 SceneObjectGroup obj = new SceneObjectGroup(xmlData); 191 SceneObjectGroup obj = new SceneObjectGroup(xmlData);
192 LLVector3 receivedVelocity = obj.RootPart.Velocity; 192 LLVector3 receivedVelocity = obj.RootPart.Velocity;
193 //System.Console.WriteLine(obj.RootPart.Velocity.ToString()); 193 //System.Console.WriteLine(obj.RootPart.Velocity.ToString());
194 scene.AddSceneObjectFromStorage(obj); 194 scene.AddSceneObjectFromStorage(obj);
195 195
196 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); 196 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs
index b181fe8..c7c8e39 100644
--- a/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs
@@ -86,42 +86,42 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
86 #endregion 86 #endregion
87 87
88 #region IRegionSerialiser Members 88 #region IRegionSerialiser Members
89 89
90 public void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, LLVector3 loadOffset) 90 public void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, LLVector3 loadOffset)
91 { 91 {
92 SceneXmlLoader.LoadPrimsFromXml(scene, fileName, newIDS, loadOffset); 92 SceneXmlLoader.LoadPrimsFromXml(scene, fileName, newIDS, loadOffset);
93 } 93 }
94 94
95 public void SavePrimsToXml(Scene scene, string fileName) 95 public void SavePrimsToXml(Scene scene, string fileName)
96 { 96 {
97 SceneXmlLoader.SavePrimsToXml(scene, fileName); 97 SceneXmlLoader.SavePrimsToXml(scene, fileName);
98 } 98 }
99 99
100 public void LoadPrimsFromXml2(Scene scene, string fileName) 100 public void LoadPrimsFromXml2(Scene scene, string fileName)
101 { 101 {
102 SceneXmlLoader.LoadPrimsFromXml2(scene, fileName); 102 SceneXmlLoader.LoadPrimsFromXml2(scene, fileName);
103 } 103 }
104 104
105 public void LoadPrimsFromXml2(Scene scene, TextReader reader) 105 public void LoadPrimsFromXml2(Scene scene, TextReader reader)
106 { 106 {
107 SceneXmlLoader.LoadPrimsFromXml2(scene, reader); 107 SceneXmlLoader.LoadPrimsFromXml2(scene, reader);
108 } 108 }
109 109
110 public void SavePrimsToXml2(Scene scene, string fileName) 110 public void SavePrimsToXml2(Scene scene, string fileName)
111 { 111 {
112 SceneXmlLoader.SavePrimsToXml2(scene, fileName); 112 SceneXmlLoader.SavePrimsToXml2(scene, fileName);
113 } 113 }
114 114
115 public void LoadGroupFromXml2String(Scene scene, string xmlString) 115 public void LoadGroupFromXml2String(Scene scene, string xmlString)
116 { 116 {
117 SceneXmlLoader.LoadGroupFromXml2String(scene, xmlString); 117 SceneXmlLoader.LoadGroupFromXml2String(scene, xmlString);
118 } 118 }
119 119
120 public string SavePrimGroupToXML2String(SceneObjectGroup grp) 120 public string SavePrimGroupToXML2String(SceneObjectGroup grp)
121 { 121 {
122 return SceneXmlLoader.SavePrimGroupToXML2String(grp); 122 return SceneXmlLoader.SavePrimGroupToXML2String(grp);
123 } 123 }
124 124
125 public List<string> SerialiseRegion(Scene scene, string saveDir) 125 public List<string> SerialiseRegion(Scene scene, string saveDir)
126 { 126 {
127 List<string> results = new List<string>(); 127 List<string> results = new List<string>();
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 3ed4eb2..4c9257d 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -627,7 +627,7 @@ namespace OpenSim.Region.Environment.Scenes
627 #region Get Methods 627 #region Get Methods
628 628
629 /// <summary> 629 /// <summary>
630 /// Request a List of all scene presences in this scene. This is a new list, so no 630 /// Request a List of all scene presences in this scene. This is a new list, so no
631 /// locking is required to iterate over it. 631 /// locking is required to iterate over it.
632 /// </summary> 632 /// </summary>
633 /// <returns></returns> 633 /// <returns></returns>
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index c74dca4..e4fdc31 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1506,18 +1506,18 @@ namespace OpenSim.Region.Environment.Scenes
1506 1506
1507 CrossPrimGroupIntoNewRegion(newRegionHandle, grp); 1507 CrossPrimGroupIntoNewRegion(newRegionHandle, grp);
1508 } 1508 }
1509 1509
1510 public void CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp) 1510 public void CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp)
1511 { 1511 {
1512 int primcrossingXMLmethod = 0; 1512 int primcrossingXMLmethod = 0;
1513 if (newRegionHandle != 0) 1513 if (newRegionHandle != 0)
1514 { 1514 {
1515 bool successYN = false; 1515 bool successYN = false;
1516 1516
1517 successYN 1517 successYN
1518 = m_sceneGridService.PrimCrossToNeighboringRegion( 1518 = m_sceneGridService.PrimCrossToNeighboringRegion(
1519 newRegionHandle, grp.UUID, m_serialiser.SavePrimGroupToXML2String(grp), primcrossingXMLmethod); 1519 newRegionHandle, grp.UUID, m_serialiser.SavePrimGroupToXML2String(grp), primcrossingXMLmethod);
1520 1520
1521 if (successYN) 1521 if (successYN)
1522 { 1522 {
1523 // We remove the object here 1523 // We remove the object here
@@ -1550,7 +1550,7 @@ namespace OpenSim.Region.Environment.Scenes
1550 if (XMLMethod == 0) 1550 if (XMLMethod == 0)
1551 { 1551 {
1552 m_serialiser.LoadGroupFromXml2String(this, objXMLData); 1552 m_serialiser.LoadGroupFromXml2String(this, objXMLData);
1553 1553
1554 SceneObjectPart RootPrim = GetSceneObjectPart(primID); 1554 SceneObjectPart RootPrim = GetSceneObjectPart(primID);
1555 if (RootPrim != null) 1555 if (RootPrim != null)
1556 { 1556 {
@@ -2091,7 +2091,7 @@ namespace OpenSim.Region.Environment.Scenes
2091 m_log.InfoFormat("[USERLOGOFF]: Got a logoff request for {0} but the user isn't here. The user might already have been logged out", AvatarID.ToString()); 2091 m_log.InfoFormat("[USERLOGOFF]: Got a logoff request for {0} but the user isn't here. The user might already have been logged out", AvatarID.ToString());
2092 } 2092 }
2093 } 2093 }
2094 2094
2095 2095
2096 } 2096 }
2097 /// <summary> 2097 /// <summary>
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index dc9ac37..8fee27f 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -83,8 +83,8 @@ namespace OpenSim.Region.Environment.Scenes
83 Dictionary<string, IRegionModule> sharedModules = new Dictionary<string, IRegionModule>(); 83 Dictionary<string, IRegionModule> sharedModules = new Dictionary<string, IRegionModule>();
84 for (int i = 0; i < m_localScenes.Count; i++) 84 for (int i = 0; i < m_localScenes.Count; i++)
85 { 85 {
86 // extract known shared modules from scene 86 // extract known shared modules from scene
87 foreach(string k in m_localScenes[i].Modules.Keys) 87 foreach (string k in m_localScenes[i].Modules.Keys)
88 { 88 {
89 if (m_localScenes[i].Modules[k].IsSharedModule && 89 if (m_localScenes[i].Modules[k].IsSharedModule &&
90 !sharedModules.ContainsKey(k)) 90 !sharedModules.ContainsKey(k))
@@ -96,7 +96,7 @@ namespace OpenSim.Region.Environment.Scenes
96 96
97 // all regions/scenes are now closed, we can now safely 97 // all regions/scenes are now closed, we can now safely
98 // close all shared modules 98 // close all shared modules
99 foreach(IRegionModule mod in sharedModules.Values) 99 foreach (IRegionModule mod in sharedModules.Values)
100 { 100 {
101 mod.Close(); 101 mod.Close();
102 } 102 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index de5da40..ce7497d 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -1048,7 +1048,7 @@ namespace OpenSim.Region.Environment.Scenes
1048 Vector3 normalpart = ipoint - vAbsolutePosition; 1048 Vector3 normalpart = ipoint - vAbsolutePosition;
1049 returnresult.normal = normalpart / normalpart.Length; 1049 returnresult.normal = normalpart / normalpart.Length;
1050 1050
1051 // It's funny how the LLVector3 object has a Distance function, but the Axiom.Math object doesnt. 1051 // It's funny how the LLVector3 object has a Distance function, but the Axiom.Math object doesn't.
1052 // I can write a function to do it.. but I like the fact that this one is Static. 1052 // I can write a function to do it.. but I like the fact that this one is Static.
1053 1053
1054 LLVector3 distanceConvert1 = new LLVector3(iray.Origin.x, iray.Origin.y, iray.Origin.z); 1054 LLVector3 distanceConvert1 = new LLVector3(iray.Origin.x, iray.Origin.y, iray.Origin.z);
diff --git a/OpenSim/Region/Physics/Meshing/Extruder.cs b/OpenSim/Region/Physics/Meshing/Extruder.cs
index 7203aaf..3941107 100644
--- a/OpenSim/Region/Physics/Meshing/Extruder.cs
+++ b/OpenSim/Region/Physics/Meshing/Extruder.cs
@@ -89,7 +89,7 @@ namespace OpenSim.Region.Physics.Meshing
89 v.X *= (size.X * taperTopFactorX); 89 v.X *= (size.X * taperTopFactorX);
90 v.Y *= (size.Y * taperTopFactorY); 90 v.Y *= (size.Y * taperTopFactorY);
91 v.Z *= size.Z; 91 v.Z *= size.Z;
92 92
93 //Push the top of the object over by the Top Shear amount 93 //Push the top of the object over by the Top Shear amount
94 v.X += pushX * size.X; 94 v.X += pushX * size.X;
95 v.Y += pushY * size.Y; 95 v.Y += pushY * size.Y;
@@ -165,7 +165,7 @@ namespace OpenSim.Region.Physics.Meshing
165 165
166 for (int i = 0; i < workingMiddle.vertices.Count; i++) 166 for (int i = 0; i < workingMiddle.vertices.Count; i++)
167 { 167 {
168 int iNext = (i + 1); 168 int iNext = i + 1;
169 169
170 if (workingMiddle.vertices[i] == null) // Can't make a simplex here 170 if (workingMiddle.vertices[i] == null) // Can't make a simplex here
171 { 171 {
@@ -200,7 +200,7 @@ namespace OpenSim.Region.Physics.Meshing
200 iLastNull = 0; 200 iLastNull = 0;
201 for (int i = 0; i < workingPlus.vertices.Count; i++) 201 for (int i = 0; i < workingPlus.vertices.Count; i++)
202 { 202 {
203 int iNext = (i + 1); 203 int iNext = i + 1;
204 204
205 if (workingPlus.vertices[i] == null) // Can't make a simplex here 205 if (workingPlus.vertices[i] == null) // Can't make a simplex here
206 { 206 {
@@ -261,7 +261,7 @@ namespace OpenSim.Region.Physics.Meshing
261 261
262 float twistTotal = twistTop - twistBot; 262 float twistTotal = twistTop - twistBot;
263 // if the profile has a lot of twist, add more layers otherwise the layers may overlap 263 // if the profile has a lot of twist, add more layers otherwise the layers may overlap
264 // and the resulting mesh may be quite inaccurate. This method is arbitrary and doesnt 264 // and the resulting mesh may be quite inaccurate. This method is arbitrary and doesn't
265 // accurately match the viewer 265 // accurately match the viewer
266 if (System.Math.Abs(twistTotal) > (float)System.Math.PI * 1.5f) steps *= 2; 266 if (System.Math.Abs(twistTotal) > (float)System.Math.PI * 1.5f) steps *= 2;
267 if (System.Math.Abs(twistTotal) > (float)System.Math.PI * 3.0f) steps *= 2; 267 if (System.Math.Abs(twistTotal) > (float)System.Math.PI * 3.0f) steps *= 2;
@@ -291,7 +291,6 @@ namespace OpenSim.Region.Physics.Meshing
291 + " taperTopFactorX: " + taperTopFactorX.ToString() + " taperTopFactorY: " + taperTopFactorY.ToString()); 291 + " taperTopFactorX: " + taperTopFactorX.ToString() + " taperTopFactorY: " + taperTopFactorY.ToString());
292 System.Console.WriteLine("Extruder: PathScaleX: " + pathScaleX.ToString() + " pathScaleY: " + pathScaleY.ToString()); 292 System.Console.WriteLine("Extruder: PathScaleX: " + pathScaleX.ToString() + " pathScaleY: " + pathScaleY.ToString());
293#endif 293#endif
294
295 294
296 bool done = false; 295 bool done = false;
297 do // loop through the length of the path and add the layers 296 do // loop through the length of the path and add the layers
@@ -319,12 +318,16 @@ namespace OpenSim.Region.Physics.Meshing
319 318
320 // apply the taper to the profile before any rotations 319 // apply the taper to the profile before any rotations
321 if (xProfileScale != 1.0f || yProfileScale != 1.0f) 320 if (xProfileScale != 1.0f || yProfileScale != 1.0f)
321 {
322 foreach (Vertex v in newLayer.vertices) 322 foreach (Vertex v in newLayer.vertices)
323 if ( v != null ) 323 {
324 if (v != null)
324 { 325 {
325 v.X *= xProfileScale; 326 v.X *= xProfileScale;
326 v.Y *= yProfileScale; 327 v.Y *= yProfileScale;
327 } 328 }
329 }
330 }
328 331
329 float radiusScale; 332 float radiusScale;
330 333
@@ -332,8 +335,8 @@ namespace OpenSim.Region.Physics.Meshing
332 radiusScale = 1.0f - radius * percentOfPath; 335 radiusScale = 1.0f - radius * percentOfPath;
333 else if (radius < 0.001f) 336 else if (radius < 0.001f)
334 radiusScale = 1.0f + radius * (1.0f - percentOfPath); 337 radiusScale = 1.0f + radius * (1.0f - percentOfPath);
335 else radiusScale = 1.0f; 338 else
336 339 radiusScale = 1.0f;
337 340
338#if SPAM 341#if SPAM
339 System.Console.WriteLine("Extruder: angle: " + angle.ToString() + " percentOfPath: " + percentOfPath.ToString() 342 System.Console.WriteLine("Extruder: angle: " + angle.ToString() + " percentOfPath: " + percentOfPath.ToString()
@@ -379,10 +382,12 @@ namespace OpenSim.Region.Physics.Meshing
379 } 382 }
380 383
381 if (angle == startAngle) // the first layer, invert normals 384 if (angle == startAngle) // the first layer, invert normals
385 {
382 foreach (Triangle t in newLayer.triangles) 386 foreach (Triangle t in newLayer.triangles)
383 { 387 {
384 t.invertNormal(); 388 t.invertNormal();
385 } 389 }
390 }
386 391
387 result.Append(newLayer); 392 result.Append(newLayer);
388 393
@@ -397,7 +402,9 @@ namespace OpenSim.Region.Physics.Meshing
397 int iNext = (i + 1); 402 int iNext = (i + 1);
398 403
399 if (lastLayer.vertices[i] == null) // cant make a simplex here 404 if (lastLayer.vertices[i] == null) // cant make a simplex here
405 {
400 iLastNull = i + 1; 406 iLastNull = i + 1;
407 }
401 else 408 else
402 { 409 {
403 if (i == count - 1) // End of list 410 if (i == count - 1) // End of list
@@ -413,17 +420,17 @@ namespace OpenSim.Region.Physics.Meshing
413 } 420 }
414 lastLayer = newLayer; 421 lastLayer = newLayer;
415 422
416
417 // calc the angle for the next interation of the loop 423 // calc the angle for the next interation of the loop
418 if (angle >= endAngle) 424 if (angle >= endAngle)
425 {
419 done = true; 426 done = true;
427 }
420 else 428 else
421 { 429 {
422 angle = stepSize * ++step; 430 angle = stepSize * ++step;
423 if (angle > endAngle) 431 if (angle > endAngle)
424 angle = endAngle; 432 angle = endAngle;
425 } 433 }
426
427 } while (!done); // loop until all the layers in the path are completed 434 } while (!done); // loop until all the layers in the path are completed
428 435
429 // scale the mesh to the desired size 436 // scale the mesh to the desired size
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index e5167aa..6a3f464 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -178,7 +178,7 @@ namespace OpenSim.Region.ScriptEngine.Common
178 178
179 179
180 /// <summary> 180 /// <summary>
181 /// accepts a valid LLUUID, -or- a name of an inventory item. 181 /// accepts a valid LLUUID, -or- a name of an inventory item.
182 /// Returns a valid LLUUID or LLUUID.Zero if key invalid and item not found 182 /// Returns a valid LLUUID or LLUUID.Zero if key invalid and item not found
183 /// in prim inventory. 183 /// in prim inventory.
184 /// </summary> 184 /// </summary>
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
index abad59c..7113f1a 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
@@ -39,9 +39,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
39{ 39{
40 public class Compiler 40 public class Compiler
41 { 41 {
42 private static readonly log4net.ILog m_log 42 private static readonly log4net.ILog m_log
43 = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 43 = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
44 44
45 // * Uses "LSL2Converter" to convert LSL to C# if necessary. 45 // * Uses "LSL2Converter" to convert LSL to C# if necessary.
46 // * Compiles C#-code into an assembly 46 // * Compiles C#-code into an assembly
47 // * Returns assembly name ready for AppDomain load. 47 // * Returns assembly name ready for AppDomain load.
@@ -291,8 +291,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
291 291
292 if (enableCommanderLSL == true && l == enumCompileType.cs) 292 if (enableCommanderLSL == true && l == enumCompileType.cs)
293 { 293 {
294 foreach (KeyValuePair<string, 294 foreach (KeyValuePair<string,
295 ICommander> com 295 ICommander> com
296 in m_scriptEngine.World.GetCommanders()) 296 in m_scriptEngine.World.GetCommanders())
297 { 297 {
298 compileScript = com.Value.GenerateRuntimeAPI() + compileScript; 298 compileScript = com.Value.GenerateRuntimeAPI() + compileScript;
@@ -318,7 +318,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
318 m_log.Debug("[ScriptEngine.DotNetEngine]: Preparing to compile the following LSL to C# translated code"); 318 m_log.Debug("[ScriptEngine.DotNetEngine]: Preparing to compile the following LSL to C# translated code");
319 m_log.Debug(""); 319 m_log.Debug("");
320 m_log.Debug(compileScript); 320 m_log.Debug(compileScript);
321 321
322 return CompileFromDotNetText(compileScript, l); 322 return CompileFromDotNetText(compileScript, l);
323 } 323 }
324 324
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/YP2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/YP2CSConverter.cs
index 557c1c9..0bd3b0c 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/YP2CSConverter.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/YP2CSConverter.cs
@@ -75,7 +75,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
75 { 75 {
76 ListPair VFC = new ListPair(FunctionCode, new Variable()); 76 ListPair VFC = new ListPair(FunctionCode, new Variable());
77 //Console.WriteLine("-------------------------") 77 //Console.WriteLine("-------------------------")
78 //Console.WriteLine( FunctionCode.ToString()) 78 //Console.WriteLine(FunctionCode.ToString())
79 //Console.WriteLine("-------------------------") 79 //Console.WriteLine("-------------------------")
80 YPCompiler.convertFunctionCSharp(FunctionCode); 80 YPCompiler.convertFunctionCSharp(FunctionCode);
81 //YPCompiler.convertStringCodesCSharp(VFC); 81 //YPCompiler.convertStringCodesCSharp(VFC);
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Atom.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Atom.cs
index 7387ef4..0537f7d 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Atom.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Atom.cs
@@ -1,20 +1,20 @@
1/* 1/*
2 * Copyright (C) 2007-2008, Jeff Thompson 2 * Copyright (C) 2007-2008, Jeff Thompson
3 * 3 *
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright 11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors 14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software 15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission. 16 * without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -167,7 +167,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
167 return _name.GetHashCode(); 167 return _name.GetHashCode();
168 } 168 }
169 169
170 public string toQuotedString() 170 public string toQuotedString()
171 { 171 {
172 if (_name.Length == 0) 172 if (_name.Length == 0)
173 return "''"; 173 return "''";
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/BagofAnswers.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/BagofAnswers.cs
index 88ffdb7..250ad59 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/BagofAnswers.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/BagofAnswers.cs
@@ -1,20 +1,20 @@
1/* 1/*
2 * Copyright (C) 2007-2008, Jeff Thompson 2 * Copyright (C) 2007-2008, Jeff Thompson
3 * 3 *
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright 11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors 14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software 15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission. 16 * without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -47,7 +47,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
47 new TermArrayEqualityComparer(); 47 new TermArrayEqualityComparer();
48 48
49 /// <summary> 49 /// <summary>
50 /// To get the free variables, split off any existential qualifiers from Goal such as the X in 50 /// To get the free variables, split off any existential qualifiers from Goal such as the X in
51 /// "X ^ f(Y)", get the set of unbound variables in Goal that are not qualifiers, then remove 51 /// "X ^ f(Y)", get the set of unbound variables in Goal that are not qualifiers, then remove
52 /// the unbound variables that are qualifiers as well as the unbound variables in Template. 52 /// the unbound variables that are qualifiers as well as the unbound variables in Template.
53 /// </summary> 53 /// </summary>
@@ -67,7 +67,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
67 UnqualifiedGoal = YP.getValue(((Functor2)UnqualifiedGoal)._arg2); 67 UnqualifiedGoal = YP.getValue(((Functor2)UnqualifiedGoal)._arg2);
68 } 68 }
69 69
70 // Remember how many non-free variables there are so we can find the unique free variables 70 // Remember how many non-free variables there are so we can find the unique free variables
71 // that are added. 71 // that are added.
72 int nNonFreeVariables = variableSet.Count; 72 int nNonFreeVariables = variableSet.Count;
73 YP.addUniqueVariables(UnqualifiedGoal, variableSet); 73 YP.addUniqueVariables(UnqualifiedGoal, variableSet);
@@ -116,8 +116,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
116 /// <summary> 116 /// <summary>
117 /// For each result, unify the _freeVariables and unify bagArrayVariable with the associated bag. 117 /// For each result, unify the _freeVariables and unify bagArrayVariable with the associated bag.
118 /// </summary> 118 /// </summary>
119 /// <param name="bagArrayVariable">this is unified with the List<object> of matches for template that 119 /// <param name="bagArrayVariable">this is unified with the List<object> of matches for template that
120 /// corresponds to the bindings for freeVariables. Be very careful: this does not unify with a Prolog 120 /// corresponds to the bindings for freeVariables. Be very careful: this does not unify with a Prolog
121 /// list.</param> 121 /// list.</param>
122 /// <returns></returns> 122 /// <returns></returns>
123 public IEnumerable<bool> resultArray(Variable bagArrayVariable) 123 public IEnumerable<bool> resultArray(Variable bagArrayVariable)
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/FindallAnswers.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/FindallAnswers.cs
index dcd4250..cfc6788 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/FindallAnswers.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/FindallAnswers.cs
@@ -1,20 +1,20 @@
1/* 1/*
2 * Copyright (C) 2007-2008, Jeff Thompson 2 * Copyright (C) 2007-2008, Jeff Thompson
3 * 3 *
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright 11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors 14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software 15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission. 16 * without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Functor.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Functor.cs
index 58c0e4b..07993ea 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Functor.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Functor.cs
@@ -1,20 +1,20 @@
1/* 1/*
2 * Copyright (C) 2007-2008, Jeff Thompson 2 * Copyright (C) 2007-2008, Jeff Thompson
3 * 3 *
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright 11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors 14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software 15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission. 16 * without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -66,14 +66,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
66 66
67 /// <summary> 67 /// <summary>
68 /// Return an Atom, Functor1, Functor2, Functor3 or Functor depending on the 68 /// Return an Atom, Functor1, Functor2, Functor3 or Functor depending on the
69 /// length of args. 69 /// length of args.
70 /// Note that this is different than the Functor constructor which requires 70 /// Note that this is different than the Functor constructor which requires
71 /// the length of args to be greater than 3. 71 /// the length of args to be greater than 3.
72 /// </summary> 72 /// </summary>
73 /// <param name="name"></param> 73 /// <param name="name"></param>
74 /// <param name="args"></param> 74 /// <param name="args"></param>
75 /// <returns></returns> 75 /// <returns></returns>
76 public static object make(Atom name, object[] args) 76 public static object make(Atom name, object[] args)
77 { 77 {
78 if (args.Length <= 0) 78 if (args.Length <= 0)
79 return name; 79 return name;
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Functor1.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Functor1.cs
index 582cd20..114e338 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Functor1.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Functor1.cs
@@ -1,20 +1,20 @@
1/* 1/*
2 * Copyright (C) 2007-2008, Jeff Thompson 2 * Copyright (C) 2007-2008, Jeff Thompson
3 * 3 *
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright 11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors 14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software 15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission. 16 * without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Functor2.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Functor2.cs
index 138a44c..132d417 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Functor2.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Functor2.cs
@@ -1,20 +1,20 @@
1/* 1/*
2 * Copyright (C) 2007-2008, Jeff Thompson 2 * Copyright (C) 2007-2008, Jeff Thompson
3 * 3 *
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright 11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors 14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software 15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission. 16 * without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -118,7 +118,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
118 118
119 public object makeCopy(Variable.CopyStore copyStore) 119 public object makeCopy(Variable.CopyStore copyStore)
120 { 120 {
121 return new Functor2(_name, YP.makeCopy(_arg1, copyStore), 121 return new Functor2(_name, YP.makeCopy(_arg1, copyStore),
122 YP.makeCopy(_arg2, copyStore)); 122 YP.makeCopy(_arg2, copyStore));
123 } 123 }
124 124
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Functor3.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Functor3.cs
index b52fdf3..064ec19 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Functor3.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Functor3.cs
@@ -1,20 +1,20 @@
1/* 1/*
2 * Copyright (C) 2007-2008, Jeff Thompson 2 * Copyright (C) 2007-2008, Jeff Thompson
3 * 3 *
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright 11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors 14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software 15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission. 16 * without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -47,7 +47,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
47 _arg2 = arg2; 47 _arg2 = arg2;
48 _arg3 = arg3; 48 _arg3 = arg3;
49 } 49 }
50 50
51 public Functor3(string name, object arg1, object arg2, object arg3) 51 public Functor3(string name, object arg1, object arg2, object arg3)
52 : this(Atom.a(name), arg1, arg2, arg3) 52 : this(Atom.a(name), arg1, arg2, arg3)
53 { 53 {
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/IndexedAnswers.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/IndexedAnswers.cs
index 05b0a01..e1efda8 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/IndexedAnswers.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/IndexedAnswers.cs
@@ -1,20 +1,20 @@
1/* 1/*
2 * Copyright (C) 2007-2008, Jeff Thompson 2 * Copyright (C) 2007-2008, Jeff Thompson
3 * 3 *
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright 11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors 14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software 15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission. 16 * without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -73,7 +73,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
73 73
74 // If match has already indexed answers for a signature, we need to add 74 // If match has already indexed answers for a signature, we need to add
75 // this to the existing indexed answers. 75 // this to the existing indexed answers.
76 foreach(int signature in _gotAnswersForSignature.Keys) 76 foreach (int signature in _gotAnswersForSignature.Keys)
77 indexAnswerForSignature(answerCopy, signature); 77 indexAnswerForSignature(answerCopy, signature);
78 } 78 }
79 79
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/ListPair.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/ListPair.cs
index 681c445..f0669f6 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/ListPair.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/ListPair.cs
@@ -1,20 +1,20 @@
1/* 1/*
2 * Copyright (C) 2007-2008, Jeff Thompson 2 * Copyright (C) 2007-2008, Jeff Thompson
3 * 3 *
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright 11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors 14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software 15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission. 16 * without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -64,7 +64,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
64 } 64 }
65 65
66 /// <summary> 66 /// <summary>
67 /// Return a ListPair version of array, where repeated elements 67 /// Return a ListPair version of array, where repeated elements
68 /// (according to YP.termEqual) are removed. 68 /// (according to YP.termEqual) are removed.
69 /// </summary> 69 /// </summary>
70 /// <param name="array"></param> 70 /// <param name="array"></param>
@@ -89,7 +89,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
89 } 89 }
90 90
91 /// <summary> 91 /// <summary>
92 /// Return a ListPair version of array, where repeated elements 92 /// Return a ListPair version of array, where repeated elements
93 /// (according to YP.termEqual) are removed. 93 /// (according to YP.termEqual) are removed.
94 /// </summary> 94 /// </summary>
95 /// <param name="array"></param> 95 /// <param name="array"></param>
@@ -125,7 +125,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
125 125
126 public static object make(object element1, object element2, object element3) 126 public static object make(object element1, object element2, object element3)
127 { 127 {
128 return new ListPair(element1, 128 return new ListPair(element1,
129 new ListPair(element2, new ListPair(element3, Atom.NIL))); 129 new ListPair(element2, new ListPair(element3, Atom.NIL)));
130 } 130 }
131 131
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Parser.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Parser.cs
index a21a471..b2fad45 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Parser.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Parser.cs
@@ -1,20 +1,20 @@
1/* 1/*
2 * Copyright (C) 2007-2008, Jeff Thompson 2 * Copyright (C) 2007-2008, Jeff Thompson
3 * 3 *
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright 11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors 14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software 15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission. 16 * without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/PrologException.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/PrologException.cs
index 63b304a..2a23fe1 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/PrologException.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/PrologException.cs
@@ -1,20 +1,20 @@
1/* 1/*
2 * Copyright (C) 2007-2008, Jeff Thompson 2 * Copyright (C) 2007-2008, Jeff Thompson
3 * 3 *
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright 11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors 14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software 15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission. 16 * without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/UndefinedPredicateException.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/UndefinedPredicateException.cs
index f746a07..22a22b4 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/UndefinedPredicateException.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/UndefinedPredicateException.cs
@@ -1,20 +1,20 @@
1/* 1/*
2 * Copyright (C) 2007-2008, Jeff Thompson 2 * Copyright (C) 2007-2008, Jeff Thompson
3 * 3 *
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright 11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors 14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software 15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission. 16 * without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Variable.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Variable.cs
index 47b5278..7829770 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Variable.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/Variable.cs
@@ -1,20 +1,20 @@
1/* 1/*
2 * Copyright (C) 2007-2008, Jeff Thompson 2 * Copyright (C) 2007-2008, Jeff Thompson
3 * 3 *
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright 11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors 14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software 15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission. 16 * without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/YP.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/YP.cs
index 2912ab9..a03cd30 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/YP.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/YP.cs
@@ -1,20 +1,20 @@
1/* 1/*
2 * Copyright (C) 2007-2008, Jeff Thompson 2 * Copyright (C) 2007-2008, Jeff Thompson
3 * 3 *
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright 11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors 14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software 15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission. 16 * without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -650,8 +650,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
650 if (term1TypeCode == -2) 650 if (term1TypeCode == -2)
651 { 651 {
652 // Variable. 652 // Variable.
653 // We always check for equality first because we want to be sure 653 // We always check for equality first because we want to be sure
654 // that less than returns false if the terms are equal, in 654 // that less than returns false if the terms are equal, in
655 // case that the less than check really behaves like less than or equal. 655 // case that the less than check really behaves like less than or equal.
656 if ((Variable)Term1 != (Variable)Term2) 656 if ((Variable)Term1 != (Variable)Term2)
657 // The hash code should be unique to a Variable object. 657 // The hash code should be unique to a Variable object.
@@ -694,8 +694,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
694 } 694 }
695 695
696 /// <summary> 696 /// <summary>
697 /// Type code is -2 if term is a Variable, 0 if it is an Atom, 697 /// Type code is -2 if term is a Variable, 0 if it is an Atom,
698 /// 1 if it is a Functor1, 2 if it is a Functor2, 3 if it is a Functor3, 698 /// 1 if it is a Functor1, 2 if it is a Functor2, 3 if it is a Functor3,
699 /// 4 if it is Functor. 699 /// 4 if it is Functor.
700 /// Otherwise, type code is -1. 700 /// Otherwise, type code is -1.
701 /// This does not call YP.getValue(term). 701 /// This does not call YP.getValue(term).
@@ -1115,7 +1115,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
1115 IndexedAnswers indexedAnswers; 1115 IndexedAnswers indexedAnswers;
1116 if (!_predicatesStore.TryGetValue(nameArity, out clauses)) 1116 if (!_predicatesStore.TryGetValue(nameArity, out clauses))
1117 { 1117 {
1118 // Create an IndexedAnswers as the first clause of the predicate. 1118 // Create an IndexedAnswers as the first clause of the predicate.
1119 _predicatesStore[nameArity] = (clauses = new List<IClause>()); 1119 _predicatesStore[nameArity] = (clauses = new List<IClause>());
1120 clauses.Add(indexedAnswers = new IndexedAnswers()); 1120 clauses.Add(indexedAnswers = new IndexedAnswers());
1121 } 1121 }
@@ -1135,7 +1135,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
1135 List<IClause> clauses; 1135 List<IClause> clauses;
1136 if (!_predicatesStore.TryGetValue(new NameArity(name, arguments.Length), out clauses)) 1136 if (!_predicatesStore.TryGetValue(new NameArity(name, arguments.Length), out clauses))
1137 throw new UndefinedPredicateException 1137 throw new UndefinedPredicateException
1138 ("Undefined fact: " + name + "/" + arguments.Length, name, 1138 ("Undefined fact: " + name + "/" + arguments.Length, name,
1139 arguments.Length); 1139 arguments.Length);
1140 1140
1141 if (clauses.Count == 1) 1141 if (clauses.Count == 1)
@@ -1209,7 +1209,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
1209 } 1209 }
1210 1210
1211 /// <summary> 1211 /// <summary>
1212 /// Use YP.getFunctorName(Goal) and invoke the static method of this name in the 1212 /// Use YP.getFunctorName(Goal) and invoke the static method of this name in the
1213 /// declaringClass, using arguments from YP.getFunctorArgs(Goal). 1213 /// declaringClass, using arguments from YP.getFunctorArgs(Goal).
1214 /// Note that Goal must be a simple functor, not a complex expression. 1214 /// Note that Goal must be a simple functor, not a complex expression.
1215 /// If not found, this throws UndefinedPredicateException. 1215 /// If not found, this throws UndefinedPredicateException.
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/YPCompiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/YPCompiler.cs
index a0a92b6..d998bac 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/YPCompiler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/YPCompiler.cs
@@ -1,20 +1,20 @@
1/* 1/*
2 * Copyright (C) 2007-2008, Jeff Thompson 2 * Copyright (C) 2007-2008, Jeff Thompson
3 * 3 *
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright 11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors 14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software 15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission. 16 * without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandManager.cs
index 4ec7916..fdad5b0 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandManager.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandManager.cs
@@ -184,7 +184,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
184 List<Object> data = new List<Object>(); 184 List<Object> data = new List<Object>();
185 185
186 Object[] listeners=m_Listener.GetSerializationData(itemID); 186 Object[] listeners=m_Listener.GetSerializationData(itemID);
187 if(listeners.Length > 0) 187 if (listeners.Length > 0)
188 { 188 {
189 data.Add("listener"); 189 data.Add("listener");
190 data.Add(listeners.Length); 190 data.Add(listeners.Length);
@@ -192,7 +192,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
192 } 192 }
193 193
194 Object[] timers=m_Timer.GetSerializationData(itemID); 194 Object[] timers=m_Timer.GetSerializationData(itemID);
195 if(timers.Length > 0) 195 if (timers.Length > 0)
196 { 196 {
197 data.Add("timer"); 197 data.Add("timer");
198 data.Add(timers.Length); 198 data.Add(timers.Length);
@@ -200,7 +200,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
200 } 200 }
201 201
202 Object[] sensors=m_SensorRepeat.GetSerializationData(itemID); 202 Object[] sensors=m_SensorRepeat.GetSerializationData(itemID);
203 if(sensors.Length > 0) 203 if (sensors.Length > 0)
204 { 204 {
205 data.Add("sensor"); 205 data.Add("sensor");
206 data.Add(sensors.Length); 206 data.Add(sensors.Length);
@@ -211,36 +211,36 @@ namespace OpenSim.Region.ScriptEngine.XEngine
211 } 211 }
212 212
213 public void CreateFromData(uint localID, LLUUID itemID, LLUUID hostID, 213 public void CreateFromData(uint localID, LLUUID itemID, LLUUID hostID,
214 Object[] data) 214 Object[] data)
215 { 215 {
216 int idx=0; 216 int idx = 0;
217 int len; 217 int len;
218 218
219 while(idx < data.Length) 219 while (idx < data.Length)
220 { 220 {
221 string type = data[idx].ToString(); 221 string type = data[idx].ToString();
222 len = (int)data[idx+1]; 222 len = (int)data[idx+1];
223 idx+=2; 223 idx+=2;
224 224
225 if(len > 0) 225 if (len > 0)
226 { 226 {
227 Object[] item = new Object[len]; 227 Object[] item = new Object[len];
228 Array.Copy(data, idx, item, 0, len); 228 Array.Copy(data, idx, item, 0, len);
229 229
230 idx+=len; 230 idx+=len;
231 231
232 switch(type) 232 switch (type)
233 { 233 {
234 case "listener": 234 case "listener":
235 m_Listener.CreateFromData(localID, itemID, hostID, 235 m_Listener.CreateFromData(localID, itemID, hostID,
236 item); 236 item);
237 break; 237 break;
238 case "timer": 238 case "timer":
239 m_Timer.CreateFromData(localID, itemID, hostID, item); 239 m_Timer.CreateFromData(localID, itemID, hostID, item);
240 break; 240 break;
241 case "sensor": 241 case "sensor":
242 m_SensorRepeat.CreateFromData(localID, itemID, hostID, 242 m_SensorRepeat.CreateFromData(localID, itemID, hostID,
243 item); 243 item);
244 break; 244 break;
245 } 245 }
246 } 246 }
@@ -249,12 +249,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
249 249
250 #region Check llRemoteData channels 250 #region Check llRemoteData channels
251 251
252
253 #endregion 252 #endregion
254 253
255 #region Check llListeners 254 #region Check llListeners
256 255
257
258 #endregion 256 #endregion
259 257
260 /// <summary> 258 /// <summary>
diff --git a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Dataserver.cs b/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Dataserver.cs
index 794a015..47ab420 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Dataserver.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Dataserver.cs
@@ -57,11 +57,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
57 } 57 }
58 58
59 public LLUUID RegisterRequest(uint localID, LLUUID itemID, 59 public LLUUID RegisterRequest(uint localID, LLUUID itemID,
60 string identifier) 60 string identifier)
61 { 61 {
62 lock(DataserverRequests) 62 lock (DataserverRequests)
63 { 63 {
64 if(DataserverRequests.ContainsKey(identifier)) 64 if (DataserverRequests.ContainsKey(identifier))
65 return LLUUID.Zero; 65 return LLUUID.Zero;
66 66
67 DataserverRequest ds = new DataserverRequest(); 67 DataserverRequest ds = new DataserverRequest();
@@ -84,9 +84,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
84 { 84 {
85 DataserverRequest ds; 85 DataserverRequest ds;
86 86
87 lock(DataserverRequests) 87 lock (DataserverRequests)
88 { 88 {
89 if(!DataserverRequests.ContainsKey(identifier)) 89 if (!DataserverRequests.ContainsKey(identifier))
90 return; 90 return;
91 91
92 ds=DataserverRequests[identifier]; 92 ds=DataserverRequests[identifier];
@@ -94,7 +94,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
94 } 94 }
95 95
96 m_CmdManager.m_ScriptEngine.PostObjectEvent(ds.localID, 96 m_CmdManager.m_ScriptEngine.PostObjectEvent(ds.localID,
97 new XEventParams( "dataserver", new Object[] 97 new XEventParams("dataserver", new Object[]
98 { new LSL_Types.LSLString(ds.ID.ToString()), 98 { new LSL_Types.LSLString(ds.ID.ToString()),
99 new LSL_Types.LSLString(reply)}, 99 new LSL_Types.LSLString(reply)},
100 new XDetectParams[0])); 100 new XDetectParams[0]));
@@ -102,11 +102,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
102 102
103 public void RemoveEvents(uint localID, LLUUID itemID) 103 public void RemoveEvents(uint localID, LLUUID itemID)
104 { 104 {
105 lock(DataserverRequests) 105 lock (DataserverRequests)
106 { 106 {
107 foreach (DataserverRequest ds in new List<DataserverRequest>(DataserverRequests.Values)) 107 foreach (DataserverRequest ds in new List<DataserverRequest>(DataserverRequests.Values))
108 { 108 {
109 if(ds.itemID == itemID) 109 if (ds.itemID == itemID)
110 DataserverRequests.Remove(ds.handle); 110 DataserverRequests.Remove(ds.handle);
111 } 111 }
112 } 112 }
@@ -114,11 +114,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
114 114
115 public void ExpireRequests() 115 public void ExpireRequests()
116 { 116 {
117 lock(DataserverRequests) 117 lock (DataserverRequests)
118 { 118 {
119 foreach (DataserverRequest ds in new List<DataserverRequest>(DataserverRequests.Values)) 119 foreach (DataserverRequest ds in new List<DataserverRequest>(DataserverRequests.Values))
120 { 120 {
121 if(ds.startTime > DateTime.Now.AddSeconds(30)) 121 if (ds.startTime > DateTime.Now.AddSeconds(30))
122 DataserverRequests.Remove(ds.handle); 122 DataserverRequests.Remove(ds.handle);
123 } 123 }
124 } 124 }
diff --git a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Eventstream.cs b/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Eventstream.cs
index 9112b9c..dab7a0a 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Eventstream.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Eventstream.cs
@@ -55,14 +55,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
55 public void AddObjectEvent(uint localID, string eventName, XDetectParams det) 55 public void AddObjectEvent(uint localID, string eventName, XDetectParams det)
56 { 56 {
57 SceneObjectPart part = m_CmdManager.m_ScriptEngine.World. 57 SceneObjectPart part = m_CmdManager.m_ScriptEngine.World.
58 GetSceneObjectPart(localID); 58 GetSceneObjectPart(localID);
59 59
60 if(part == null) // Can't register events for non-prims 60 if (part == null) // Can't register events for non-prims
61 return; 61 return;
62 62
63 if(!part.ContainsScripts()) 63 if (!part.ContainsScripts())
64 return; 64 return;
65
66 } 65 }
67 66
68 public void RemoveObjectEvent(uint localID, string eventName, LLUUID id) 67 public void RemoveObjectEvent(uint localID, string eventName, LLUUID id)
diff --git a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/HttpRequest.cs b/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/HttpRequest.cs
index 977e3f9..089e016 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/HttpRequest.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/HttpRequest.cs
@@ -77,7 +77,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
77 77
78 foreach (XEngine xe in XEngine.ScriptEngines) 78 foreach (XEngine xe in XEngine.ScriptEngines)
79 { 79 {
80 if(xe.PostObjectEvent(httpInfo.localID, 80 if (xe.PostObjectEvent(httpInfo.localID,
81 new XEventParams("http_response", 81 new XEventParams("http_response",
82 resobj, new XDetectParams[0]))) 82 resobj, new XDetectParams[0])))
83 break; 83 break;
diff --git a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/SensorRepeat.cs
index 5a87bb0..dbd6c33 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/SensorRepeat.cs
@@ -69,7 +69,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
69 private object SenseRepeatListLock = new object(); 69 private object SenseRepeatListLock = new object();
70 70
71 public void SetSenseRepeatEvent(uint m_localID, LLUUID m_itemID, 71 public void SetSenseRepeatEvent(uint m_localID, LLUUID m_itemID,
72 string name, LLUUID keyID, int type, double range, double arc, double sec, SceneObjectPart host) 72 string name, LLUUID keyID, int type, double range,
73 double arc, double sec, SceneObjectPart host)
73 { 74 {
74 Console.WriteLine("SetSensorEvent"); 75 Console.WriteLine("SetSensorEvent");
75 76
@@ -319,7 +320,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
319 new XDetectParams[SensedObjects.Length]; 320 new XDetectParams[SensedObjects.Length];
320 321
321 int idx; 322 int idx;
322 for(idx = 0 ; idx < SensedObjects.Length; idx++) 323 for (idx = 0; idx < SensedObjects.Length; idx++)
323 { 324 {
324 detect[idx].Key=(LLUUID)(SensedObjects.Data[idx]); 325 detect[idx].Key=(LLUUID)(SensedObjects.Data[idx]);
325 } 326 }
@@ -339,7 +340,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
339 340
340 foreach (SenseRepeatClass ts in SenseRepeaters) 341 foreach (SenseRepeatClass ts in SenseRepeaters)
341 { 342 {
342 if(ts.itemID == itemID) 343 if (ts.itemID == itemID)
343 { 344 {
344 data.Add(ts.interval); 345 data.Add(ts.interval);
345 data.Add(ts.name); 346 data.Add(ts.name);
@@ -353,18 +354,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
353 } 354 }
354 355
355 public void CreateFromData(uint localID, LLUUID itemID, LLUUID objectID, 356 public void CreateFromData(uint localID, LLUUID itemID, LLUUID objectID,
356 Object[] data) 357 Object[] data)
357 { 358 {
358 SceneObjectPart part = 359 SceneObjectPart part =
359 m_CmdManager.m_ScriptEngine.World.GetSceneObjectPart( 360 m_CmdManager.m_ScriptEngine.World.GetSceneObjectPart(
360 objectID); 361 objectID);
361 362
362 if(part == null) 363 if (part == null)
363 return; 364 return;
364 365
365 int idx=0; 366 int idx = 0;
366 367
367 while(idx < data.Length) 368 while (idx < data.Length)
368 { 369 {
369 SenseRepeatClass ts = new SenseRepeatClass(); 370 SenseRepeatClass ts = new SenseRepeatClass();
370 371
@@ -380,12 +381,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
380 ts.host = part; 381 ts.host = part;
381 382
382 ts.next = 383 ts.next =
383 DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); 384 DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
384 385
385 SenseRepeaters.Add(ts); 386 SenseRepeaters.Add(ts);
386 idx += 6; 387 idx += 6;
387 } 388 }
388 } 389 }
389
390 } 390 }
391} 391}
diff --git a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Timer.cs b/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Timer.cs
index 09a5818..99be290 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Timer.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/Timer.cs
@@ -131,7 +131,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
131 { 131 {
132 foreach (TimerClass ts in Timers) 132 foreach (TimerClass ts in Timers)
133 { 133 {
134 if(ts.itemID == itemID) 134 if (ts.itemID == itemID)
135 { 135 {
136 data.Add(ts.interval); 136 data.Add(ts.interval);
137 data.Add(ts.next-DateTime.Now.Ticks); 137 data.Add(ts.next-DateTime.Now.Ticks);
@@ -142,11 +142,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
142 } 142 }
143 143
144 public void CreateFromData(uint localID, LLUUID itemID, LLUUID objectID, 144 public void CreateFromData(uint localID, LLUUID itemID, LLUUID objectID,
145 Object[] data) 145 Object[] data)
146 { 146 {
147 int idx=0; 147 int idx = 0;
148 148
149 while(idx < data.Length) 149 while (idx < data.Length)
150 { 150 {
151 TimerClass ts = new TimerClass(); 151 TimerClass ts = new TimerClass();
152 152
diff --git a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/XmlRequest.cs b/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/XmlRequest.cs
index 2714d11..288349e 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/XmlRequest.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/AsyncCommandPlugins/XmlRequest.cs
@@ -71,10 +71,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
71 71
72 foreach (XEngine xe in XEngine.ScriptEngines) 72 foreach (XEngine xe in XEngine.ScriptEngines)
73 { 73 {
74 if(xe.PostScriptEvent( 74 if (xe.PostScriptEvent(
75 rInfo.GetItemID(), new XEventParams( 75 rInfo.GetItemID(), new XEventParams(
76 "remote_data", resobj, 76 "remote_data", resobj,
77 new XDetectParams[0]))) 77 new XDetectParams[0])))
78 break; 78 break;
79 } 79 }
80 80
@@ -100,10 +100,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine.AsyncCommandPlugins
100 100
101 foreach (XEngine xe in XEngine.ScriptEngines) 101 foreach (XEngine xe in XEngine.ScriptEngines)
102 { 102 {
103 if(xe.PostScriptEvent( 103 if (xe.PostScriptEvent(
104 srdInfo.m_itemID, new XEventParams( 104 srdInfo.m_itemID, new XEventParams(
105 "remote_data", resobj, 105 "remote_data", resobj,
106 new XDetectParams[0]))) 106 new XDetectParams[0])))
107 break; 107 break;
108 } 108 }
109 109
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Compiler.cs b/OpenSim/Region/ScriptEngine/XEngine/Compiler.cs
index 980d9e6..3ff7ce0 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Compiler.cs
@@ -253,10 +253,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
253 string OutFile = Path.Combine(ScriptEnginesPath, Path.Combine( 253 string OutFile = Path.Combine(ScriptEnginesPath, Path.Combine(
254 m_scriptEngine.World.RegionInfo.RegionID.ToString(), 254 m_scriptEngine.World.RegionInfo.RegionID.ToString(),
255 FilePrefix + "_compiled_" + asset + ".dll")); 255 FilePrefix + "_compiled_" + asset + ".dll"));
256// string OutFile = Path.Combine(ScriptEnginesPath, 256// string OutFile = Path.Combine(ScriptEnginesPath,
257// FilePrefix + "_compiled_" + asset + ".dll"); 257// FilePrefix + "_compiled_" + asset + ".dll");
258 258
259 if(File.Exists(OutFile)) 259 if (File.Exists(OutFile))
260 return OutFile; 260 return OutFile;
261 261
262 if (!Directory.Exists(ScriptEnginesPath)) 262 if (!Directory.Exists(ScriptEnginesPath))
@@ -271,7 +271,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
271 } 271 }
272 272
273 if (!Directory.Exists(Path.Combine(ScriptEnginesPath, 273 if (!Directory.Exists(Path.Combine(ScriptEnginesPath,
274 m_scriptEngine.World.RegionInfo.RegionID.ToString()))) 274 m_scriptEngine.World.RegionInfo.RegionID.ToString())))
275 { 275 {
276 try 276 try
277 { 277 {
@@ -284,7 +284,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
284 284
285 enumCompileType l = DefaultCompileLanguage; 285 enumCompileType l = DefaultCompileLanguage;
286 286
287
288 if (Script.StartsWith("//c#", true, CultureInfo.InvariantCulture)) 287 if (Script.StartsWith("//c#", true, CultureInfo.InvariantCulture))
289 l = enumCompileType.cs; 288 l = enumCompileType.cs;
290 if (Script.StartsWith("//vb", true, CultureInfo.InvariantCulture)) 289 if (Script.StartsWith("//vb", true, CultureInfo.InvariantCulture))
@@ -334,7 +333,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
334 333
335 // End of insert 334 // End of insert
336 335
337
338 switch (l) 336 switch (l)
339 { 337 {
340 case enumCompileType.cs: 338 case enumCompileType.cs:
@@ -368,27 +366,25 @@ namespace OpenSim.Region.ScriptEngine.XEngine
368 366
369 private static string CreateCSCompilerScript(string compileScript) 367 private static string CreateCSCompilerScript(string compileScript)
370 { 368 {
371
372
373 compileScript = String.Empty + 369 compileScript = String.Empty +
374 "using OpenSim.Region.ScriptEngine.XEngine.Script; using System.Collections.Generic;\r\n" + 370 "using OpenSim.Region.ScriptEngine.XEngine.Script; using System.Collections.Generic;\r\n" +
375 String.Empty + "namespace SecondLife { " + 371 String.Empty + "namespace SecondLife { " +
376 String.Empty + "public class Script : OpenSim.Region.ScriptEngine.XEngine.Script.BuiltIn_Commands_BaseClass { \r\n" + 372 String.Empty + "public class Script : OpenSim.Region.ScriptEngine.XEngine.Script.BuiltIn_Commands_BaseClass { \r\n" +
377 @"public Script() { } " + 373 @"public Script() { } " +
378 compileScript + 374 compileScript +
379 "} }\r\n"; 375 "} }\r\n";
380 return compileScript; 376 return compileScript;
381 } 377 }
382 378
383 private static string CreateVBCompilerScript(string compileScript) 379 private static string CreateVBCompilerScript(string compileScript)
384 { 380 {
385 compileScript = String.Empty + 381 compileScript = String.Empty +
386 "Imports OpenSim.Region.ScriptEngine.XEngine.Script: Imports System.Collections.Generic: " + 382 "Imports OpenSim.Region.ScriptEngine.XEngine.Script: Imports System.Collections.Generic: " +
387 String.Empty + "NameSpace SecondLife:" + 383 String.Empty + "NameSpace SecondLife:" +
388 String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.XEngine.Script.BuiltIn_Commands_BaseClass: " + 384 String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.XEngine.Script.BuiltIn_Commands_BaseClass: " +
389 "\r\nPublic Sub New()\r\nEnd Sub: " + 385 "\r\nPublic Sub New()\r\nEnd Sub: " +
390 compileScript + 386 compileScript +
391 ":End Class :End Namespace\r\n"; 387 ":End Class :End Namespace\r\n";
392 return compileScript; 388 return compileScript;
393 } 389 }
394 390
@@ -404,8 +400,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
404 // Output assembly name 400 // Output assembly name
405 scriptCompileCounter++; 401 scriptCompileCounter++;
406 string OutFile = Path.Combine(ScriptEnginesPath, Path.Combine( 402 string OutFile = Path.Combine(ScriptEnginesPath, Path.Combine(
407 m_scriptEngine.World.RegionInfo.RegionID.ToString(), 403 m_scriptEngine.World.RegionInfo.RegionID.ToString(),
408 FilePrefix + "_compiled_" + asset + ".dll")); 404 FilePrefix + "_compiled_" + asset + ".dll"));
409#if DEBUG 405#if DEBUG
410// m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Starting compile of \"" + OutFile + "\"."); 406// m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Starting compile of \"" + OutFile + "\".");
411#endif 407#endif
@@ -490,8 +486,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
490 foreach (CompilerError CompErr in results.Errors) 486 foreach (CompilerError CompErr in results.Errors)
491 { 487 {
492 errtext += "Line number " + (CompErr.Line - LinesToRemoveOnError) + 488 errtext += "Line number " + (CompErr.Line - LinesToRemoveOnError) +
493 ", Error Number: " + CompErr.ErrorNumber + 489 ", Error Number: " + CompErr.ErrorNumber +
494 ", '" + CompErr.ErrorText + "'\r\n"; 490 ", '" + CompErr.ErrorText + "'\r\n";
495 } 491 }
496 if (!File.Exists(OutFile)) 492 if (!File.Exists(OutFile))
497 { 493 {
@@ -499,7 +495,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
499 } 495 }
500 } 496 }
501 497
502
503 // 498 //
504 // NO ERRORS, BUT NO COMPILED FILE 499 // NO ERRORS, BUT NO COMPILED FILE
505 // 500 //
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
index 734c837..e9ec4be 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
@@ -199,7 +199,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
199 public void on_rez(uint localID, LLUUID itemID, int startParam) 199 public void on_rez(uint localID, LLUUID itemID, int startParam)
200 { 200 {
201 myScriptEngine.PostObjectEvent(localID, new XEventParams( 201 myScriptEngine.PostObjectEvent(localID, new XEventParams(
202 "on_rez",new object[] { 202 "on_rez",new object[] {
203 new LSL_Types.LSLInteger(startParam)}, 203 new LSL_Types.LSLInteger(startParam)},
204 new XDetectParams[0])); 204 new XDetectParams[0]));
205 } 205 }
@@ -207,7 +207,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
207 public void control(uint localID, LLUUID itemID, LLUUID agentID, uint held, uint change) 207 public void control(uint localID, LLUUID itemID, LLUUID agentID, uint held, uint change)
208 { 208 {
209 myScriptEngine.PostObjectEvent(localID, new XEventParams( 209 myScriptEngine.PostObjectEvent(localID, new XEventParams(
210 "control",new object[] { 210 "control",new object[] {
211 new LSL_Types.LSLString(agentID.ToString()), 211 new LSL_Types.LSLString(agentID.ToString()),
212 new LSL_Types.LSLInteger(held), 212 new LSL_Types.LSLInteger(held),
213 new LSL_Types.LSLInteger(change)}, 213 new LSL_Types.LSLInteger(change)},
@@ -218,7 +218,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
218 string address, string subject, string message, int numLeft) 218 string address, string subject, string message, int numLeft)
219 { 219 {
220 myScriptEngine.PostObjectEvent(localID, new XEventParams( 220 myScriptEngine.PostObjectEvent(localID, new XEventParams(
221 "email",new object[] { 221 "email",new object[] {
222 new LSL_Types.LSLString(timeSent), 222 new LSL_Types.LSLString(timeSent),
223 new LSL_Types.LSLString(address), 223 new LSL_Types.LSLString(address),
224 new LSL_Types.LSLString(subject), 224 new LSL_Types.LSLString(subject),
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Executor.cs b/OpenSim/Region/ScriptEngine/XEngine/Executor.cs
index 40075ec..29336ac 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Executor.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Executor.cs
@@ -79,7 +79,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
79 } 79 }
80 80
81 // Save the flags we just computed and return the result 81 // Save the flags we just computed and return the result
82 if(eventFlags != 0) 82 if (eventFlags != 0)
83 m_stateEvents.Add(m_Script.State, eventFlags); 83 m_stateEvents.Add(m_Script.State, eventFlags);
84 84
85 //Console.WriteLine("Returning {0:x}", eventFlags); 85 //Console.WriteLine("Returning {0:x}", eventFlags);
@@ -130,7 +130,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
130#endif 130#endif
131 // Found 131 // Found
132 ev.Invoke(m_Script, args); 132 ev.Invoke(m_Script, args);
133
134 } 133 }
135 } 134 }
136} 135}
diff --git a/OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs b/OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs
index ca209b6..0f2d2a5 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs
@@ -111,8 +111,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
111 { 111 {
112 m_host.AddScriptLPS(1); 112 m_host.AddScriptLPS(1);
113 113
114 if(text.Length > 1023) 114 if (text.Length > 1023)
115 text=text.Substring(0, 1023); 115 text = text.Substring(0, 1023);
116 116
117 World.SimChat(Helpers.StringToField(text), 117 World.SimChat(Helpers.StringToField(text),
118 ChatTypeEnum.Say, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false); 118 ChatTypeEnum.Say, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false);
@@ -129,13 +129,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
129 129
130 private LLUUID InventorySelf() 130 private LLUUID InventorySelf()
131 { 131 {
132 LLUUID invItemID=new LLUUID(); 132 LLUUID invItemID = new LLUUID();
133 133
134 foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) 134 foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory)
135 { 135 {
136 if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID) 136 if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID)
137 { 137 {
138 invItemID=inv.Key; 138 invItemID = inv.Key;
139 break; 139 break;
140 } 140 }
141 } 141 }
@@ -300,7 +300,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
300 return angle; 300 return angle;
301 } 301 }
302 302
303
304 // Old implementation of llRot2Euler, now normalized 303 // Old implementation of llRot2Euler, now normalized
305 304
306 public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) 305 public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r)
@@ -322,7 +321,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
322 return new LSL_Types.Vector3(0.0, -Math.PI / 2, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); 321 return new LSL_Types.Vector3(0.0, -Math.PI / 2, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z)));
323 } 322 }
324 323
325
326 // Xantor's newer llEuler2Rot() *try the second* inverted quaternions (-x,-y,-z,w) as LL seems to like 324 // Xantor's newer llEuler2Rot() *try the second* inverted quaternions (-x,-y,-z,w) as LL seems to like
327 // New and improved, now actually works as described. Prim rotates as expected as does llRot2Euler. 325 // New and improved, now actually works as described. Prim rotates as expected as does llRot2Euler.
328 326
@@ -363,7 +361,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
363 return new LSL_Types.Quaternion(x, y, z, s); 361 return new LSL_Types.Quaternion(x, y, z, s);
364 } 362 }
365 363
366
367 public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) 364 public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up)
368 { 365 {
369 m_host.AddScriptLPS(1); 366 m_host.AddScriptLPS(1);
@@ -388,6 +385,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
388 m_host.AddScriptLPS(1); 385 m_host.AddScriptLPS(1);
389 return (new LSL_Types.Vector3(0, 0, 1) * r); 386 return (new LSL_Types.Vector3(0, 0, 1) * r);
390 } 387 }
388
391 public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 a, LSL_Types.Vector3 b) 389 public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 a, LSL_Types.Vector3 b)
392 { 390 {
393 //A and B should both be normalized 391 //A and B should both be normalized
@@ -401,12 +399,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
401 399
402 return new LSL_Types.Quaternion(axis.x * s, axis.y * s, axis.z * s, (float)Math.Cos(angle / 2)); 400 return new LSL_Types.Quaternion(axis.x * s, axis.y * s, axis.z * s, (float)Math.Cos(angle / 2));
403 } 401 }
402
404 public void llWhisper(int channelID, string text) 403 public void llWhisper(int channelID, string text)
405 { 404 {
406 m_host.AddScriptLPS(1); 405 m_host.AddScriptLPS(1);
407 406
408 if(text.Length > 1023) 407 if (text.Length > 1023)
409 text=text.Substring(0, 1023); 408 text = text.Substring(0, 1023);
410 409
411 World.SimChat(Helpers.StringToField(text), 410 World.SimChat(Helpers.StringToField(text),
412 ChatTypeEnum.Whisper, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false); 411 ChatTypeEnum.Whisper, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false);
@@ -419,8 +418,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
419 { 418 {
420 m_host.AddScriptLPS(1); 419 m_host.AddScriptLPS(1);
421 420
422 if(text.Length > 1023) 421 if (text.Length > 1023)
423 text=text.Substring(0, 1023); 422 text = text.Substring(0, 1023);
424 423
425 World.SimChat(Helpers.StringToField(text), 424 World.SimChat(Helpers.StringToField(text),
426 ChatTypeEnum.Shout, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, true); 425 ChatTypeEnum.Shout, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, true);
@@ -437,9 +436,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
437 return; 436 return;
438 } 437 }
439 438
440 439 if (text.Length > 1023)
441 if(text.Length > 1023) 440 text = text.Substring(0, 1023);
442 text=text.Substring(0, 1023);
443 441
444 m_host.AddScriptLPS(1); 442 m_host.AddScriptLPS(1);
445 443
@@ -486,7 +484,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
486 LLUUID.TryParse(id, out keyID); 484 LLUUID.TryParse(id, out keyID);
487 485
488 m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.SetSenseRepeatEvent(m_localID, m_itemID, name, keyID, type, range, arc, rate, m_host); 486 m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.SetSenseRepeatEvent(m_localID, m_itemID, name, keyID, type, range, arc, rate, m_host);
489 } 487 }
490 488
491 public void llSensorRemove() 489 public void llSensorRemove()
492 { 490 {
@@ -520,17 +518,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
520 if (SensedObject == null) 518 if (SensedObject == null)
521 return String.Empty; 519 return String.Empty;
522 return SensedObject.Name; 520 return SensedObject.Name;
523
524 } 521 }
525 522
526 public string llDetectedName(int number) 523 public string llDetectedName(int number)
527 { 524 {
528 m_host.AddScriptLPS(1); 525 m_host.AddScriptLPS(1);
529 LLUUID sensedUUID = m_ScriptEngine.GetDetectID(m_itemID, number); 526 LLUUID sensedUUID = m_ScriptEngine.GetDetectID(m_itemID, number);
530 if(sensedUUID != null) 527 if (sensedUUID != null)
531 return resolveName(sensedUUID); 528 return resolveName(sensedUUID);
532 return String.Empty; 529 return String.Empty;
533 } 530 }
534 531
535 public LLUUID uuidDetectedKey(int number) 532 public LLUUID uuidDetectedKey(int number)
536 { 533 {
@@ -540,7 +537,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
540 public EntityBase entityDetectedKey(int number) 537 public EntityBase entityDetectedKey(int number)
541 { 538 {
542 LLUUID sensedUUID = m_ScriptEngine.GetDetectID(m_itemID, number); 539 LLUUID sensedUUID = m_ScriptEngine.GetDetectID(m_itemID, number);
543 if(sensedUUID != null) 540 if (sensedUUID != null)
544 { 541 {
545 EntityBase SensedObject = null; 542 EntityBase SensedObject = null;
546 lock (World.Entities) 543 lock (World.Entities)
@@ -567,7 +564,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
567 // returns UUID of owner of object detected 564 // returns UUID of owner of object detected
568 m_host.AddScriptLPS(1); 565 m_host.AddScriptLPS(1);
569 EntityBase SensedObject = entityDetectedKey(number); 566 EntityBase SensedObject = entityDetectedKey(number);
570 if (SensedObject ==null) 567 if (SensedObject == null)
571 return String.Empty; 568 return String.Empty;
572 LLUUID SensedUUID = uuidDetectedKey(number); 569 LLUUID SensedUUID = uuidDetectedKey(number);
573 if (World.GetScenePresence(SensedUUID) == null) 570 if (World.GetScenePresence(SensedUUID) == null)
@@ -575,7 +572,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
575 // sensed object is not an avatar 572 // sensed object is not an avatar
576 // so get the owner of the sensed object 573 // so get the owner of the sensed object
577 SceneObjectPart SOP = World.GetSceneObjectPart(SensedUUID); 574 SceneObjectPart SOP = World.GetSceneObjectPart(SensedUUID);
578 if (SOP != null) { return SOP.ObjectOwner.ToString(); } 575 if (SOP != null)
576 {
577 return SOP.ObjectOwner.ToString();
578 }
579 } 579 }
580 else 580 else
581 { 581 {
@@ -583,9 +583,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
583 return SensedUUID.ToString(); 583 return SensedUUID.ToString();
584 } 584 }
585 585
586
587 return String.Empty; 586 return String.Empty;
588
589 } 587 }
590 588
591 public LSL_Types.LSLInteger llDetectedType(int number) 589 public LSL_Types.LSLInteger llDetectedType(int number)
@@ -599,14 +597,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
599 LLUUID SensedUUID = uuidDetectedKey(number); 597 LLUUID SensedUUID = uuidDetectedKey(number);
600 LSL_Types.Vector3 ZeroVector = new LSL_Types.Vector3(0, 0, 0); 598 LSL_Types.Vector3 ZeroVector = new LSL_Types.Vector3(0, 0, 0);
601 599
602 if (World.GetScenePresence(SensedUUID) != null) mask |= 0x01; // actor 600 if (World.GetScenePresence(SensedUUID) != null)
601 mask |= 0x01; // actor
602
603 if (SensedObject.Velocity.Equals(ZeroVector)) 603 if (SensedObject.Velocity.Equals(ZeroVector))
604 mask |= 0x04; // passive non-moving 604 mask |= 0x04; // passive non-moving
605 else 605 else
606 mask |= 0x02; // active moving 606 mask |= 0x02; // active moving
607 if (SensedObject is IScript) mask |= 0x08; // Scripted. It COULD have one hidden ...
608 return mask;
609 607
608 if (SensedObject is IScript)
609 mask |= 0x08; // Scripted. It COULD have one hidden ...
610
611 return mask;
610 } 612 }
611 613
612 public LSL_Types.Vector3 llDetectedPos(int number) 614 public LSL_Types.Vector3 llDetectedPos(int number)
@@ -627,7 +629,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
627 return new LSL_Types.Vector3(0, 0, 0); 629 return new LSL_Types.Vector3(0, 0, 0);
628 630
629 return new LSL_Types.Vector3(SensedObject.Velocity.X, SensedObject.Velocity.Y, SensedObject.Velocity.Z); 631 return new LSL_Types.Vector3(SensedObject.Velocity.X, SensedObject.Velocity.Y, SensedObject.Velocity.Z);
630 // return new LSL_Types.Vector3(); 632 // return new LSL_Types.Vector3();
631 } 633 }
632 634
633 public LSL_Types.Vector3 llDetectedGrab(int number) 635 public LSL_Types.Vector3 llDetectedGrab(int number)
@@ -702,8 +704,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
702 m_host.ScriptSetPhysicsStatus(true); 704 m_host.ScriptSetPhysicsStatus(true);
703 else 705 else
704 m_host.ScriptSetPhysicsStatus(false); 706 m_host.ScriptSetPhysicsStatus(false);
705
706 } 707 }
708
707 if ((status & BuiltIn_Commands_BaseClass.STATUS_PHANTOM) == BuiltIn_Commands_BaseClass.STATUS_PHANTOM) 709 if ((status & BuiltIn_Commands_BaseClass.STATUS_PHANTOM) == BuiltIn_Commands_BaseClass.STATUS_PHANTOM)
708 { 710 {
709 if (value == 1) 711 if (value == 1)
@@ -711,27 +713,32 @@ namespace OpenSim.Region.ScriptEngine.XEngine
711 else 713 else
712 m_host.ScriptSetPhantomStatus(false); 714 m_host.ScriptSetPhantomStatus(false);
713 } 715 }
716
714 if ((status & BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) == BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) 717 if ((status & BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) == BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS)
715 { 718 {
716 m_host.AddFlag(LLObject.ObjectFlags.CastShadows); 719 m_host.AddFlag(LLObject.ObjectFlags.CastShadows);
717 } 720 }
721
718 if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_X) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_X) 722 if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_X) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_X)
719 { 723 {
720 statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_X; 724 statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_X;
721
722 } 725 }
726
723 if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y) 727 if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y)
724 { 728 {
725 statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y; 729 statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y;
726 } 730 }
731
727 if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z) 732 if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z)
728 { 733 {
729 statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z; 734 statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z;
730 } 735 }
736
731 if ((status & BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB) == BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB) 737 if ((status & BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB) == BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB)
732 { 738 {
733 NotImplemented("llSetStatus - STATUS_BLOCK_GRAB"); 739 NotImplemented("llSetStatus - STATUS_BLOCK_GRAB");
734 } 740 }
741
735 if ((status & BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE) == BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE) 742 if ((status & BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE) == BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE)
736 { 743 {
737 if (value == 1) 744 if (value == 1)
@@ -739,18 +746,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine
739 else 746 else
740 m_host.SetDieAtEdge(false); 747 m_host.SetDieAtEdge(false);
741 } 748 }
749
742 if ((status & BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE) == BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE) 750 if ((status & BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE) == BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE)
743 { 751 {
744 NotImplemented("llSetStatus - STATUS_RETURN_AT_EDGE"); 752 NotImplemented("llSetStatus - STATUS_RETURN_AT_EDGE");
745 } 753 }
754
746 if ((status & BuiltIn_Commands_BaseClass.STATUS_SANDBOX) == BuiltIn_Commands_BaseClass.STATUS_SANDBOX) 755 if ((status & BuiltIn_Commands_BaseClass.STATUS_SANDBOX) == BuiltIn_Commands_BaseClass.STATUS_SANDBOX)
747 { 756 {
748 NotImplemented("llSetStatus - STATUS_SANDBOX"); 757 NotImplemented("llSetStatus - STATUS_SANDBOX");
749 } 758 }
759
750 if (statusrotationaxis != 0) 760 if (statusrotationaxis != 0)
751 { 761 {
752 m_host.SetAxisRotation(statusrotationaxis, value); 762 m_host.SetAxisRotation(statusrotationaxis, value);
753
754 } 763 }
755 } 764 }
756 765
@@ -766,23 +775,26 @@ namespace OpenSim.Region.ScriptEngine.XEngine
766 return 1; 775 return 1;
767 } 776 }
768 return 0; 777 return 0;
778
769 case BuiltIn_Commands_BaseClass.STATUS_PHANTOM: 779 case BuiltIn_Commands_BaseClass.STATUS_PHANTOM:
770 if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Phantom) == (uint)LLObject.ObjectFlags.Phantom) 780 if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Phantom) == (uint)LLObject.ObjectFlags.Phantom)
771 { 781 {
772 return 1; 782 return 1;
773 } 783 }
774 return 0; 784 return 0;
785
775 case BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS: 786 case BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS:
776 if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.CastShadows) == (uint)LLObject.ObjectFlags.CastShadows) 787 if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.CastShadows) == (uint)LLObject.ObjectFlags.CastShadows)
777 { 788 {
778 return 1; 789 return 1;
779 } 790 }
780 return 0; 791 return 0;
792
781 case BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB: 793 case BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB:
782 NotImplemented("llGetStatus - STATUS_BLOCK_GRAB"); 794 NotImplemented("llGetStatus - STATUS_BLOCK_GRAB");
783 return 0; 795 return 0;
784 case BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE:
785 796
797 case BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE:
786 if (m_host.GetDieAtEdge()) 798 if (m_host.GetDieAtEdge())
787 return 1; 799 return 1;
788 else 800 else
@@ -791,15 +803,19 @@ namespace OpenSim.Region.ScriptEngine.XEngine
791 case BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE: 803 case BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE:
792 NotImplemented("llGetStatus - STATUS_RETURN_AT_EDGE"); 804 NotImplemented("llGetStatus - STATUS_RETURN_AT_EDGE");
793 return 0; 805 return 0;
806
794 case BuiltIn_Commands_BaseClass.STATUS_ROTATE_X: 807 case BuiltIn_Commands_BaseClass.STATUS_ROTATE_X:
795 NotImplemented("llGetStatus - STATUS_ROTATE_X"); 808 NotImplemented("llGetStatus - STATUS_ROTATE_X");
796 return 0; 809 return 0;
810
797 case BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y: 811 case BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y:
798 NotImplemented("llGetStatus - STATUS_ROTATE_Y"); 812 NotImplemented("llGetStatus - STATUS_ROTATE_Y");
799 return 0; 813 return 0;
814
800 case BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z: 815 case BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z:
801 NotImplemented("llGetStatus - STATUS_ROTATE_Z"); 816 NotImplemented("llGetStatus - STATUS_ROTATE_Z");
802 return 0; 817 return 0;
818
803 case BuiltIn_Commands_BaseClass.STATUS_SANDBOX: 819 case BuiltIn_Commands_BaseClass.STATUS_SANDBOX:
804 NotImplemented("llGetStatus - STATUS_SANDBOX"); 820 NotImplemented("llGetStatus - STATUS_SANDBOX");
805 return 0; 821 return 0;
@@ -2499,17 +2515,17 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2499 2515
2500 string reply = String.Empty; 2516 string reply = String.Empty;
2501 2517
2502 switch(data) 2518 switch (data)
2503 { 2519 {
2504 case 1: // DATA_ONLINE (0|1) 2520 case 1: // DATA_ONLINE (0|1)
2505 // TODO: implement fetching of this information 2521 // TODO: implement fetching of this information
2506// if(userProfile.CurrentAgent.AgentOnline) 2522// if (userProfile.CurrentAgent.AgentOnline)
2507// reply = "1"; 2523// reply = "1";
2508// else 2524// else
2509 reply = "0"; 2525 reply = "0";
2510 break; 2526 break;
2511 case 2: // DATA_NAME (First Last) 2527 case 2: // DATA_NAME (First Last)
2512 reply = userProfile.FirstName+" "+userProfile.SurName; 2528 reply = userProfile.FirstName + " " + userProfile.SurName;
2513 break; 2529 break;
2514 case 3: // DATA_BORN (YYYY-MM-DD) 2530 case 3: // DATA_BORN (YYYY-MM-DD)
2515 DateTime born = new DateTime(1970, 1, 1, 0, 0, 0, 0); 2531 DateTime born = new DateTime(1970, 1, 1, 0, 0, 0, 0);
@@ -2529,8 +2545,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2529 LLUUID rq = LLUUID.Random(); 2545 LLUUID rq = LLUUID.Random();
2530 2546
2531 LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. 2547 LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager.
2532 m_Dataserver.RegisterRequest(m_localID, 2548 m_Dataserver.RegisterRequest(m_localID,
2533 m_itemID, rq.ToString()); 2549 m_itemID, rq.ToString());
2534 2550
2535 m_ScriptEngine.m_ASYNCLSLCommandManager. 2551 m_ScriptEngine.m_ASYNCLSLCommandManager.
2536 m_Dataserver.DataserverReply(rq.ToString(), reply); 2552 m_Dataserver.DataserverReply(rq.ToString(), reply);
@@ -2547,8 +2563,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2547 if (item.Type == 3 && item.Name == name) 2563 if (item.Type == 3 && item.Name == name)
2548 { 2564 {
2549 LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. 2565 LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager.
2550 m_Dataserver.RegisterRequest(m_localID, 2566 m_Dataserver.RegisterRequest(m_localID,
2551 m_itemID, item.AssetID.ToString()); 2567 m_itemID, item.AssetID.ToString());
2552 2568
2553 LLVector3 region = new LLVector3( 2569 LLVector3 region = new LLVector3(
2554 World.RegionInfo.RegionLocX * Constants.RegionSize, 2570 World.RegionInfo.RegionLocX * Constants.RegionSize,
@@ -2565,8 +2581,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2565 string reply = region.ToString(); 2581 string reply = region.ToString();
2566 2582
2567 m_ScriptEngine.m_ASYNCLSLCommandManager. 2583 m_ScriptEngine.m_ASYNCLSLCommandManager.
2568 m_Dataserver.DataserverReply(i.ToString(), 2584 m_Dataserver.DataserverReply(i.ToString(),
2569 reply); 2585 reply);
2570 }, false); 2586 }, false);
2571 2587
2572 return tid.ToString(); 2588 return tid.ToString();
@@ -3314,25 +3330,28 @@ namespace OpenSim.Region.ScriptEngine.XEngine
3314 { 3330 {
3315 switch (src[i]) 3331 switch (src[i])
3316 { 3332 {
3317 case '<' : 3333 case '<':
3318 parens++; 3334 parens++;
3319 length++; 3335 length++;
3320 break; 3336 break;
3321 case '>' : 3337 case '>':
3322 if (parens > 0) 3338 if (parens > 0)
3323 parens--; 3339 parens--;
3324 length++; 3340 length++;
3325 break; 3341 break;
3326 case ',' : 3342 case ',':
3327 if (parens == 0) 3343 if (parens == 0)
3328 { 3344 {
3329 result.Add(src.Substring(start,length).Trim()); 3345 result.Add(src.Substring(start,length).Trim());
3330 start += length+1; 3346 start += length+1;
3331 length = 0; 3347 length = 0;
3332 } else 3348 }
3349 else
3350 {
3333 length++; 3351 length++;
3352 }
3334 break; 3353 break;
3335 default : 3354 default:
3336 length++; 3355 length++;
3337 break; 3356 break;
3338 } 3357 }
@@ -3341,7 +3360,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
3341 result.Add(src.Substring(start,length).Trim()); 3360 result.Add(src.Substring(start,length).Trim());
3342 3361
3343 return result; 3362 return result;
3344
3345 } 3363 }
3346 3364
3347 /// <summary> 3365 /// <summary>
@@ -5290,11 +5308,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
5290 if (active[j]) 5308 if (active[j])
5291 { 5309 {
5292 // scan all of the markers 5310 // scan all of the markers
5293 if ((offset[j] = src.IndexOf((string)spcarray[j-seplen],beginning)) == -1) 5311 if ((offset[j] = src.IndexOf((string)spcarray[j-seplen], beginning)) == -1)
5294 { 5312 {
5295 // not present at all 5313 // not present at all
5296 active[j] = false; 5314 active[j] = false;
5297 } else 5315 }
5316 else
5298 { 5317 {
5299 // present and correct 5318 // present and correct
5300 if (offset[j] < offset[best]) 5319 if (offset[j] < offset[best])
@@ -5313,7 +5332,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
5313 { 5332 {
5314 // no markers were found on this pass 5333 // no markers were found on this pass
5315 // so we're pretty much done 5334 // so we're pretty much done
5316 tokens.Add(src.Substring(beginning, srclen-beginning)); 5335 tokens.Add(src.Substring(beginning, srclen - beginning));
5317 break; 5336 break;
5318 } 5337 }
5319 5338
@@ -5322,15 +5341,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
5322 5341
5323 tokens.Add(src.Substring(beginning,offset[best]-beginning)); 5342 tokens.Add(src.Substring(beginning,offset[best]-beginning));
5324 5343
5325 if (best<seplen) 5344 if (best < seplen)
5326 { 5345 {
5327 beginning = offset[best]+((string)separray[best]).Length; 5346 beginning = offset[best] + ((string)separray[best]).Length;
5328 } else 5347 }
5348 else
5329 { 5349 {
5330 beginning = offset[best]+((string)spcarray[best-seplen]).Length; 5350 beginning = offset[best] + ((string)spcarray[best - seplen]).Length;
5331 tokens.Add(spcarray[best-seplen]); 5351 tokens.Add(spcarray[best - seplen]);
5332 } 5352 }
5333
5334 } 5353 }
5335 5354
5336 // This an awkward an not very intuitive boundary case. If the 5355 // This an awkward an not very intuitive boundary case. If the
@@ -5475,60 +5494,60 @@ namespace OpenSim.Region.ScriptEngine.XEngine
5475 5494
5476 public string llRequestSimulatorData(string simulator, int data) 5495 public string llRequestSimulatorData(string simulator, int data)
5477 { 5496 {
5478try 5497 try
5479{ 5498 {
5480 m_host.AddScriptLPS(1); 5499 m_host.AddScriptLPS(1);
5481 5500
5482 string reply = String.Empty; 5501 string reply = String.Empty;
5483 5502
5484 RegionInfo info = m_ScriptEngine.World.RequestClosestRegion(simulator); 5503 RegionInfo info = m_ScriptEngine.World.RequestClosestRegion(simulator);
5485 5504
5486 switch(data) 5505 switch (data)
5487 { 5506 {
5488 case 5: // DATA_SIM_POS 5507 case 5: // DATA_SIM_POS
5489 if(info == null) 5508 if (info == null)
5490 return LLUUID.Zero.ToString(); 5509 return LLUUID.Zero.ToString();
5491 reply = new LSL_Types.Vector3( 5510 reply = new LSL_Types.Vector3(
5492 info.RegionLocX * Constants.RegionSize, 5511 info.RegionLocX * Constants.RegionSize,
5493 info.RegionLocY * Constants.RegionSize, 5512 info.RegionLocY * Constants.RegionSize,
5494 0).ToString(); 5513 0).ToString();
5495 break; 5514 break;
5496 case 6: // DATA_SIM_STATUS 5515 case 6: // DATA_SIM_STATUS
5497 if(info != null) 5516 if (info != null)
5498 reply = "up"; // Duh! 5517 reply = "up"; // Duh!
5499 else 5518 else
5500 reply = "unknown"; 5519 reply = "unknown";
5501 break; 5520 break;
5502 case 7: // DATA_SIM_RATING 5521 case 7: // DATA_SIM_RATING
5503 if(info == null) 5522 if (info == null)
5504 return LLUUID.Zero.ToString(); 5523 return LLUUID.Zero.ToString();
5505 int access = (int)info.EstateSettings.simAccess; 5524 int access = (int)info.EstateSettings.simAccess;
5506 if(access == 21) 5525 if (access == 21)
5507 reply = "MATURE"; 5526 reply = "MATURE";
5508 else if(access == 13) 5527 else if (access == 13)
5509 reply = "MATURE"; 5528 reply = "MATURE";
5510 else 5529 else
5511 reply = "UNKNOWN"; 5530 reply = "UNKNOWN";
5512 break; 5531 break;
5513 default: 5532 default:
5514 return LLUUID.Zero.ToString(); // Raise no event 5533 return LLUUID.Zero.ToString(); // Raise no event
5515 } 5534 }
5516 LLUUID rq = LLUUID.Random(); 5535 LLUUID rq = LLUUID.Random();
5517 5536
5518 LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. 5537 LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager.
5519 m_Dataserver.RegisterRequest(m_localID, 5538 m_Dataserver.RegisterRequest(m_localID,
5520 m_itemID, rq.ToString()); 5539 m_itemID, rq.ToString());
5521 5540
5522 m_ScriptEngine.m_ASYNCLSLCommandManager. 5541 m_ScriptEngine.m_ASYNCLSLCommandManager.
5523 m_Dataserver.DataserverReply(rq.ToString(), reply); 5542 m_Dataserver.DataserverReply(rq.ToString(), reply);
5524 5543
5525 return tid.ToString(); 5544 return tid.ToString();
5526} 5545 }
5527catch(Exception e) 5546 catch(Exception e)
5528{ 5547 {
5529Console.WriteLine(e.ToString()); 5548 Console.WriteLine(e.ToString());
5530return LLUUID.Zero.ToString(); 5549 return LLUUID.Zero.ToString();
5531} 5550 }
5532 } 5551 }
5533 5552
5534 public void llForceMouselook(int mouselook) 5553 public void llForceMouselook(int mouselook)
@@ -5543,7 +5562,7 @@ return LLUUID.Zero.ToString();
5543 LLUUID key = new LLUUID(); 5562 LLUUID key = new LLUUID();
5544 if (LLUUID.TryParse(id,out key)) 5563 if (LLUUID.TryParse(id,out key))
5545 { 5564 {
5546 return (double)World.GetSceneObjectPart(World.Entities[key].LocalId).GetMass(); 5565 return (double) World.GetSceneObjectPart(World.Entities[key].LocalId).GetMass();
5547 } 5566 }
5548 return 0; 5567 return 0;
5549 } 5568 }
@@ -5562,7 +5581,6 @@ return LLUUID.Zero.ToString();
5562 5581
5563 public LSL_Types.list llListReplaceList(LSL_Types.list dest, LSL_Types.list src, int start, int end) 5582 public LSL_Types.list llListReplaceList(LSL_Types.list dest, LSL_Types.list src, int start, int end)
5564 { 5583 {
5565
5566 LSL_Types.list pref = null; 5584 LSL_Types.list pref = null;
5567 5585
5568 m_host.AddScriptLPS(1); 5586 m_host.AddScriptLPS(1);
@@ -5592,9 +5610,9 @@ return LLUUID.Zero.ToString();
5592 pref = dest.GetSublist(0,start-1); 5610 pref = dest.GetSublist(0,start-1);
5593 // Only add a suffix if there is something 5611 // Only add a suffix if there is something
5594 // beyond the end index (it's inclusive too). 5612 // beyond the end index (it's inclusive too).
5595 if (end+1 < dest.Length) 5613 if (end + 1 < dest.Length)
5596 { 5614 {
5597 return pref + src + dest.GetSublist(end+1,-1); 5615 return pref + src + dest.GetSublist(end + 1, -1);
5598 } 5616 }
5599 else 5617 else
5600 { 5618 {
@@ -5609,9 +5627,9 @@ return LLUUID.Zero.ToString();
5609 // is removed. 5627 // is removed.
5610 else 5628 else
5611 { 5629 {
5612 if (end+1 < dest.Length) 5630 if (end + 1 < dest.Length)
5613 { 5631 {
5614 return src + dest.GetSublist(end+1,-1); 5632 return src + dest.GetSublist(end + 1, -1);
5615 } 5633 }
5616 else 5634 else
5617 { 5635 {
@@ -5627,7 +5645,7 @@ return LLUUID.Zero.ToString();
5627 // might have been negative. 5645 // might have been negative.
5628 else 5646 else
5629 { 5647 {
5630 return dest.GetSublist(end+1,start-1)+src; 5648 return dest.GetSublist(end + 1, start - 1) + src;
5631 } 5649 }
5632 } 5650 }
5633 5651
@@ -6250,7 +6268,7 @@ return LLUUID.Zero.ToString();
6250 LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. 6268 LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager.
6251 m_Dataserver.RegisterRequest(m_localID, 6269 m_Dataserver.RegisterRequest(m_localID,
6252 m_itemID, item.AssetID.ToString()); 6270 m_itemID, item.AssetID.ToString());
6253 if(NotecardCache.IsCached(item.AssetID)) 6271 if (NotecardCache.IsCached(item.AssetID))
6254 { 6272 {
6255 m_ScriptEngine.m_ASYNCLSLCommandManager. 6273 m_ScriptEngine.m_ASYNCLSLCommandManager.
6256 m_Dataserver.DataserverReply(item.AssetID.ToString(), 6274 m_Dataserver.DataserverReply(item.AssetID.ToString(),
@@ -6286,7 +6304,7 @@ return LLUUID.Zero.ToString();
6286 LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. 6304 LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager.
6287 m_Dataserver.RegisterRequest(m_localID, 6305 m_Dataserver.RegisterRequest(m_localID,
6288 m_itemID, item.AssetID.ToString()); 6306 m_itemID, item.AssetID.ToString());
6289 if(NotecardCache.IsCached(item.AssetID)) 6307 if (NotecardCache.IsCached(item.AssetID))
6290 { 6308 {
6291 m_ScriptEngine.m_ASYNCLSLCommandManager. 6309 m_ScriptEngine.m_ASYNCLSLCommandManager.
6292 m_Dataserver.DataserverReply(item.AssetID.ToString(), 6310 m_Dataserver.DataserverReply(item.AssetID.ToString(),
@@ -6329,13 +6347,13 @@ return LLUUID.Zero.ToString();
6329 { 6347 {
6330 CacheCheck(); 6348 CacheCheck();
6331 6349
6332 lock(m_Notecards) 6350 lock (m_Notecards)
6333 { 6351 {
6334 if(m_Notecards.ContainsKey(assetID)) 6352 if (m_Notecards.ContainsKey(assetID))
6335 return; 6353 return;
6336 6354
6337 Notecard nc = new Notecard(); 6355 Notecard nc = new Notecard();
6338 nc.lastRef=DateTime.Now; 6356 nc.lastRef = DateTime.Now;
6339 nc.text = ParseText(text.Replace("\r", "").Split('\n')); 6357 nc.text = ParseText(text.Replace("\r", "").Split('\n'));
6340 m_Notecards[assetID] = nc; 6358 m_Notecards[assetID] = nc;
6341 } 6359 }
@@ -6343,56 +6361,57 @@ return LLUUID.Zero.ToString();
6343 6361
6344 private static string[] ParseText(string[] input) 6362 private static string[] ParseText(string[] input)
6345 { 6363 {
6346 int idx=0; 6364 int idx = 0;
6347 int level=0; 6365 int level = 0;
6348 List<string> output = new List<string>(); 6366 List<string> output = new List<string>();
6349 string[] words; 6367 string[] words;
6350 6368
6351 while(idx < input.Length) 6369 while (idx < input.Length)
6352 { 6370 {
6353 if(input[idx] == "{") 6371 if (input[idx] == "{")
6354 { 6372 {
6355 level++; 6373 level++;
6356 idx++; 6374 idx++;
6357 continue; 6375 continue;
6358 } 6376 }
6359 if(input[idx]== "}") 6377
6378 if (input[idx]== "}")
6360 { 6379 {
6361 level--; 6380 level--;
6362 idx++; 6381 idx++;
6363 continue; 6382 continue;
6364 } 6383 }
6365 6384
6366 switch(level) 6385 switch (level)
6367 { 6386 {
6368 case 0: 6387 case 0:
6369 words = input[idx].Split(' '); // Linden text ver 6388 words = input[idx].Split(' '); // Linden text ver
6370 int version = int.Parse(words[3]); 6389 int version = int.Parse(words[3]);
6371 if(version != 2) 6390 if (version != 2)
6372 return new String[0]; 6391 return new String[0];
6373 break; 6392 break;
6374 case 1: 6393 case 1:
6375 words = input[idx].Split(' '); 6394 words = input[idx].Split(' ');
6376 if(words[0] == "LLEmbeddedItems") 6395 if (words[0] == "LLEmbeddedItems")
6377 break; 6396 break;
6378 if(words[0] == "Text") 6397 if (words[0] == "Text")
6379 { 6398 {
6380 int len = int.Parse(words[2]); 6399 int len = int.Parse(words[2]);
6381 idx++; 6400 idx++;
6382 6401
6383 int count=-1; 6402 int count = -1;
6384 6403
6385 while(count < len) 6404 while (count < len)
6386 { 6405 {
6387 int l = input[idx].Length; 6406 int l = input[idx].Length;
6388 string ln = input[idx]; 6407 string ln = input[idx];
6389 6408
6390 int need = len-count-1; 6409 int need = len-count-1;
6391 if(ln.Length > need) 6410 if (ln.Length > need)
6392 ln=ln.Substring(0, need); 6411 ln = ln.Substring(0, need);
6393 6412
6394 output.Add(ln); 6413 output.Add(ln);
6395 count+=ln.Length+1; 6414 count += ln.Length + 1;
6396 idx++; 6415 idx++;
6397 } 6416 }
6398 6417
@@ -6401,10 +6420,10 @@ return LLUUID.Zero.ToString();
6401 break; 6420 break;
6402 case 2: 6421 case 2:
6403 words = input[idx].Split(' '); // count 6422 words = input[idx].Split(' '); // count
6404 if(words[0] == "count") 6423 if (words[0] == "count")
6405 { 6424 {
6406 int c = int.Parse(words[1]); 6425 int c = int.Parse(words[1]);
6407 if(c > 0) 6426 if (c > 0)
6408 return new String[0]; 6427 return new String[0];
6409 break; 6428 break;
6410 } 6429 }
@@ -6417,7 +6436,7 @@ return LLUUID.Zero.ToString();
6417 6436
6418 public static bool IsCached(LLUUID assetID) 6437 public static bool IsCached(LLUUID assetID)
6419 { 6438 {
6420 lock(m_Notecards) 6439 lock (m_Notecards)
6421 { 6440 {
6422 return m_Notecards.ContainsKey(assetID); 6441 return m_Notecards.ContainsKey(assetID);
6423 } 6442 }
@@ -6425,10 +6444,10 @@ return LLUUID.Zero.ToString();
6425 6444
6426 public static int GetLines(LLUUID assetID) 6445 public static int GetLines(LLUUID assetID)
6427 { 6446 {
6428 if(!IsCached(assetID)) 6447 if (!IsCached(assetID))
6429 return -1; 6448 return -1;
6430 6449
6431 lock(m_Notecards) 6450 lock (m_Notecards)
6432 { 6451 {
6433 m_Notecards[assetID].lastRef = DateTime.Now; 6452 m_Notecards[assetID].lastRef = DateTime.Now;
6434 return m_Notecards[assetID].text.Length; 6453 return m_Notecards[assetID].text.Length;
@@ -6437,23 +6456,23 @@ return LLUUID.Zero.ToString();
6437 6456
6438 public static string GetLine(LLUUID assetID, int line) 6457 public static string GetLine(LLUUID assetID, int line)
6439 { 6458 {
6440 if(line < 0) 6459 if (line < 0)
6441 return ""; 6460 return "";
6442 6461
6443 string data; 6462 string data;
6444 6463
6445 if(!IsCached(assetID)) 6464 if (!IsCached(assetID))
6446 return ""; 6465 return "";
6447 6466
6448 lock(m_Notecards) 6467 lock (m_Notecards)
6449 { 6468 {
6450 m_Notecards[assetID].lastRef = DateTime.Now; 6469 m_Notecards[assetID].lastRef = DateTime.Now;
6451 6470
6452 if(line >= m_Notecards[assetID].text.Length) 6471 if (line >= m_Notecards[assetID].text.Length)
6453 return "\n\n\n"; 6472 return "\n\n\n";
6454 6473
6455 data=m_Notecards[assetID].text[line]; 6474 data = m_Notecards[assetID].text[line];
6456 if(data.Length > 255) 6475 if (data.Length > 255)
6457 data = data.Substring(0, 255); 6476 data = data.Substring(0, 255);
6458 6477
6459 return data; 6478 return data;
@@ -6465,10 +6484,9 @@ return LLUUID.Zero.ToString();
6465 foreach (LLUUID key in new List<LLUUID>(m_Notecards.Keys)) 6484 foreach (LLUUID key in new List<LLUUID>(m_Notecards.Keys))
6466 { 6485 {
6467 Notecard nc = m_Notecards[key]; 6486 Notecard nc = m_Notecards[key];
6468 if(nc.lastRef.AddSeconds(30) < DateTime.Now) 6487 if (nc.lastRef.AddSeconds(30) < DateTime.Now)
6469 m_Notecards.Remove(key); 6488 m_Notecards.Remove(key);
6470 } 6489 }
6471 } 6490 }
6472
6473 } 6491 }
6474} 6492}
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Script/AssemblyResolver.cs b/OpenSim/Region/ScriptEngine/XEngine/Script/AssemblyResolver.cs
index 8107788..cf15b67 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Script/AssemblyResolver.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Script/AssemblyResolver.cs
@@ -37,25 +37,25 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
37 public static Assembly OnAssemblyResolve(object sender, 37 public static Assembly OnAssemblyResolve(object sender,
38 ResolveEventArgs args) 38 ResolveEventArgs args)
39 { 39 {
40 if(!(sender is System.AppDomain)) 40 if (!(sender is System.AppDomain))
41 return null; 41 return null;
42 42
43 AppDomain myDomain = (AppDomain)sender; 43 AppDomain myDomain = (AppDomain)sender;
44 string dirName = myDomain.FriendlyName; 44 string dirName = myDomain.FriendlyName;
45 45
46 string[] pathList=new string[] {"bin", "ScriptEngines", 46 string[] pathList = new string[] {"bin", "ScriptEngines",
47 Path.Combine("ScriptEngines", dirName)}; 47 Path.Combine("ScriptEngines", dirName)};
48 48
49 string assemblyName = args.Name; 49 string assemblyName = args.Name;
50 if(assemblyName.IndexOf(",") != -1) 50 if (assemblyName.IndexOf(",") != -1)
51 assemblyName=args.Name.Substring(0, args.Name.IndexOf(",")); 51 assemblyName = args.Name.Substring(0, args.Name.IndexOf(","));
52 52
53 foreach (string s in pathList) 53 foreach (string s in pathList)
54 { 54 {
55 string path=Path.Combine(Directory.GetCurrentDirectory(), 55 string path = Path.Combine(Directory.GetCurrentDirectory(),
56 Path.Combine(s, assemblyName))+".dll"; 56 Path.Combine(s, assemblyName))+".dll";
57 57
58 if(File.Exists(path)) 58 if (File.Exists(path))
59 return Assembly.LoadFrom(path); 59 return Assembly.LoadFrom(path);
60 } 60 }
61 61
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Script/BuiltIn_Commands_BaseClass.cs b/OpenSim/Region/ScriptEngine/XEngine/Script/BuiltIn_Commands_BaseClass.cs
index bae8192..ebe4fc5 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Script/BuiltIn_Commands_BaseClass.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Script/BuiltIn_Commands_BaseClass.cs
@@ -106,7 +106,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
106 { 106 {
107 foreach (KeyValuePair<string, object> var in vars) 107 foreach (KeyValuePair<string, object> var in vars)
108 { 108 {
109 if(m_Fields.ContainsKey(var.Key)) 109 if (m_Fields.ContainsKey(var.Key))
110 { 110 {
111 m_Fields[var.Key].SetValue(this, var.Value); 111 m_Fields[var.Key].SetValue(this, var.Value);
112 } 112 }
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Script/LSL_Types.cs b/OpenSim/Region/ScriptEngine/XEngine/Script/LSL_Types.cs
index 2d5d2b8..a3dcfaf 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Script/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Script/LSL_Types.cs
@@ -1212,8 +1212,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
1212 1212
1213 public LSLInteger(Object o) 1213 public LSLInteger(Object o)
1214 { 1214 {
1215 if(!(o is Int32)) 1215 if (!(o is Int32))
1216 value=0; 1216 value = 0;
1217 else 1217 else
1218 value = (int)o; 1218 value = (int)o;
1219 } 1219 }
@@ -1327,11 +1327,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
1327 1327
1328 public override bool Equals(object o) 1328 public override bool Equals(object o)
1329 { 1329 {
1330 if(o is Int32) 1330 if (o is Int32)
1331 { 1331 {
1332 return value == (Int32)o; 1332 return value == (Int32)o;
1333 } 1333 }
1334 if(o is LSLInteger) 1334 if (o is LSLInteger)
1335 { 1335 {
1336 return value == ((LSLInteger)o).value; 1336 return value == ((LSLInteger)o).value;
1337 } 1337 }
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index cbcf5ea..0fe1f46 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -106,7 +106,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
106 106
107 m_ScriptConfig = configSource.Configs["XEngine"]; 107 m_ScriptConfig = configSource.Configs["XEngine"];
108 108
109 if(m_ScriptConfig == null) 109 if (m_ScriptConfig == null)
110 { 110 {
111 m_log.ErrorFormat("[XEngine] No script configuration found. Scripts disabled"); 111 m_log.ErrorFormat("[XEngine] No script configuration found. Scripts disabled");
112 return; 112 return;
@@ -126,7 +126,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
126 int saveTime = m_ScriptConfig.GetInt("SaveInterval", 300)*1000; 126 int saveTime = m_ScriptConfig.GetInt("SaveInterval", 300)*1000;
127 127
128 ThreadPriority prio = ThreadPriority.BelowNormal; 128 ThreadPriority prio = ThreadPriority.BelowNormal;
129 switch(priority) 129 switch (priority)
130 { 130 {
131 case "Lowest": 131 case "Lowest":
132 prio=ThreadPriority.Lowest; 132 prio=ThreadPriority.Lowest;
@@ -149,7 +149,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
149 break; 149 break;
150 } 150 }
151 151
152 lock(m_ScriptEngines) 152 lock (m_ScriptEngines)
153 { 153 {
154 m_ScriptEngines.Add(this); 154 m_ScriptEngines.Add(this);
155 } 155 }
@@ -166,17 +166,17 @@ namespace OpenSim.Region.ScriptEngine.XEngine
166 m_Scene.EventManager.OnRemoveScript += OnRemoveScript; 166 m_Scene.EventManager.OnRemoveScript += OnRemoveScript;
167 m_Scene.EventManager.OnScriptReset += OnScriptReset; 167 m_Scene.EventManager.OnScriptReset += OnScriptReset;
168 168
169 if(sleepTime > 0) 169 if (sleepTime > 0)
170 { 170 {
171 m_ThreadPool.QueueWorkItem(new WorkItemCallback( 171 m_ThreadPool.QueueWorkItem(new WorkItemCallback(
172 this.DoMaintenance), new Object[] 172 this.DoMaintenance), new Object[]
173 { sleepTime }); 173 { sleepTime });
174 } 174 }
175 175
176 if(saveTime > 0) 176 if (saveTime > 0)
177 { 177 {
178 m_ThreadPool.QueueWorkItem(new WorkItemCallback( 178 m_ThreadPool.QueueWorkItem(new WorkItemCallback(
179 this.DoBackup), new Object[] { saveTime }); 179 this.DoBackup), new Object[] { saveTime });
180 } 180 }
181 } 181 }
182 182
@@ -187,9 +187,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
187 187
188 public void Close() 188 public void Close()
189 { 189 {
190 lock(m_ScriptEngines) 190 lock (m_ScriptEngines)
191 { 191 {
192 if(m_ScriptEngines.Contains(this)) 192 if (m_ScriptEngines.Contains(this))
193 m_ScriptEngines.Remove(this); 193 m_ScriptEngines.Remove(this);
194 } 194 }
195 } 195 }
@@ -205,7 +205,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
205 205
206 List<XScriptInstance> instances = new List<XScriptInstance>(); 206 List<XScriptInstance> instances = new List<XScriptInstance>();
207 207
208 lock(m_Scripts) 208 lock (m_Scripts)
209 { 209 {
210 foreach (XScriptInstance instance in m_Scripts.Values) 210 foreach (XScriptInstance instance in m_Scripts.Values)
211 instances.Add(instance); 211 instances.Add(instance);
@@ -215,9 +215,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
215 { 215 {
216 string assembly = String.Empty; 216 string assembly = String.Empty;
217 217
218 lock(m_Scripts) 218 lock (m_Scripts)
219 { 219 {
220 if(!m_Assemblies.ContainsKey(i.AssetID)) 220 if (!m_Assemblies.ContainsKey(i.AssetID))
221 continue; 221 continue;
222 assembly = m_Assemblies[i.AssetID]; 222 assembly = m_Assemblies[i.AssetID];
223 } 223 }
@@ -240,10 +240,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
240 240
241 foreach (XScriptInstance inst in m_Scripts.Values) 241 foreach (XScriptInstance inst in m_Scripts.Values)
242 { 242 {
243 if(inst.EventTime() > m_EventLimit) 243 if (inst.EventTime() > m_EventLimit)
244 { 244 {
245 inst.Stop(100); 245 inst.Stop(100);
246 if(!m_KillTimedOutScripts) 246 if (!m_KillTimedOutScripts)
247 inst.Start(); 247 inst.Start();
248 } 248 }
249 } 249 }
@@ -251,7 +251,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
251 System.Threading.Thread.Sleep(sleepTime); 251 System.Threading.Thread.Sleep(sleepTime);
252 252
253 m_ThreadPool.QueueWorkItem(new WorkItemCallback( 253 m_ThreadPool.QueueWorkItem(new WorkItemCallback(
254 this.DoMaintenance), new Object[] 254 this.DoMaintenance), new Object[]
255 { sleepTime }); 255 { sleepTime });
256 256
257 return 0; 257 return 0;
@@ -281,7 +281,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
281 public void OnRezScript(uint localID, LLUUID itemID, string script) 281 public void OnRezScript(uint localID, LLUUID itemID, string script)
282 { 282 {
283 m_ThreadPool.QueueWorkItem(new WorkItemCallback( 283 m_ThreadPool.QueueWorkItem(new WorkItemCallback(
284 this.DoOnRezScript), new Object[] 284 this.DoOnRezScript), new Object[]
285 { localID, itemID, script}); 285 { localID, itemID, script});
286 } 286 }
287 287
@@ -296,25 +296,25 @@ namespace OpenSim.Region.ScriptEngine.XEngine
296 // already have it. 296 // already have it.
297 297
298 SceneObjectPart part = m_Scene.GetSceneObjectPart(localID); 298 SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
299 if(part == null) 299 if (part == null)
300 return false; 300 return false;
301 301
302 TaskInventoryItem item = part.GetInventoryItem(itemID); 302 TaskInventoryItem item = part.GetInventoryItem(itemID);
303 if(item == null) 303 if (item == null)
304 return false; 304 return false;
305 305
306 LLUUID assetID=item.AssetID; 306 LLUUID assetID = item.AssetID;
307 307
308// m_log.DebugFormat("[XEngine] Compiling script {0} ({1})", 308// m_log.DebugFormat("[XEngine] Compiling script {0} ({1})",
309// item.Name, itemID.ToString()); 309// item.Name, itemID.ToString());
310 310
311 string assembly=""; 311 string assembly = "";
312 try 312 try
313 { 313 {
314 assembly=m_Compiler.PerformScriptCompile(script, 314 assembly = m_Compiler.PerformScriptCompile(script,
315 assetID.ToString()); 315 assetID.ToString());
316 m_log.DebugFormat("[XEngine] Loaded script {0}.{1}", 316 m_log.DebugFormat("[XEngine] Loaded script {0}.{1}",
317 part.ParentGroup.RootPart.Name, item.Name); 317 part.ParentGroup.RootPart.Name, item.Name);
318 } 318 }
319 catch (Exception e) 319 catch (Exception e)
320 { 320 {
@@ -325,9 +325,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
325 if (text.Length > 1400) 325 if (text.Length > 1400)
326 text = text.Substring(0, 1400); 326 text = text.Substring(0, 1400);
327 World.SimChat(Helpers.StringToField(text), 327 World.SimChat(Helpers.StringToField(text),
328 ChatTypeEnum.DebugChannel, 2147483647, 328 ChatTypeEnum.DebugChannel, 2147483647,
329 part.AbsolutePosition, 329 part.AbsolutePosition,
330 part.Name, part.UUID, false); 330 part.Name, part.UUID, false);
331 } 331 }
332 catch (Exception e2) // LEGIT: User Scripting 332 catch (Exception e2) // LEGIT: User Scripting
333 { 333 {
@@ -342,28 +342,28 @@ namespace OpenSim.Region.ScriptEngine.XEngine
342 return false; 342 return false;
343 } 343 }
344 344
345 lock(m_Scripts) 345 lock (m_Scripts)
346 { 346 {
347 // Create the object record 347 // Create the object record
348 348
349 if(!m_PrimObjects.ContainsKey(localID)) 349 if (!m_PrimObjects.ContainsKey(localID))
350 m_PrimObjects[localID] = new List<LLUUID>(); 350 m_PrimObjects[localID] = new List<LLUUID>();
351 351
352 if(!m_PrimObjects[localID].Contains(itemID)) 352 if (!m_PrimObjects[localID].Contains(itemID))
353 m_PrimObjects[localID].Add(itemID); 353 m_PrimObjects[localID].Add(itemID);
354 354
355 if(!m_Assemblies.ContainsKey(assetID)) 355 if (!m_Assemblies.ContainsKey(assetID))
356 m_Assemblies[assetID] = assembly; 356 m_Assemblies[assetID] = assembly;
357 357
358 if((!m_Scripts.ContainsKey(itemID)) || 358 if ((!m_Scripts.ContainsKey(itemID)) ||
359 (m_Scripts[itemID].AssetID != assetID)) 359 (m_Scripts[itemID].AssetID != assetID))
360 { 360 {
361 LLUUID appDomain=assetID; 361 LLUUID appDomain=assetID;
362 362
363 if(part.ParentGroup.RootPart.m_IsAttachment) 363 if (part.ParentGroup.RootPart.m_IsAttachment)
364 appDomain=part.ParentGroup.RootPart.UUID; 364 appDomain = part.ParentGroup.RootPart.UUID;
365 365
366 if(!m_AppDomains.ContainsKey(appDomain)) 366 if (!m_AppDomains.ContainsKey(appDomain))
367 { 367 {
368 try 368 try
369 { 369 {
@@ -373,16 +373,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
373// m_Scene.RegionInfo.RegionID.ToString()); 373// m_Scene.RegionInfo.RegionID.ToString());
374 374
375 Evidence baseEvidence = 375 Evidence baseEvidence =
376 AppDomain.CurrentDomain.Evidence; 376 AppDomain.CurrentDomain.Evidence;
377 Evidence evidence = new Evidence(baseEvidence); 377 Evidence evidence = new Evidence(baseEvidence);
378 378
379 m_AppDomains[appDomain] = 379 m_AppDomains[appDomain] =
380 AppDomain.CreateDomain( 380 AppDomain.CreateDomain(
381 m_Scene.RegionInfo.RegionID.ToString(), 381 m_Scene.RegionInfo.RegionID.ToString(),
382 evidence, appSetup); 382 evidence, appSetup);
383 383
384 m_AppDomains[appDomain].AssemblyResolve += 384 m_AppDomains[appDomain].AssemblyResolve +=
385 new ResolveEventHandler( 385 new ResolveEventHandler(
386 AssemblyResolver.OnAssemblyResolve); 386 AssemblyResolver.OnAssemblyResolve);
387 m_DomainScripts[appDomain] = new List<LLUUID>(); 387 m_DomainScripts[appDomain] = new List<LLUUID>();
388 } 388 }
@@ -394,10 +394,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
394 } 394 }
395 m_DomainScripts[appDomain].Add(itemID); 395 m_DomainScripts[appDomain].Add(itemID);
396 396
397
398 XScriptInstance instance = new XScriptInstance(this,localID, 397 XScriptInstance instance = new XScriptInstance(this,localID,
399 part.UUID, itemID, assetID, assembly, 398 part.UUID, itemID, assetID, assembly,
400 m_AppDomains[appDomain]); 399 m_AppDomains[appDomain]);
401 400
402 instance.AppDomain = appDomain; 401 instance.AppDomain = appDomain;
403 402
@@ -409,10 +408,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
409 408
410 public void OnRemoveScript(uint localID, LLUUID itemID) 409 public void OnRemoveScript(uint localID, LLUUID itemID)
411 { 410 {
412 lock(m_Scripts) 411 lock (m_Scripts)
413 { 412 {
414 // Do we even have it? 413 // Do we even have it?
415 if(!m_Scripts.ContainsKey(itemID)) 414 if (!m_Scripts.ContainsKey(itemID))
416 return; 415 return;
417 416
418 m_ASYNCLSLCommandManager.RemoveScript(localID, itemID); 417 m_ASYNCLSLCommandManager.RemoveScript(localID, itemID);
@@ -424,27 +423,27 @@ namespace OpenSim.Region.ScriptEngine.XEngine
424 instance.Stop(0); 423 instance.Stop(0);
425 424
426 SceneObjectPart part = 425 SceneObjectPart part =
427 m_Scene.GetSceneObjectPart(localID); 426 m_Scene.GetSceneObjectPart(localID);
428 427
429 if(part != null) 428 if (part != null)
430 part.RemoveScriptEvents(itemID); 429 part.RemoveScriptEvents(itemID);
431 430
432 // Remove the script from it's prim 431 // Remove the script from it's prim
433 if(m_PrimObjects.ContainsKey(localID)) 432 if (m_PrimObjects.ContainsKey(localID))
434 { 433 {
435 // Remove inventory item record 434 // Remove inventory item record
436 if(m_PrimObjects[localID].Contains(itemID)) 435 if (m_PrimObjects[localID].Contains(itemID))
437 m_PrimObjects[localID].Remove(itemID); 436 m_PrimObjects[localID].Remove(itemID);
438 437
439 // If there are no more scripts, remove prim 438 // If there are no more scripts, remove prim
440 if(m_PrimObjects[localID].Count == 0) 439 if (m_PrimObjects[localID].Count == 0)
441 { 440 {
442 m_PrimObjects.Remove(localID); 441 m_PrimObjects.Remove(localID);
443 } 442 }
444 } 443 }
445 444
446 m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); 445 m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
447 if(m_DomainScripts[instance.AppDomain].Count == 0) 446 if (m_DomainScripts[instance.AppDomain].Count == 0)
448 { 447 {
449 m_DomainScripts.Remove(instance.AppDomain); 448 m_DomainScripts.Remove(instance.AppDomain);
450 UnloadAppDomain(instance.AppDomain); 449 UnloadAppDomain(instance.AppDomain);
@@ -467,7 +466,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
467 466
468 foreach (XScriptInstance i in m_Scripts.Values) 467 foreach (XScriptInstance i in m_Scripts.Values)
469 { 468 {
470 if(assetIDList.Contains(i.AssetID)) 469 if (assetIDList.Contains(i.AssetID))
471 assetIDList.Remove(i.AssetID); 470 assetIDList.Remove(i.AssetID);
472 } 471 }
473 472
@@ -476,11 +475,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
476// m_log.DebugFormat("[XEngine] Removing unreferenced assembly {0}", m_Assemblies[assetID]); 475// m_log.DebugFormat("[XEngine] Removing unreferenced assembly {0}", m_Assemblies[assetID]);
477 try 476 try
478 { 477 {
479 if(File.Exists(m_Assemblies[assetID])) 478 if (File.Exists(m_Assemblies[assetID]))
480 File.Delete(m_Assemblies[assetID]); 479 File.Delete(m_Assemblies[assetID]);
481 if(File.Exists(m_Assemblies[assetID]+".state")) 480
481 if (File.Exists(m_Assemblies[assetID]+".state"))
482 File.Delete(m_Assemblies[assetID]+".state"); 482 File.Delete(m_Assemblies[assetID]+".state");
483 if(File.Exists(m_Assemblies[assetID]+".mdb")) 483
484 if (File.Exists(m_Assemblies[assetID]+".mdb"))
484 File.Delete(m_Assemblies[assetID]+".mdb"); 485 File.Delete(m_Assemblies[assetID]+".mdb");
485 } 486 }
486 catch (Exception e) 487 catch (Exception e)
@@ -492,9 +493,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
492 493
493 private void UnloadAppDomain(LLUUID id) 494 private void UnloadAppDomain(LLUUID id)
494 { 495 {
495 if(m_AppDomains.ContainsKey(id)) 496 if (m_AppDomains.ContainsKey(id))
496 { 497 {
497 AppDomain domain=m_AppDomains[id]; 498 AppDomain domain = m_AppDomains[id];
498 m_AppDomains.Remove(id); 499 m_AppDomains.Remove(id);
499 500
500 AppDomain.Unload(domain); 501 AppDomain.Unload(domain);
@@ -507,10 +508,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
507 // Start processing 508 // Start processing
508 // 509 //
509 private void StartEngine(int minThreads, int maxThreads, 510 private void StartEngine(int minThreads, int maxThreads,
510 int idleTimeout, ThreadPriority threadPriority, 511 int idleTimeout, ThreadPriority threadPriority,
511 int maxScriptQueue, int stackSize) 512 int maxScriptQueue, int stackSize)
512 { 513 {
513 m_MaxScriptQueue=maxScriptQueue; 514 m_MaxScriptQueue = maxScriptQueue;
514 515
515 STPStartInfo startInfo = new STPStartInfo(); 516 STPStartInfo startInfo = new STPStartInfo();
516 startInfo.IdleTimeout = idleTimeout; 517 startInfo.IdleTimeout = idleTimeout;
@@ -519,7 +520,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
519 startInfo.ThreadPriority = threadPriority; 520 startInfo.ThreadPriority = threadPriority;
520 startInfo.StackSize = stackSize; 521 startInfo.StackSize = stackSize;
521 startInfo.StartSuspended = true; 522 startInfo.StartSuspended = true;
522 523
523 m_ThreadPool = new SmartThreadPool(startInfo); 524 m_ThreadPool = new SmartThreadPool(startInfo);
524 } 525 }
525 526
@@ -529,7 +530,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
529 public IWorkItemResult QueueEventHandler(object parms) 530 public IWorkItemResult QueueEventHandler(object parms)
530 { 531 {
531 return m_ThreadPool.QueueWorkItem(new WorkItemCallback( 532 return m_ThreadPool.QueueWorkItem(new WorkItemCallback(
532 this.ProcessEventHandler), parms); 533 this.ProcessEventHandler), parms);
533 } 534 }
534 535
535 // 536 //
@@ -537,8 +538,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
537 // 538 //
538 private object ProcessEventHandler(object parms) 539 private object ProcessEventHandler(object parms)
539 { 540 {
540 XScriptInstance instance=(XScriptInstance)parms; 541 XScriptInstance instance = (XScriptInstance) parms;
541 542
542 return instance.EventProcessor(); 543 return instance.EventProcessor();
543 } 544 }
544 545
@@ -549,15 +550,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
549 { 550 {
550 bool result = false; 551 bool result = false;
551 552
552 if(!m_PrimObjects.ContainsKey(localID)) 553 if (!m_PrimObjects.ContainsKey(localID))
553 return false; 554 return false;
554 555
555 foreach (LLUUID itemID in m_PrimObjects[localID]) 556 foreach (LLUUID itemID in m_PrimObjects[localID])
556 { 557 {
557 if(m_Scripts.ContainsKey(itemID)) 558 if (m_Scripts.ContainsKey(itemID))
558 { 559 {
559 XScriptInstance instance = m_Scripts[itemID]; 560 XScriptInstance instance = m_Scripts[itemID];
560 if(instance != null) 561 if (instance != null)
561 { 562 {
562 instance.PostEvent(p); 563 instance.PostEvent(p);
563 result = true; 564 result = true;
@@ -572,10 +573,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
572 // 573 //
573 public bool PostScriptEvent(LLUUID itemID, XEventParams p) 574 public bool PostScriptEvent(LLUUID itemID, XEventParams p)
574 { 575 {
575 if(m_Scripts.ContainsKey(itemID)) 576 if (m_Scripts.ContainsKey(itemID))
576 { 577 {
577 XScriptInstance instance = m_Scripts[itemID]; 578 XScriptInstance instance = m_Scripts[itemID];
578 if(instance != null) 579 if (instance != null)
579 instance.PostEvent(p); 580 instance.PostEvent(p);
580 return true; 581 return true;
581 } 582 }
@@ -583,25 +584,25 @@ namespace OpenSim.Region.ScriptEngine.XEngine
583 } 584 }
584 585
585 public Assembly OnAssemblyResolve(object sender, 586 public Assembly OnAssemblyResolve(object sender,
586 ResolveEventArgs args) 587 ResolveEventArgs args)
587 { 588 {
588 if(!(sender is System.AppDomain)) 589 if (!(sender is System.AppDomain))
589 return null; 590 return null;
590 591
591 string[] pathList=new string[] {"bin", "ScriptEngines", 592 string[] pathList = new string[] {"bin", "ScriptEngines",
592 Path.Combine("ScriptEngines", 593 Path.Combine("ScriptEngines",
593 m_Scene.RegionInfo.RegionID.ToString())}; 594 m_Scene.RegionInfo.RegionID.ToString())};
594 595
595 string assemblyName = args.Name; 596 string assemblyName = args.Name;
596 if(assemblyName.IndexOf(",") != -1) 597 if (assemblyName.IndexOf(",") != -1)
597 assemblyName=args.Name.Substring(0, args.Name.IndexOf(",")); 598 assemblyName = args.Name.Substring(0, args.Name.IndexOf(","));
598 599
599 foreach (string s in pathList) 600 foreach (string s in pathList)
600 { 601 {
601 string path=Path.Combine(Directory.GetCurrentDirectory(), 602 string path = Path.Combine(Directory.GetCurrentDirectory(),
602 Path.Combine(s, assemblyName))+".dll"; 603 Path.Combine(s, assemblyName))+".dll";
603 604
604 if(File.Exists(path)) 605 if (File.Exists(path))
605 return Assembly.LoadFrom(path); 606 return Assembly.LoadFrom(path);
606 } 607 }
607 608
@@ -611,9 +612,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
611 private XScriptInstance GetInstance(LLUUID itemID) 612 private XScriptInstance GetInstance(LLUUID itemID)
612 { 613 {
613 XScriptInstance instance; 614 XScriptInstance instance;
614 lock(m_Scripts) 615 lock (m_Scripts)
615 { 616 {
616 if(!m_Scripts.ContainsKey(itemID)) 617 if (!m_Scripts.ContainsKey(itemID))
617 return null; 618 return null;
618 instance = m_Scripts[itemID]; 619 instance = m_Scripts[itemID];
619 } 620 }
@@ -623,9 +624,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
623 public void SetScriptState(LLUUID itemID, bool running) 624 public void SetScriptState(LLUUID itemID, bool running)
624 { 625 {
625 XScriptInstance instance = GetInstance(itemID); 626 XScriptInstance instance = GetInstance(itemID);
626 if(instance != null) 627 if (instance != null)
627 { 628 {
628 if(running) 629 if (running)
629 instance.Start(); 630 instance.Start();
630 else 631 else
631 instance.Stop(500); 632 instance.Stop(500);
@@ -635,7 +636,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
635 public bool GetScriptState(LLUUID itemID) 636 public bool GetScriptState(LLUUID itemID)
636 { 637 {
637 XScriptInstance instance = GetInstance(itemID); 638 XScriptInstance instance = GetInstance(itemID);
638 if(instance != null) 639 if (instance != null)
639 return instance.Running; 640 return instance.Running;
640 return false; 641 return false;
641 } 642 }
@@ -643,14 +644,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
643 public void ResetScript(LLUUID itemID) 644 public void ResetScript(LLUUID itemID)
644 { 645 {
645 XScriptInstance instance = GetInstance(itemID); 646 XScriptInstance instance = GetInstance(itemID);
646 if(instance != null) 647 if (instance != null)
647 instance.ResetScript(); 648 instance.ResetScript();
648 } 649 }
649 650
650 public XDetectParams GetDetectParams(LLUUID itemID, int idx) 651 public XDetectParams GetDetectParams(LLUUID itemID, int idx)
651 { 652 {
652 XScriptInstance instance = GetInstance(itemID); 653 XScriptInstance instance = GetInstance(itemID);
653 if(instance != null) 654 if (instance != null)
654 return instance.GetDetectParams(idx); 655 return instance.GetDetectParams(idx);
655 return new XDetectParams(); 656 return new XDetectParams();
656 } 657 }
@@ -658,7 +659,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
658 public LLUUID GetDetectID(LLUUID itemID, int idx) 659 public LLUUID GetDetectID(LLUUID itemID, int idx)
659 { 660 {
660 XScriptInstance instance = GetInstance(itemID); 661 XScriptInstance instance = GetInstance(itemID);
661 if(instance != null) 662 if (instance != null)
662 return instance.GetDetectID(idx); 663 return instance.GetDetectID(idx);
663 return LLUUID.Zero; 664 return LLUUID.Zero;
664 } 665 }
@@ -688,8 +689,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
688 { 689 {
689 private XEngine m_Engine; 690 private XEngine m_Engine;
690 private IWorkItemResult m_CurrentResult=null; 691 private IWorkItemResult m_CurrentResult=null;
691 private Queue m_EventQueue=new Queue(32); 692 private Queue m_EventQueue = new Queue(32);
692 private bool m_RunEvents=false; 693 private bool m_RunEvents = false;
693 private LLUUID m_ItemID; 694 private LLUUID m_ItemID;
694 private uint m_LocalID; 695 private uint m_LocalID;
695 private LLUUID m_ObjectID; 696 private LLUUID m_ObjectID;
@@ -765,7 +766,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
765 public XScriptInstance(XEngine engine, uint localID, LLUUID objectID, 766 public XScriptInstance(XEngine engine, uint localID, LLUUID objectID,
766 LLUUID itemID, LLUUID assetID, string assembly, AppDomain dom) 767 LLUUID itemID, LLUUID assetID, string assembly, AppDomain dom)
767 { 768 {
768 m_Engine=engine; 769 m_Engine = engine;
769 770
770 m_LocalID = localID; 771 m_LocalID = localID;
771 m_ObjectID = objectID; 772 m_ObjectID = objectID;
@@ -773,22 +774,22 @@ namespace OpenSim.Region.ScriptEngine.XEngine
773 m_AssetID = assetID; 774 m_AssetID = assetID;
774 775
775 SceneObjectPart part=engine.World.GetSceneObjectPart(localID); 776 SceneObjectPart part=engine.World.GetSceneObjectPart(localID);
776 if(part == null) 777 if (part == null)
777 { 778 {
778 engine.Log.Error("[XEngine] SceneObjectPart unavailable. Script NOT started."); 779 engine.Log.Error("[XEngine] SceneObjectPart unavailable. Script NOT started.");
779 return; 780 return;
780 } 781 }
781 782
782 m_LSLCommands = new LSL_ScriptCommands(engine, this, part, localID, 783 m_LSLCommands = new LSL_ScriptCommands(engine, this, part, localID,
783 itemID); 784 itemID);
784 m_OSSLCommands = new OSSL_ScriptCommands(engine, this, part, 785 m_OSSLCommands = new OSSL_ScriptCommands(engine, this, part,
785 localID, itemID); 786 localID, itemID);
786 787
787 try 788 try
788 { 789 {
789 m_Script = (IScript)dom.CreateInstanceAndUnwrap( 790 m_Script = (IScript)dom.CreateInstanceAndUnwrap(
790 Path.GetFileNameWithoutExtension(assembly), 791 Path.GetFileNameWithoutExtension(assembly),
791 "SecondLife.Script"); 792 "SecondLife.Script");
792 } 793 }
793 catch (Exception e) 794 catch (Exception e)
794 { 795 {
@@ -804,15 +805,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
804// m_Engine.Log.Debug("[XEngine] Script instance created"); 805// m_Engine.Log.Debug("[XEngine] Script instance created");
805 806
806 part.SetScriptEvents(m_ItemID, 807 part.SetScriptEvents(m_ItemID,
807 (int)m_Executor.GetStateEventFlags()); 808 (int)m_Executor.GetStateEventFlags());
808 } 809 }
809 catch (Exception e) 810 catch (Exception e)
810 { 811 {
811 m_Engine.Log.Error("Error loading script instance\n"+e.ToString()); 812 m_Engine.Log.Error("Error loading script instance\n"+e.ToString());
812 } 813 }
813 814
814 string savedState = assembly+".state"; 815 string savedState = assembly + ".state";
815 if(File.Exists(savedState)) 816 if (File.Exists(savedState))
816 { 817 {
817 string xml = String.Empty; 818 string xml = String.Empty;
818 819
@@ -820,44 +821,44 @@ namespace OpenSim.Region.ScriptEngine.XEngine
820 { 821 {
821 FileInfo fi = new FileInfo(savedState); 822 FileInfo fi = new FileInfo(savedState);
822 int size=(int)fi.Length; 823 int size=(int)fi.Length;
823 if(size < 130000) 824 if (size < 130000)
824 { 825 {
825 using (FileStream fs = File.Open(savedState, 826 using (FileStream fs = File.Open(savedState,
826 FileMode.Open, FileAccess.Read, FileShare.None)) 827 FileMode.Open, FileAccess.Read, FileShare.None))
827 { 828 {
828 System.Text.ASCIIEncoding enc = 829 System.Text.ASCIIEncoding enc =
829 new System.Text.ASCIIEncoding(); 830 new System.Text.ASCIIEncoding();
830 831
831 Byte[] data=new Byte[size]; 832 Byte[] data = new Byte[size];
832 fs.Read(data, 0, size); 833 fs.Read(data, 0, size);
833 834
834 xml=enc.GetString(data); 835 xml = enc.GetString(data);
835 836
836 ScriptSerializer.Deserialize(xml, this); 837 ScriptSerializer.Deserialize(xml, this);
837 838
838 m_Engine.m_ASYNCLSLCommandManager.CreateFromData( 839 m_Engine.m_ASYNCLSLCommandManager.CreateFromData(
839 m_LocalID, m_ItemID, m_ObjectID, 840 m_LocalID, m_ItemID, m_ObjectID,
840 PluginData); 841 PluginData);
841 } 842 }
842 } 843 }
843 else 844 else
844 { 845 {
845 m_Engine.Log.Error("Unable to load script state: Memory limit exceeded"); 846 m_Engine.Log.Error("Unable to load script state: Memory limit exceeded");
846 PostEvent(new XEventParams("state_entry", 847 PostEvent(new XEventParams("state_entry",
847 new Object[0], new XDetectParams[0])); 848 new Object[0], new XDetectParams[0]));
848 } 849 }
849 } 850 }
850 catch (Exception e) 851 catch (Exception e)
851 { 852 {
852 m_Engine.Log.ErrorFormat("Unable to load script state from xml: {0}\n"+e.ToString(), xml); 853 m_Engine.Log.ErrorFormat("Unable to load script state from xml: {0}\n"+e.ToString(), xml);
853 PostEvent(new XEventParams("state_entry", 854 PostEvent(new XEventParams("state_entry",
854 new Object[0], new XDetectParams[0])); 855 new Object[0], new XDetectParams[0]));
855 } 856 }
856 } 857 }
857 else 858 else
858 { 859 {
859 PostEvent(new XEventParams("state_entry", 860 PostEvent(new XEventParams("state_entry",
860 new Object[0], new XDetectParams[0])); 861 new Object[0], new XDetectParams[0]));
861 } 862 }
862 Start(); 863 Start();
863 } 864 }
@@ -868,23 +869,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
868 foreach (KeyValuePair<string, object> v in vars) 869 foreach (KeyValuePair<string, object> v in vars)
869 { 870 {
870 Console.WriteLine("Variable: {0} = '{1}'", v. Key, 871 Console.WriteLine("Variable: {0} = '{1}'", v. Key,
871 v.Value.ToString()); 872 v.Value.ToString());
872 } 873 }
873 } 874 }
874 875
875 public void Start() 876 public void Start()
876 { 877 {
877 lock(m_EventQueue) 878 lock (m_EventQueue)
878 { 879 {
879 if(Running) 880 if (Running)
880 return; 881 return;
881 882
882 m_RunEvents=true; 883 m_RunEvents = true;
883 884
884 if(m_EventQueue.Count > 0) 885 if (m_EventQueue.Count > 0)
885 { 886 {
886 if(m_CurrentResult == null) 887 if (m_CurrentResult == null)
887 m_CurrentResult=m_Engine.QueueEventHandler(this); 888 m_CurrentResult = m_Engine.QueueEventHandler(this);
888 } 889 }
889 } 890 }
890 } 891 }
@@ -893,36 +894,36 @@ namespace OpenSim.Region.ScriptEngine.XEngine
893 { 894 {
894 IWorkItemResult result; 895 IWorkItemResult result;
895 896
896 lock(m_EventQueue) 897 lock (m_EventQueue)
897 { 898 {
898 if(!Running) 899 if (!Running)
899 return true; 900 return true;
900 901
901 if(m_CurrentResult == null) 902 if (m_CurrentResult == null)
902 { 903 {
903 m_RunEvents=false; 904 m_RunEvents = false;
904 return true; 905 return true;
905 } 906 }
906 907
907 if(m_CurrentResult.Cancel()) 908 if (m_CurrentResult.Cancel())
908 { 909 {
909 m_CurrentResult=null; 910 m_CurrentResult = null;
910 m_RunEvents=false; 911 m_RunEvents = false;
911 return true; 912 return true;
912 } 913 }
913 914
914 result=m_CurrentResult; 915 result = m_CurrentResult;
915 m_RunEvents=false; 916 m_RunEvents = false;
916 } 917 }
917 918
918 if(SmartThreadPool.WaitAll(new IWorkItemResult[] {result}, new TimeSpan((long)timeout*100000), false)) 919 if (SmartThreadPool.WaitAll(new IWorkItemResult[] {result}, new TimeSpan((long)timeout * 100000), false))
919 { 920 {
920 return true; 921 return true;
921 } 922 }
922 923
923 lock(m_EventQueue) 924 lock (m_EventQueue)
924 { 925 {
925 if(m_CurrentResult != null) 926 if (m_CurrentResult != null)
926 m_CurrentResult.Abort(); 927 m_CurrentResult.Abort();
927 else 928 else
928 return true; 929 return true;
@@ -934,75 +935,75 @@ namespace OpenSim.Region.ScriptEngine.XEngine
934 public void SetState(string state) 935 public void SetState(string state)
935 { 936 {
936 PostEvent(new XEventParams("state_exit", new Object[0], 937 PostEvent(new XEventParams("state_exit", new Object[0],
937 new XDetectParams[0])); 938 new XDetectParams[0]));
938 PostEvent(new XEventParams("state", new Object[] { state }, 939 PostEvent(new XEventParams("state", new Object[] { state },
939 new XDetectParams[0])); 940 new XDetectParams[0]));
940 PostEvent(new XEventParams("state_entry", new Object[0], 941 PostEvent(new XEventParams("state_entry", new Object[0],
941 new XDetectParams[0])); 942 new XDetectParams[0]));
942 } 943 }
943 944
944 public void PostEvent(XEventParams data) 945 public void PostEvent(XEventParams data)
945 { 946 {
946 lock(m_EventQueue) 947 lock (m_EventQueue)
947 { 948 {
948 if(m_EventQueue.Count >= m_Engine.MaxScriptQueue) 949 if (m_EventQueue.Count >= m_Engine.MaxScriptQueue)
949 return; 950 return;
950 951
951 m_EventQueue.Enqueue(data); 952 m_EventQueue.Enqueue(data);
952 if(data.EventName == "timer") 953 if (data.EventName == "timer")
953 { 954 {
954 if(m_TimerQueued) 955 if (m_TimerQueued)
955 return; 956 return;
956 m_TimerQueued = true; 957 m_TimerQueued = true;
957 } 958 }
958 959
959 if(!m_RunEvents) 960 if (!m_RunEvents)
960 return; 961 return;
961 962
962 if(m_CurrentResult == null) 963 if (m_CurrentResult == null)
963 { 964 {
964 m_CurrentResult=m_Engine.QueueEventHandler(this); 965 m_CurrentResult = m_Engine.QueueEventHandler(this);
965 } 966 }
966 } 967 }
967 } 968 }
968 969
969 public object EventProcessor() 970 public object EventProcessor()
970 { 971 {
971 XEventParams data=null; 972 XEventParams data = null;
972 973
973 lock(m_EventQueue) 974 lock (m_EventQueue)
974 { 975 {
975 data=(XEventParams)m_EventQueue.Dequeue(); 976 data = (XEventParams) m_EventQueue.Dequeue();
976 if(data == null) // Shouldn't happen 977 if (data == null) // Shouldn't happen
977 { 978 {
978 m_CurrentResult=null; 979 m_CurrentResult = null;
979 return 0; 980 return 0;
980 } 981 }
981 if(data.EventName == "timer") 982 if (data.EventName == "timer")
982 m_TimerQueued = false; 983 m_TimerQueued = false;
983 } 984 }
984 985
985 m_DetectParams=data.DetectParams; 986 m_DetectParams = data.DetectParams;
986 987
987 if(data.EventName == "state") // Hardcoded state change 988 if (data.EventName == "state") // Hardcoded state change
988 { 989 {
989 m_State=data.Params[0].ToString(); 990 m_State=data.Params[0].ToString();
990 m_Engine.m_ASYNCLSLCommandManager.RemoveScript( 991 m_Engine.m_ASYNCLSLCommandManager.RemoveScript(
991 m_LocalID, m_ItemID); 992 m_LocalID, m_ItemID);
992 993
993 SceneObjectPart part=m_Engine.World.GetSceneObjectPart( 994 SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
994 m_LocalID); 995 m_LocalID);
995 if(part != null) 996 if (part != null)
996 { 997 {
997 part.SetScriptEvents(m_ItemID, 998 part.SetScriptEvents(m_ItemID,
998 (int)m_Executor.GetStateEventFlags()); 999 (int)m_Executor.GetStateEventFlags());
999 } 1000 }
1000 } 1001 }
1001 else 1002 else
1002 { 1003 {
1003// m_Engine.Log.DebugFormat("[XEngine] Processed event {0}", data.EventName); 1004// m_Engine.Log.DebugFormat("[XEngine] Processed event {0}", data.EventName);
1004 SceneObjectPart part=m_Engine.World.GetSceneObjectPart( 1005 SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
1005 m_LocalID); 1006 m_LocalID);
1006 try 1007 try
1007 { 1008 {
1008 m_EventStart = DateTime.Now; 1009 m_EventStart = DateTime.Now;
@@ -1013,21 +1014,21 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1013 catch (Exception e) 1014 catch (Exception e)
1014 { 1015 {
1015 m_InEvent = false; 1016 m_InEvent = false;
1016 if(e is System.Threading.ThreadAbortException) 1017 if (e is System.Threading.ThreadAbortException)
1017 { 1018 {
1018 lock(m_EventQueue) 1019 lock (m_EventQueue)
1019 { 1020 {
1020 if((m_EventQueue.Count > 0) && m_RunEvents) 1021 if ((m_EventQueue.Count > 0) && m_RunEvents)
1021 { 1022 {
1022 m_CurrentResult=m_Engine.QueueEventHandler(this); 1023 m_CurrentResult=m_Engine.QueueEventHandler(this);
1023 } 1024 }
1024 else 1025 else
1025 { 1026 {
1026 m_CurrentResult=null; 1027 m_CurrentResult = null;
1027 } 1028 }
1028 } 1029 }
1029 1030
1030 m_DetectParams=null; 1031 m_DetectParams = null;
1031 1032
1032 return 0; 1033 return 0;
1033 } 1034 }
@@ -1039,42 +1040,42 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1039 if (text.Length > 1400) 1040 if (text.Length > 1400)
1040 text = text.Substring(0, 1400); 1041 text = text.Substring(0, 1400);
1041 m_Engine.World.SimChat(Helpers.StringToField(text), 1042 m_Engine.World.SimChat(Helpers.StringToField(text),
1042 ChatTypeEnum.DebugChannel, 2147483647, 1043 ChatTypeEnum.DebugChannel, 2147483647,
1043 part.AbsolutePosition, 1044 part.AbsolutePosition,
1044 part.Name, part.UUID, false); 1045 part.Name, part.UUID, false);
1045 } 1046 }
1046 catch (Exception e2) // LEGIT: User Scripting 1047 catch (Exception e2) // LEGIT: User Scripting
1047 { 1048 {
1048 m_Engine.Log.Error("[XEngine]: "+ 1049 m_Engine.Log.Error("[XEngine]: "+
1049 "Error displaying error in-world: " + 1050 "Error displaying error in-world: " +
1050 e2.ToString()); 1051 e2.ToString());
1051 m_Engine.Log.Error("[XEngine]: " + 1052 m_Engine.Log.Error("[XEngine]: " +
1052 "Errormessage: Error compiling script:\r\n" + 1053 "Errormessage: Error compiling script:\r\n" +
1053 e.ToString()); 1054 e.ToString());
1054 } 1055 }
1055 } 1056 }
1056 } 1057 }
1057 1058
1058 lock(m_EventQueue) 1059 lock (m_EventQueue)
1059 { 1060 {
1060 if((m_EventQueue.Count > 0) && m_RunEvents) 1061 if ((m_EventQueue.Count > 0) && m_RunEvents)
1061 { 1062 {
1062 m_CurrentResult=m_Engine.QueueEventHandler(this); 1063 m_CurrentResult = m_Engine.QueueEventHandler(this);
1063 } 1064 }
1064 else 1065 else
1065 { 1066 {
1066 m_CurrentResult=null; 1067 m_CurrentResult = null;
1067 } 1068 }
1068 } 1069 }
1069 1070
1070 m_DetectParams=null; 1071 m_DetectParams = null;
1071 1072
1072 return 0; 1073 return 0;
1073 } 1074 }
1074 1075
1075 public int EventTime() 1076 public int EventTime()
1076 { 1077 {
1077 if(!m_InEvent) 1078 if (!m_InEvent)
1078 return 0; 1079 return 0;
1079 1080
1080 return (DateTime.Now - m_EventStart).Seconds; 1081 return (DateTime.Now - m_EventStart).Seconds;
@@ -1082,14 +1083,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1082 1083
1083 public void ResetScript() 1084 public void ResetScript()
1084 { 1085 {
1085 bool running=Running; 1086 bool running = Running;
1086 1087
1087 Stop(0); 1088 Stop(0);
1088 m_Engine.m_ASYNCLSLCommandManager.RemoveScript(m_LocalID, m_ItemID); 1089 m_Engine.m_ASYNCLSLCommandManager.RemoveScript(m_LocalID, m_ItemID);
1089 m_EventQueue.Clear(); 1090 m_EventQueue.Clear();
1090 m_Script.ResetVars(); 1091 m_Script.ResetVars();
1091 m_State = "default"; 1092 m_State = "default";
1092 if(running) 1093 if (running)
1093 Start(); 1094 Start();
1094 PostEvent(new XEventParams("state_entry", 1095 PostEvent(new XEventParams("state_entry",
1095 new Object[0], new XDetectParams[0])); 1096 new Object[0], new XDetectParams[0]));
@@ -1107,7 +1108,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1107 1108
1108 public XDetectParams GetDetectParams(int idx) 1109 public XDetectParams GetDetectParams(int idx)
1109 { 1110 {
1110 if(idx < 0 || idx >= m_DetectParams.Length) 1111 if (idx < 0 || idx >= m_DetectParams.Length)
1111 return new XDetectParams(); 1112 return new XDetectParams();
1112 1113
1113 return m_DetectParams[idx]; 1114 return m_DetectParams[idx];
@@ -1115,7 +1116,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1115 1116
1116 public LLUUID GetDetectID(int idx) 1117 public LLUUID GetDetectID(int idx)
1117 { 1118 {
1118 if(idx < 0 || idx >= m_DetectParams.Length) 1119 if (idx < 0 || idx >= m_DetectParams.Length)
1119 return LLUUID.Zero; 1120 return LLUUID.Zero;
1120 1121
1121 return m_DetectParams[idx].Key; 1122 return m_DetectParams[idx].Key;
@@ -1124,22 +1125,21 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1124 public void SaveState(string assembly) 1125 public void SaveState(string assembly)
1125 { 1126 {
1126 PluginData = 1127 PluginData =
1127 m_Engine.m_ASYNCLSLCommandManager.GetSerializationData( 1128 m_Engine.m_ASYNCLSLCommandManager.GetSerializationData(
1128 m_ItemID); 1129 m_ItemID);
1129 1130
1130 string xml=ScriptSerializer.Serialize(this); 1131 string xml = ScriptSerializer.Serialize(this);
1131 1132
1132 try 1133 try
1133 { 1134 {
1134 FileStream fs = File.Create(assembly+".state"); 1135 FileStream fs = File.Create(assembly + ".state");
1135 System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); 1136 System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
1136 Byte[] buf=enc.GetBytes(xml); 1137 Byte[] buf = enc.GetBytes(xml);
1137 fs.Write(buf, 0, buf.Length); 1138 fs.Write(buf, 0, buf.Length);
1138 fs.Close(); 1139 fs.Close();
1139 } 1140 }
1140 catch(Exception) 1141 catch(Exception)
1141 { 1142 {
1142 return;
1143 } 1143 }
1144 } 1144 }
1145 } 1145 }
@@ -1153,11 +1153,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1153 XmlDocument xmldoc = new XmlDocument(); 1153 XmlDocument xmldoc = new XmlDocument();
1154 1154
1155 XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration, 1155 XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration,
1156 "", ""); 1156 "", "");
1157 xmldoc.AppendChild(xmlnode); 1157 xmldoc.AppendChild(xmlnode);
1158 1158
1159 XmlElement rootElement = xmldoc.CreateElement("", "ScriptState", 1159 XmlElement rootElement = xmldoc.CreateElement("", "ScriptState",
1160 ""); 1160 "");
1161 xmldoc.AppendChild(rootElement); 1161 xmldoc.AppendChild(rootElement);
1162 1162
1163 XmlElement state = xmldoc.CreateElement("", "State", ""); 1163 XmlElement state = xmldoc.CreateElement("", "State", "");
@@ -1171,15 +1171,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1171 1171
1172 foreach (KeyValuePair<string, Object> var in vars) 1172 foreach (KeyValuePair<string, Object> var in vars)
1173 WriteTypedValue(xmldoc, variables, "Variable", var.Key, 1173 WriteTypedValue(xmldoc, variables, "Variable", var.Key,
1174 var.Value); 1174 var.Value);
1175 1175
1176 rootElement.AppendChild(variables); 1176 rootElement.AppendChild(variables);
1177 1177
1178 XmlElement queue = xmldoc.CreateElement("", "Queue", ""); 1178 XmlElement queue = xmldoc.CreateElement("", "Queue", "");
1179 1179
1180 int count = instance.EventQueue.Count; 1180 int count = instance.EventQueue.Count;
1181 1181
1182 while(count > 0) 1182 while (count > 0)
1183 { 1183 {
1184 XEventParams ep = (XEventParams)instance.EventQueue.Dequeue(); 1184 XEventParams ep = (XEventParams)instance.EventQueue.Dequeue();
1185 instance.EventQueue.Enqueue(ep); 1185 instance.EventQueue.Enqueue(ep);
@@ -1187,8 +1187,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1187 1187
1188 XmlElement item = xmldoc.CreateElement("", "Item", ""); 1188 XmlElement item = xmldoc.CreateElement("", "Item", "");
1189 XmlAttribute itemEvent = xmldoc.CreateAttribute("", "event", 1189 XmlAttribute itemEvent = xmldoc.CreateAttribute("", "event",
1190 ""); 1190 "");
1191 itemEvent.Value=ep.EventName; 1191 itemEvent.Value = ep.EventName;
1192 item.Attributes.Append(itemEvent); 1192 item.Attributes.Append(itemEvent);
1193 1193
1194 XmlElement parms = xmldoc.CreateElement("", "Params", ""); 1194 XmlElement parms = xmldoc.CreateElement("", "Params", "");
@@ -1203,12 +1203,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1203 foreach (XDetectParams det in ep.DetectParams) 1203 foreach (XDetectParams det in ep.DetectParams)
1204 { 1204 {
1205 XmlElement objectElem = xmldoc.CreateElement("", "Object", 1205 XmlElement objectElem = xmldoc.CreateElement("", "Object",
1206 ""); 1206 "");
1207 XmlAttribute pos = xmldoc.CreateAttribute("", "pos", ""); 1207 XmlAttribute pos = xmldoc.CreateAttribute("", "pos", "");
1208 pos.Value=det.OffsetPos.ToString(); 1208 pos.Value = det.OffsetPos.ToString();
1209 objectElem.Attributes.Append(pos); 1209 objectElem.Attributes.Append(pos);
1210 objectElem.AppendChild( 1210 objectElem.AppendChild(
1211 xmldoc.CreateTextNode(det.Key.ToString())); 1211 xmldoc.CreateTextNode(det.Key.ToString()));
1212 1212
1213 detect.AppendChild(objectElem); 1213 detect.AppendChild(objectElem);
1214 } 1214 }
@@ -1221,9 +1221,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1221 rootElement.AppendChild(queue); 1221 rootElement.AppendChild(queue);
1222 1222
1223 XmlNode plugins = xmldoc.CreateElement("", "Plugins", ""); 1223 XmlNode plugins = xmldoc.CreateElement("", "Plugins", "");
1224 if(instance.PluginData.Length > 0) 1224 if (instance.PluginData.Length > 0)
1225 DumpList(xmldoc, plugins, 1225 DumpList(xmldoc, plugins,
1226 new LSL_Types.list(instance.PluginData)); 1226 new LSL_Types.list(instance.PluginData));
1227 1227
1228 rootElement.AppendChild(plugins); 1228 rootElement.AppendChild(plugins);
1229 1229
@@ -1241,22 +1241,22 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1241 instance.PluginData = new Object[0]; 1241 instance.PluginData = new Object[0];
1242 1242
1243 doc.LoadXml(xml); 1243 doc.LoadXml(xml);
1244 1244
1245 XmlNodeList rootL = doc.GetElementsByTagName("ScriptState"); 1245 XmlNodeList rootL = doc.GetElementsByTagName("ScriptState");
1246 if(rootL.Count != 1) 1246 if (rootL.Count != 1)
1247 { 1247 {
1248 return; 1248 return;
1249 } 1249 }
1250 XmlNode rootNode = rootL[0]; 1250 XmlNode rootNode = rootL[0];
1251 1251
1252 if(rootNode != null) 1252 if (rootNode != null)
1253 { 1253 {
1254 object varValue; 1254 object varValue;
1255 XmlNodeList partL = rootNode.ChildNodes; 1255 XmlNodeList partL = rootNode.ChildNodes;
1256 1256
1257 foreach (XmlNode part in partL) 1257 foreach (XmlNode part in partL)
1258 { 1258 {
1259 switch(part.Name) 1259 switch (part.Name)
1260 { 1260 {
1261 case "State": 1261 case "State":
1262 instance.State=part.InnerText; 1262 instance.State=part.InnerText;
@@ -1268,7 +1268,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1268 string varName; 1268 string varName;
1269 varValue=ReadTypedValue(var, out varName); 1269 varValue=ReadTypedValue(var, out varName);
1270 1270
1271 if(vars.ContainsKey(varName)) 1271 if (vars.ContainsKey(varName))
1272 vars[varName] = varValue; 1272 vars[varName] = varValue;
1273 } 1273 }
1274 instance.SetVars(vars); 1274 instance.SetVars(vars);
@@ -1286,7 +1286,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1286 XmlNodeList eventL = item.ChildNodes; 1286 XmlNodeList eventL = item.ChildNodes;
1287 foreach (XmlNode evt in eventL) 1287 foreach (XmlNode evt in eventL)
1288 { 1288 {
1289 switch(evt.Name) 1289 switch (evt.Name)
1290 { 1290 {
1291 case "Params": 1291 case "Params":
1292 XmlNodeList prms = evt.ChildNodes; 1292 XmlNodeList prms = evt.ChildNodes;
@@ -1342,7 +1342,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1342 List<Object> olist = new List<Object>(); 1342 List<Object> olist = new List<Object>();
1343 1343
1344 XmlNodeList itemL = parent.ChildNodes; 1344 XmlNodeList itemL = parent.ChildNodes;
1345 foreach(XmlNode item in itemL) 1345 foreach (XmlNode item in itemL)
1346 olist.Add(ReadTypedValue(item)); 1346 olist.Add(ReadTypedValue(item));
1347 1347
1348 return new LSL_Types.list(olist.ToArray()); 1348 return new LSL_Types.list(olist.ToArray());
@@ -1355,14 +1355,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1355 XmlAttribute typ = doc.CreateAttribute("", "type", ""); 1355 XmlAttribute typ = doc.CreateAttribute("", "type", "");
1356 XmlNode n = doc.CreateElement("", tag, ""); 1356 XmlNode n = doc.CreateElement("", tag, "");
1357 1357
1358 if(value is LSL_Types.list) 1358 if (value is LSL_Types.list)
1359 { 1359 {
1360 typ.Value = "list"; 1360 typ.Value = "list";
1361 n.Attributes.Append(typ); 1361 n.Attributes.Append(typ);
1362 1362
1363 DumpList(doc, n, (LSL_Types.list) value); 1363 DumpList(doc, n, (LSL_Types.list) value);
1364 1364
1365 if(name != String.Empty) 1365 if (name != String.Empty)
1366 { 1366 {
1367 XmlAttribute nam = doc.CreateAttribute("", "name", ""); 1367 XmlAttribute nam = doc.CreateAttribute("", "name", "");
1368 nam.Value = name; 1368 nam.Value = name;
@@ -1377,7 +1377,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1377 1377
1378 typ.Value = t.ToString(); 1378 typ.Value = t.ToString();
1379 n.Attributes.Append(typ); 1379 n.Attributes.Append(typ);
1380 if(name != String.Empty) 1380 if (name != String.Empty)
1381 { 1381 {
1382 XmlAttribute nam = doc.CreateAttribute("", "name", ""); 1382 XmlAttribute nam = doc.CreateAttribute("", "name", "");
1383 nam.Value = name; 1383 nam.Value = name;
@@ -1401,31 +1401,31 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1401 1401
1402 string itemType = tag.Attributes.GetNamedItem("type").Value; 1402 string itemType = tag.Attributes.GetNamedItem("type").Value;
1403 1403
1404 if(itemType == "list") 1404 if (itemType == "list")
1405 return ReadList(tag); 1405 return ReadList(tag);
1406 1406
1407 if(itemType == "libsecondlife.LLUUID") 1407 if (itemType == "libsecondlife.LLUUID")
1408 { 1408 {
1409 LLUUID val = new LLUUID(); 1409 LLUUID val = new LLUUID();
1410 LLUUID.TryParse(tag.InnerText, out val); 1410 LLUUID.TryParse(tag.InnerText, out val);
1411 1411
1412 return val; 1412 return val;
1413 } 1413 }
1414 1414
1415 Type itemT = Type.GetType(itemType); 1415 Type itemT = Type.GetType(itemType);
1416 if(itemT == null) 1416 if (itemT == null)
1417 { 1417 {
1418 Object[] args = 1418 Object[] args =
1419 new Object[] { tag.InnerText }; 1419 new Object[] { tag.InnerText };
1420 1420
1421 assembly = itemType+", OpenSim.Region.ScriptEngine.XEngine.Script"; 1421 assembly = itemType+", OpenSim.Region.ScriptEngine.XEngine.Script";
1422 itemT = Type.GetType(assembly); 1422 itemT = Type.GetType(assembly);
1423 if(itemT == null) 1423 if (itemT == null)
1424 return null; 1424 return null;
1425 1425
1426 varValue = Activator.CreateInstance(itemT, args); 1426 varValue = Activator.CreateInstance(itemT, args);
1427 1427
1428 if(varValue == null) 1428 if (varValue == null)
1429 return null; 1429 return null;
1430 } 1430 }
1431 else 1431 else