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
parent
18f1ea1086
commit
572e84c822
|
@ -28,6 +28,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
|
||||||
|
@ -1152,34 +1153,35 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
|
|
||||||
public string ToCSV()
|
public string ToCSV()
|
||||||
{
|
{
|
||||||
string ret = "";
|
if(m_data == null || m_data.Length == 0)
|
||||||
foreach (object o in this.Data)
|
return String.Empty;
|
||||||
|
|
||||||
|
Object o = m_data[0];
|
||||||
|
int len = m_data.Length;
|
||||||
|
if(len == 1)
|
||||||
|
return o.ToString();
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder(1024);
|
||||||
|
sb.Append(o.ToString());
|
||||||
|
for(int i = 1 ; i < len; i++)
|
||||||
{
|
{
|
||||||
if (ret == "")
|
sb.Append(",");
|
||||||
{
|
sb.Append(o.ToString());
|
||||||
ret = o.ToString();
|
|
||||||
}
|
}
|
||||||
else
|
return sb.ToString();
|
||||||
{
|
|
||||||
ret = ret + ", " + o.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ToSoup()
|
private string ToSoup()
|
||||||
{
|
{
|
||||||
string output;
|
if(m_data == null || m_data.Length == 0)
|
||||||
output = String.Empty;
|
|
||||||
if (Data.Length == 0)
|
|
||||||
{
|
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
}
|
|
||||||
foreach (object o in Data)
|
StringBuilder sb = new StringBuilder(1024);
|
||||||
|
foreach (object o in m_data)
|
||||||
{
|
{
|
||||||
output = output + o.ToString();
|
sb.Append(o.ToString());
|
||||||
}
|
}
|
||||||
return output;
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static explicit operator String(list l)
|
public static explicit operator String(list l)
|
||||||
|
@ -1369,26 +1371,33 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
|
|
||||||
public string ToPrettyString()
|
public string ToPrettyString()
|
||||||
{
|
{
|
||||||
string output;
|
if(m_data == null || m_data.Length == 0)
|
||||||
if (Data.Length == 0)
|
|
||||||
{
|
|
||||||
return "[]";
|
return "[]";
|
||||||
}
|
|
||||||
output = "[";
|
StringBuilder sb = new StringBuilder(1024);
|
||||||
foreach (object o in Data)
|
int len = m_data.Length;
|
||||||
|
int last = len - 1;
|
||||||
|
object o;
|
||||||
|
|
||||||
|
sb.Append("[");
|
||||||
|
for(int i = 0; i < len; i++ )
|
||||||
{
|
{
|
||||||
|
o = m_data[i];
|
||||||
if (o is String)
|
if (o is String)
|
||||||
{
|
{
|
||||||
output = output + "\"" + o + "\", ";
|
sb.Append("\"");
|
||||||
|
sb.Append((String)o);
|
||||||
|
sb.Append("\"");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
output = output + o.ToString() + ", ";
|
sb.Append(o.ToString());
|
||||||
}
|
}
|
||||||
|
if(i < last)
|
||||||
|
sb.Append(",");
|
||||||
}
|
}
|
||||||
output = output.Substring(0, output.Length - 2);
|
sb.Append("]");
|
||||||
output = output + "]";
|
return sb.ToString();
|
||||||
return output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AlphaCompare : IComparer
|
public class AlphaCompare : IComparer
|
||||||
|
|
Loading…
Reference in New Issue