diff options
author | diva | 2009-05-25 19:20:27 +0000 |
---|---|---|
committer | diva | 2009-05-25 19:20:27 +0000 |
commit | 896c20671887175255e5db205a721165810cf32e (patch) | |
tree | 59c0b331505c8738521b6b00a79c5e7323763095 /OpenSim/Framework/Util.cs | |
parent | * Display normal log information in the console's default foreground colour, ... (diff) | |
download | opensim-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/Framework/Util.cs')
-rw-r--r-- | OpenSim/Framework/Util.cs | 24 |
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; | |||
45 | using Nini.Config; | 45 | using Nini.Config; |
46 | using Nwc.XmlRpc; | 46 | using Nwc.XmlRpc; |
47 | using OpenMetaverse; | 47 | using OpenMetaverse; |
48 | using OpenMetaverse.StructuredData; | ||
48 | 49 | ||
49 | namespace OpenSim.Framework | 50 | namespace 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 | } |