diff options
author | UbitUmarov | 2017-05-28 01:56:52 +0100 |
---|---|---|
committer | UbitUmarov | 2017-05-28 01:56:52 +0100 |
commit | 572e84c8225493c5ff2d7799ac132ba608442d90 (patch) | |
tree | 52afd21e688a65662e422de826cdbfa271db73ad /OpenSim/Region | |
parent | make LSL_list a CLASS again. Now we need to it allover again. Scripts need t... (diff) | |
download | opensim-SC-572e84c8225493c5ff2d7799ac132ba608442d90.zip opensim-SC-572e84c8225493c5ff2d7799ac132ba608442d90.tar.gz opensim-SC-572e84c8225493c5ff2d7799ac132ba608442d90.tar.bz2 opensim-SC-572e84c8225493c5ff2d7799ac132ba608442d90.tar.xz |
make use of a rare thing called StringBuilder on LSL_List. LSL_List uses may need a revision to make sure they are passed by ref and not by value, with necessary adjustments. This does not have much impact on AppDomains, since if they cross, they are always serialized. Since lists are important parts of LSL, the AppDomainLoading option needs to be replaced by something else
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 69 |
1 files changed, 39 insertions, 30 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index bf47f1f..4d7a698 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Globalization; | 30 | using System.Globalization; |
31 | using System.Text; | ||
31 | using System.Text.RegularExpressions; | 32 | using System.Text.RegularExpressions; |
32 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
33 | 34 | ||
@@ -1152,34 +1153,35 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1152 | 1153 | ||
1153 | public string ToCSV() | 1154 | public string ToCSV() |
1154 | { | 1155 | { |
1155 | string ret = ""; | 1156 | if(m_data == null || m_data.Length == 0) |
1156 | foreach (object o in this.Data) | 1157 | return String.Empty; |
1158 | |||
1159 | Object o = m_data[0]; | ||
1160 | int len = m_data.Length; | ||
1161 | if(len == 1) | ||
1162 | return o.ToString(); | ||
1163 | |||
1164 | StringBuilder sb = new StringBuilder(1024); | ||
1165 | sb.Append(o.ToString()); | ||
1166 | for(int i = 1 ; i < len; i++) | ||
1157 | { | 1167 | { |
1158 | if (ret == "") | 1168 | sb.Append(","); |
1159 | { | 1169 | sb.Append(o.ToString()); |
1160 | ret = o.ToString(); | ||
1161 | } | ||
1162 | else | ||
1163 | { | ||
1164 | ret = ret + ", " + o.ToString(); | ||
1165 | } | ||
1166 | } | 1170 | } |
1167 | return ret; | 1171 | return sb.ToString(); |
1168 | } | 1172 | } |
1169 | 1173 | ||
1170 | private string ToSoup() | 1174 | private string ToSoup() |
1171 | { | 1175 | { |
1172 | string output; | 1176 | if(m_data == null || m_data.Length == 0) |
1173 | output = String.Empty; | ||
1174 | if (Data.Length == 0) | ||
1175 | { | ||
1176 | return String.Empty; | 1177 | return String.Empty; |
1177 | } | 1178 | |
1178 | foreach (object o in Data) | 1179 | StringBuilder sb = new StringBuilder(1024); |
1180 | foreach (object o in m_data) | ||
1179 | { | 1181 | { |
1180 | output = output + o.ToString(); | 1182 | sb.Append(o.ToString()); |
1181 | } | 1183 | } |
1182 | return output; | 1184 | return sb.ToString(); |
1183 | } | 1185 | } |
1184 | 1186 | ||
1185 | public static explicit operator String(list l) | 1187 | public static explicit operator String(list l) |
@@ -1369,26 +1371,33 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1369 | 1371 | ||
1370 | public string ToPrettyString() | 1372 | public string ToPrettyString() |
1371 | { | 1373 | { |
1372 | string output; | 1374 | if(m_data == null || m_data.Length == 0) |
1373 | if (Data.Length == 0) | ||
1374 | { | ||
1375 | return "[]"; | 1375 | return "[]"; |
1376 | } | 1376 | |
1377 | output = "["; | 1377 | StringBuilder sb = new StringBuilder(1024); |
1378 | foreach (object o in Data) | 1378 | int len = m_data.Length; |
1379 | int last = len - 1; | ||
1380 | object o; | ||
1381 | |||
1382 | sb.Append("["); | ||
1383 | for(int i = 0; i < len; i++ ) | ||
1379 | { | 1384 | { |
1385 | o = m_data[i]; | ||
1380 | if (o is String) | 1386 | if (o is String) |
1381 | { | 1387 | { |
1382 | output = output + "\"" + o + "\", "; | 1388 | sb.Append("\""); |
1389 | sb.Append((String)o); | ||
1390 | sb.Append("\""); | ||
1383 | } | 1391 | } |
1384 | else | 1392 | else |
1385 | { | 1393 | { |
1386 | output = output + o.ToString() + ", "; | 1394 | sb.Append(o.ToString()); |
1387 | } | 1395 | } |
1396 | if(i < last) | ||
1397 | sb.Append(","); | ||
1388 | } | 1398 | } |
1389 | output = output.Substring(0, output.Length - 2); | 1399 | sb.Append("]"); |
1390 | output = output + "]"; | 1400 | return sb.ToString(); |
1391 | return output; | ||
1392 | } | 1401 | } |
1393 | 1402 | ||
1394 | public class AlphaCompare : IComparer | 1403 | public class AlphaCompare : IComparer |