diff options
author | Melanie Thielker | 2009-05-09 01:00:21 +0000 |
---|---|---|
committer | Melanie Thielker | 2009-05-09 01:00:21 +0000 |
commit | cc2b072f6e9f535dfad79e79d778177a5aa90890 (patch) | |
tree | 54ac19fef6442bd5e7b648dceb7ff3e22a7698ff /OpenSim/Servers/Base | |
parent | Add the /data and /metadata retrieval modes to the new asset server. (diff) | |
download | opensim-SC_OLD-cc2b072f6e9f535dfad79e79d778177a5aa90890.zip opensim-SC_OLD-cc2b072f6e9f535dfad79e79d778177a5aa90890.tar.gz opensim-SC_OLD-cc2b072f6e9f535dfad79e79d778177a5aa90890.tar.bz2 opensim-SC_OLD-cc2b072f6e9f535dfad79e79d778177a5aa90890.tar.xz |
FInish basic asset server functionality on the new asset server
Diffstat (limited to 'OpenSim/Servers/Base')
-rw-r--r-- | OpenSim/Servers/Base/ServerUtils.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/OpenSim/Servers/Base/ServerUtils.cs b/OpenSim/Servers/Base/ServerUtils.cs index b648e45..58d2b2b 100644 --- a/OpenSim/Servers/Base/ServerUtils.cs +++ b/OpenSim/Servers/Base/ServerUtils.cs | |||
@@ -25,6 +25,12 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
29 | using System.IO; | ||
30 | using System.Xml; | ||
31 | using System.Xml.Serialization; | ||
32 | using System.Text; | ||
33 | |||
28 | namespace OpenSim.Servers.AssetServer | 34 | namespace OpenSim.Servers.AssetServer |
29 | { | 35 | { |
30 | public static class ServerUtils | 36 | public static class ServerUtils |
@@ -71,5 +77,20 @@ namespace OpenSim.Servers.AssetServer | |||
71 | return "application/octet-stream"; | 77 | return "application/octet-stream"; |
72 | } | 78 | } |
73 | } | 79 | } |
80 | |||
81 | public static byte[] SerializeResult(XmlSerializer xs, object data) | ||
82 | { | ||
83 | MemoryStream ms = new MemoryStream(); | ||
84 | XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8); | ||
85 | xw.Formatting = Formatting.Indented; | ||
86 | xs.Serialize(xw, data); | ||
87 | xw.Flush(); | ||
88 | |||
89 | ms.Seek(0, SeekOrigin.Begin); | ||
90 | byte[] ret = ms.GetBuffer(); | ||
91 | Array.Resize<byte>(ref ret, (int)ms.Length); | ||
92 | |||
93 | return ret; | ||
94 | } | ||
74 | } | 95 | } |
75 | } | 96 | } |