From 98019031dfc8934be2feb92c99c514307b1ca159 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 25 Jan 2018 09:06:39 +0000 Subject: got tired of creating stringbuilders --- OpenSim/Framework/LLSDxmlEncode.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/LLSDxmlEncode.cs b/OpenSim/Framework/LLSDxmlEncode.cs index e095363..5447963 100644 --- a/OpenSim/Framework/LLSDxmlEncode.cs +++ b/OpenSim/Framework/LLSDxmlEncode.cs @@ -48,11 +48,28 @@ namespace OpenSim.Framework sb.Append(""); } + // got tired of creating a stringbuilder all the time; + public static StringBuilder Start(int size = 256, bool addxmlversion = false) + { + StringBuilder sb = new StringBuilder(size); + if(addxmlversion) + sb.Append(""); // legacy llsd xml name still valid + else + sb.Append(""); + return sb; + } + public static void AddEnd(StringBuilder sb) { sb.Append(""); } + public static string End(StringBuilder sb) + { + sb.Append(""); + return sb.ToString(); + } + // map == a list of key value pairs public static void AddMap(StringBuilder sb) { @@ -452,7 +469,6 @@ namespace OpenSim.Framework { int i; char c; - String t; int len = s.Length; for (i = 0; i < len; i++) -- cgit v1.1