From f89b2379a05c53d38643f0c8bdeddfb376dd2737 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 27 Jan 2018 05:35:40 +0000 Subject: add a few more encoding to LLSDxmlEncode.. (W or S ?) --- OpenSim/Framework/LLSDxmlEncode.cs | 224 +++++++++++++++++++++++++++++++++++++ 1 file changed, 224 insertions(+) (limited to 'OpenSim/Framework/LLSDxmlEncode.cs') diff --git a/OpenSim/Framework/LLSDxmlEncode.cs b/OpenSim/Framework/LLSDxmlEncode.cs index bd99cd6..a740866 100644 --- a/OpenSim/Framework/LLSDxmlEncode.cs +++ b/OpenSim/Framework/LLSDxmlEncode.cs @@ -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(""); // encode64 is default + sb.Append(Convert.ToBase64String(e,Base64FormattingOptions.None)); + sb.Append(""); + } + } + 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("x"); + + if(e.X == 0) + sb.Append("y"); + else + { + sb.Append(""); + sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); + sb.Append("y"); + } + + if(e.Y == 0) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e.Y.ToString(CultureInfo.InvariantCulture)); + sb.Append(""); + } + } + + public static void AddElem(Vector3 e, StringBuilder sb) + { + sb.Append("key>x"); + + if(e.X == 0) + sb.Append("y"); + else + { + sb.Append(""); + sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); + sb.Append("y"); + } + + if(e.Y == 0) + sb.Append("z"); + else + { + sb.Append(""); + sb.Append(e.Y.ToString(CultureInfo.InvariantCulture)); + sb.Append("z"); + } + + if(e.Z == 0) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e.Z.ToString(CultureInfo.InvariantCulture)); + sb.Append(""); + } + } + + public static void AddElem(Quaternion e, StringBuilder sb) + { + sb.Append("x"); + + if(e.X == 0) + sb.Append("y"); + else + { + sb.Append(""); + sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); + sb.Append("y"); + } + + if(e.Y == 0) + sb.Append("z"); + else + { + sb.Append(""); + sb.Append(e.Y.ToString(CultureInfo.InvariantCulture)); + sb.Append("z"); + } + if(e.Z == 0) + sb.Append("w"); + else + { + sb.Append(""); + sb.Append(e.Z.ToString(CultureInfo.InvariantCulture)); + sb.Append("w"); + } + + if(e.W == 0) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e.W.ToString(CultureInfo.InvariantCulture)); + sb.Append(""); + } + } + 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(""); + sb.Append(name); + sb.Append(""); + + if(e == null || e.Length == 0) + sb.Append("binary />"); + else + { + sb.Append(""); // encode64 is default + sb.Append(Convert.ToBase64String(e,Base64FormattingOptions.None)); + sb.Append(""); + } + } + public static void AddElem(string name, int e, StringBuilder sb) { sb.Append(""); @@ -344,6 +467,107 @@ namespace OpenSim.Framework } } + public static void AddElem(string name, Vector2 e, StringBuilder sb) + { + sb.Append(""); + sb.Append(name); + sb.Append("x"); + + if(e.X == 0) + sb.Append("y"); + else + { + sb.Append(""); + sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); + sb.Append("y"); + } + + if(e.Y == 0) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e.Y.ToString(CultureInfo.InvariantCulture)); + sb.Append(""); + } + } + + public static void AddElem(string name, Vector3 e, StringBuilder sb) + { + sb.Append(""); + sb.Append(name); + sb.Append("key>x"); + + if(e.X == 0) + sb.Append("y"); + else + { + sb.Append(""); + sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); + sb.Append("y"); + } + + if(e.Y == 0) + sb.Append("z"); + else + { + sb.Append(""); + sb.Append(e.Y.ToString(CultureInfo.InvariantCulture)); + sb.Append("z"); + } + + if(e.Z == 0) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e.Z.ToString(CultureInfo.InvariantCulture)); + sb.Append(""); + } + } + + public static void AddElem(string name, Quaternion e, StringBuilder sb) + { + sb.Append(""); + sb.Append(name); + sb.Append("x"); + + if(e.X == 0) + sb.Append("y"); + else + { + sb.Append(""); + sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); + sb.Append("y"); + } + + if(e.Y == 0) + sb.Append("z"); + else + { + sb.Append(""); + sb.Append(e.Y.ToString(CultureInfo.InvariantCulture)); + sb.Append("z"); + } + if(e.Z == 0) + sb.Append("w"); + else + { + sb.Append(""); + sb.Append(e.Z.ToString(CultureInfo.InvariantCulture)); + sb.Append("w"); + } + + if(e.W == 0) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e.W.ToString(CultureInfo.InvariantCulture)); + sb.Append(""); + } + } + public static void AddElem(string name, double e, StringBuilder sb) { sb.Append(""); -- cgit v1.1