add a few more encoding to LLSDxmlEncode.. (W or S ?)

httptests
UbitUmarov 2018-01-27 05:35:40 +00:00
parent 13b4ce8199
commit f89b2379a0
2 changed files with 224 additions and 1 deletions

View File

@ -128,6 +128,18 @@ namespace OpenSim.Framework
}
}
public static void AddElem(byte[] e, StringBuilder sb)
{
if(e == null || e.Length == 0)
sb.Append("binary />");
else
{
sb.Append("<binary>"); // encode64 is default
sb.Append(Convert.ToBase64String(e,Base64FormattingOptions.None));
sb.Append("</binary>");
}
}
public static void AddElem(int e, StringBuilder sb)
{
if(e == 0)
@ -152,6 +164,101 @@ namespace OpenSim.Framework
}
}
public static void AddElem(Vector2 e, StringBuilder sb)
{
sb.Append("<map><key>x</key>");
if(e.X == 0)
sb.Append("<real /><key>y</key>");
else
{
sb.Append("<real>");
sb.Append(e.X.ToString(CultureInfo.InvariantCulture));
sb.Append("</real><key>y</key>");
}
if(e.Y == 0)
sb.Append("<real /></map>");
else
{
sb.Append("<real>");
sb.Append(e.Y.ToString(CultureInfo.InvariantCulture));
sb.Append("</real></map>");
}
}
public static void AddElem(Vector3 e, StringBuilder sb)
{
sb.Append("<map>key>x</key>");
if(e.X == 0)
sb.Append("<real /><key>y</key>");
else
{
sb.Append("<real>");
sb.Append(e.X.ToString(CultureInfo.InvariantCulture));
sb.Append("</real><key>y</key>");
}
if(e.Y == 0)
sb.Append("<real /><key>z</key>");
else
{
sb.Append("<real>");
sb.Append(e.Y.ToString(CultureInfo.InvariantCulture));
sb.Append("</real><key>z</key>");
}
if(e.Z == 0)
sb.Append("<real /></map>");
else
{
sb.Append("<real>");
sb.Append(e.Z.ToString(CultureInfo.InvariantCulture));
sb.Append("</real></map>");
}
}
public static void AddElem(Quaternion e, StringBuilder sb)
{
sb.Append("<map><key>x</key>");
if(e.X == 0)
sb.Append("<real /><key>y</key>");
else
{
sb.Append("<real>");
sb.Append(e.X.ToString(CultureInfo.InvariantCulture));
sb.Append("</real><key>y</key>");
}
if(e.Y == 0)
sb.Append("<real /><key>z</key>");
else
{
sb.Append("<real>");
sb.Append(e.Y.ToString(CultureInfo.InvariantCulture));
sb.Append("</real><key>z</key>");
}
if(e.Z == 0)
sb.Append("<real /><key>w</key>");
else
{
sb.Append("<real>");
sb.Append(e.Z.ToString(CultureInfo.InvariantCulture));
sb.Append("</real><key>w</key>");
}
if(e.W == 0)
sb.Append("<real /></map>");
else
{
sb.Append("<real>");
sb.Append(e.W.ToString(CultureInfo.InvariantCulture));
sb.Append("</real></map>");
}
}
public static void AddElem(double e, StringBuilder sb)
{
if(e == 0)
@ -312,6 +419,22 @@ namespace OpenSim.Framework
}
}
public static void AddElem(string name, byte[] e, StringBuilder sb)
{
sb.Append("<key>");
sb.Append(name);
sb.Append("</key>");
if(e == null || e.Length == 0)
sb.Append("binary />");
else
{
sb.Append("<binary>"); // encode64 is default
sb.Append(Convert.ToBase64String(e,Base64FormattingOptions.None));
sb.Append("</binary>");
}
}
public static void AddElem(string name, int e, StringBuilder sb)
{
sb.Append("<key>");
@ -344,6 +467,107 @@ namespace OpenSim.Framework
}
}
public static void AddElem(string name, Vector2 e, StringBuilder sb)
{
sb.Append("<key>");
sb.Append(name);
sb.Append("</key><map><key>x</key>");
if(e.X == 0)
sb.Append("<real /><key>y</key>");
else
{
sb.Append("<real>");
sb.Append(e.X.ToString(CultureInfo.InvariantCulture));
sb.Append("</real><key>y</key>");
}
if(e.Y == 0)
sb.Append("<real /></map>");
else
{
sb.Append("<real>");
sb.Append(e.Y.ToString(CultureInfo.InvariantCulture));
sb.Append("</real></map>");
}
}
public static void AddElem(string name, Vector3 e, StringBuilder sb)
{
sb.Append("<key>");
sb.Append(name);
sb.Append("</key><map>key>x</key>");
if(e.X == 0)
sb.Append("<real /><key>y</key>");
else
{
sb.Append("<real>");
sb.Append(e.X.ToString(CultureInfo.InvariantCulture));
sb.Append("</real><key>y</key>");
}
if(e.Y == 0)
sb.Append("<real /><key>z</key>");
else
{
sb.Append("<real>");
sb.Append(e.Y.ToString(CultureInfo.InvariantCulture));
sb.Append("</real><key>z</key>");
}
if(e.Z == 0)
sb.Append("<real /></map>");
else
{
sb.Append("<real>");
sb.Append(e.Z.ToString(CultureInfo.InvariantCulture));
sb.Append("</real></map>");
}
}
public static void AddElem(string name, Quaternion e, StringBuilder sb)
{
sb.Append("<key>");
sb.Append(name);
sb.Append("</key><map><key>x</key>");
if(e.X == 0)
sb.Append("<real /><key>y</key>");
else
{
sb.Append("<real>");
sb.Append(e.X.ToString(CultureInfo.InvariantCulture));
sb.Append("</real><key>y</key>");
}
if(e.Y == 0)
sb.Append("<real /><key>z</key>");
else
{
sb.Append("<real>");
sb.Append(e.Y.ToString(CultureInfo.InvariantCulture));
sb.Append("</real><key>z</key>");
}
if(e.Z == 0)
sb.Append("<real /><key>w</key>");
else
{
sb.Append("<real>");
sb.Append(e.Z.ToString(CultureInfo.InvariantCulture));
sb.Append("</real><key>w</key>");
}
if(e.W == 0)
sb.Append("<real /></map>");
else
{
sb.Append("<real>");
sb.Append(e.W.ToString(CultureInfo.InvariantCulture));
sb.Append("</real></map>");
}
}
public static void AddElem(string name, double e, StringBuilder sb)
{
sb.Append("<key>");

View File

@ -304,7 +304,6 @@ namespace OpenSim.Services.InventoryService
public InventoryItemBase[] GetMultipleItems(UUID[] ids)
{
List<InventoryItemBase> items = new List<InventoryItemBase>();
int i = 0;
foreach (UUID id in ids)
{
if(m_items.ContainsKey(id))