aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authordiva2009-05-25 19:20:27 +0000
committerdiva2009-05-25 19:20:27 +0000
commit896c20671887175255e5db205a721165810cf32e (patch)
tree59c0b331505c8738521b6b00a79c5e7323763095 /OpenSim
parent* Display normal log information in the console's default foreground colour, ... (diff)
downloadopensim-SC-896c20671887175255e5db205a721165810cf32e.zip
opensim-SC-896c20671887175255e5db205a721165810cf32e.tar.gz
opensim-SC-896c20671887175255e5db205a721165810cf32e.tar.bz2
opensim-SC-896c20671887175255e5db205a721165810cf32e.tar.xz
One more utility. Not used yet.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Util.cs24
1 files changed, 22 insertions, 2 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index ee47e0f..a188267 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -45,6 +45,7 @@ using log4net;
45using Nini.Config; 45using Nini.Config;
46using Nwc.XmlRpc; 46using Nwc.XmlRpc;
47using OpenMetaverse; 47using OpenMetaverse;
48using OpenMetaverse.StructuredData;
48 49
49namespace OpenSim.Framework 50namespace OpenSim.Framework
50{ 51{
@@ -1088,8 +1089,27 @@ namespace OpenSim.Framework
1088 1089
1089 } 1090 }
1090 1091
1091 1092 /// <summary>
1092 1093 /// Produces an OSDMap from its string representation on a stream
1094 /// </summary>
1095 /// <param name="data">The stream</param>
1096 /// <param name="length">The size of the data on the stream</param>
1097 /// <returns>The OSDMap or an exception</returns>
1098 public static OSDMap GetOSDMap(Stream stream, int length)
1099 {
1100 byte[] data = new byte[length];
1101 stream.Read(data, 0, length);
1102 string strdata = Encoding.UTF8.GetString(data);
1103 OSDMap args = null;
1104 OSD buffer;
1105 buffer = OSDParser.DeserializeJson(strdata);
1106 if (buffer.Type == OSDType.Map)
1107 {
1108 args = (OSDMap)buffer;
1109 return args;
1110 }
1111 return null;
1112 }
1093 1113
1094 } 1114 }
1095} 1115}