Close streams immediately when we finish using them
parent
01d13b4ad7
commit
e41e52e097
|
@ -215,18 +215,7 @@ namespace OpenSim.OfflineIM
|
||||||
|
|
||||||
rootElement.AppendChild(result);
|
rootElement.AppendChild(result);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] DocToBytes(XmlDocument doc)
|
|
||||||
{
|
|
||||||
MemoryStream ms = new MemoryStream();
|
|
||||||
XmlTextWriter xw = new XmlTextWriter(ms, null);
|
|
||||||
xw.Formatting = Formatting.Indented;
|
|
||||||
doc.WriteTo(xw);
|
|
||||||
xw.Flush();
|
|
||||||
|
|
||||||
return ms.ToArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -68,7 +68,10 @@ namespace OpenSim.Framework.Capabilities
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static object LLSDDeserialize(byte[] b)
|
public static object LLSDDeserialize(byte[] b)
|
||||||
{
|
{
|
||||||
return LLSDDeserialize(new MemoryStream(b, false));
|
using (MemoryStream ms = new MemoryStream(b, false))
|
||||||
|
{
|
||||||
|
return LLSDDeserialize(ms);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -78,21 +81,23 @@ namespace OpenSim.Framework.Capabilities
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static object LLSDDeserialize(Stream st)
|
public static object LLSDDeserialize(Stream st)
|
||||||
{
|
{
|
||||||
XmlTextReader reader = new XmlTextReader(st);
|
using (XmlTextReader reader = new XmlTextReader(st))
|
||||||
reader.Read();
|
{
|
||||||
SkipWS(reader);
|
reader.Read();
|
||||||
|
SkipWS(reader);
|
||||||
|
|
||||||
if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "llsd")
|
if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "llsd")
|
||||||
throw new LLSDParseException("Expected <llsd>");
|
throw new LLSDParseException("Expected <llsd>");
|
||||||
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
object ret = LLSDParseOne(reader);
|
object ret = LLSDParseOne(reader);
|
||||||
SkipWS(reader);
|
SkipWS(reader);
|
||||||
|
|
||||||
if (reader.NodeType != XmlNodeType.EndElement || reader.LocalName != "llsd")
|
if (reader.NodeType != XmlNodeType.EndElement || reader.LocalName != "llsd")
|
||||||
throw new LLSDParseException("Expected </llsd>");
|
throw new LLSDParseException("Expected </llsd>");
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace OpenSim.Framework.Communications
|
||||||
/// other threads to execute, while it waits for a response from the web-service. RestClient itself can be
|
/// other threads to execute, while it waits for a response from the web-service. RestClient itself can be
|
||||||
/// invoked by the caller in either synchronous mode or asynchronous modes.
|
/// invoked by the caller in either synchronous mode or asynchronous modes.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public class RestClient
|
public class RestClient : IDisposable
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
@ -148,6 +148,33 @@ namespace OpenSim.Framework.Communications
|
||||||
|
|
||||||
#endregion constructors
|
#endregion constructors
|
||||||
|
|
||||||
|
|
||||||
|
#region Dispose
|
||||||
|
|
||||||
|
private bool disposed = false;
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Dispose(true);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (disposing)
|
||||||
|
{
|
||||||
|
_resource.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
disposed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Dispose
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add a path element to the query, e.g. assets
|
/// Add a path element to the query, e.g. assets
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -832,28 +832,40 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
return; // never log these; they're just binary data
|
return; // never log these; they're just binary data
|
||||||
|
|
||||||
Stream inputStream = Util.Copy(request.InputStream);
|
Stream inputStream = Util.Copy(request.InputStream);
|
||||||
|
Stream innerStream = null;
|
||||||
if ((request.Headers["Content-Encoding"] == "gzip") || (request.Headers["X-Content-Encoding"] == "gzip"))
|
try
|
||||||
inputStream = new GZipStream(inputStream, System.IO.Compression.CompressionMode.Decompress);
|
|
||||||
|
|
||||||
using (StreamReader reader = new StreamReader(inputStream, Encoding.UTF8))
|
|
||||||
{
|
{
|
||||||
string output;
|
if ((request.Headers["Content-Encoding"] == "gzip") || (request.Headers["X-Content-Encoding"] == "gzip"))
|
||||||
|
|
||||||
if (DebugLevel == 5)
|
|
||||||
{
|
{
|
||||||
char[] chars = new char[WebUtil.MaxRequestDiagLength + 1]; // +1 so we know to add "..." only if needed
|
innerStream = inputStream;
|
||||||
int len = reader.Read(chars, 0, WebUtil.MaxRequestDiagLength + 1);
|
inputStream = new GZipStream(innerStream, System.IO.Compression.CompressionMode.Decompress);
|
||||||
output = new string(chars, 0, Math.Min(len, WebUtil.MaxRequestDiagLength));
|
|
||||||
if (len > WebUtil.MaxRequestDiagLength)
|
|
||||||
output += "...";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
output = reader.ReadToEnd();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.DebugFormat("[LOGHTTP] {0}", Util.BinaryToASCII(output));
|
using (StreamReader reader = new StreamReader(inputStream, Encoding.UTF8))
|
||||||
|
{
|
||||||
|
string output;
|
||||||
|
|
||||||
|
if (DebugLevel == 5)
|
||||||
|
{
|
||||||
|
char[] chars = new char[WebUtil.MaxRequestDiagLength + 1]; // +1 so we know to add "..." only if needed
|
||||||
|
int len = reader.Read(chars, 0, WebUtil.MaxRequestDiagLength + 1);
|
||||||
|
output = new string(chars, 0, Math.Min(len, WebUtil.MaxRequestDiagLength));
|
||||||
|
if (len > WebUtil.MaxRequestDiagLength)
|
||||||
|
output += "...";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
output = reader.ReadToEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_log.DebugFormat("[LOGHTTP] {0}", Util.BinaryToASCII(output));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (innerStream != null)
|
||||||
|
innerStream.Dispose();
|
||||||
|
inputStream.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -981,19 +993,33 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
/// <param name="response"></param>
|
/// <param name="response"></param>
|
||||||
private byte[] HandleXmlRpcRequests(OSHttpRequest request, OSHttpResponse response)
|
private byte[] HandleXmlRpcRequests(OSHttpRequest request, OSHttpResponse response)
|
||||||
{
|
{
|
||||||
|
String requestBody;
|
||||||
|
|
||||||
Stream requestStream = request.InputStream;
|
Stream requestStream = request.InputStream;
|
||||||
|
Stream innerStream = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if ((request.Headers["Content-Encoding"] == "gzip") || (request.Headers["X-Content-Encoding"] == "gzip"))
|
||||||
|
{
|
||||||
|
innerStream = requestStream;
|
||||||
|
requestStream = new GZipStream(innerStream, System.IO.Compression.CompressionMode.Decompress);
|
||||||
|
}
|
||||||
|
|
||||||
if ((request.Headers["Content-Encoding"] == "gzip") || (request.Headers["X-Content-Encoding"] == "gzip"))
|
using (StreamReader reader = new StreamReader(requestStream, Encoding.UTF8))
|
||||||
requestStream = new GZipStream(requestStream, System.IO.Compression.CompressionMode.Decompress);
|
{
|
||||||
|
requestBody = reader.ReadToEnd();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (innerStream != null)
|
||||||
|
innerStream.Dispose();
|
||||||
|
requestStream.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
Encoding encoding = Encoding.UTF8;
|
|
||||||
StreamReader reader = new StreamReader(requestStream, encoding);
|
|
||||||
|
|
||||||
string requestBody = reader.ReadToEnd();
|
|
||||||
reader.Close();
|
|
||||||
requestStream.Close();
|
|
||||||
//m_log.Debug(requestBody);
|
//m_log.Debug(requestBody);
|
||||||
requestBody = requestBody.Replace("<base64></base64>", "");
|
requestBody = requestBody.Replace("<base64></base64>", "");
|
||||||
|
|
||||||
string responseString = String.Empty;
|
string responseString = String.Empty;
|
||||||
XmlRpcRequest xmlRprcRequest = null;
|
XmlRpcRequest xmlRprcRequest = null;
|
||||||
|
|
||||||
|
@ -1089,18 +1115,16 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
response.ContentType = "text/xml";
|
response.ContentType = "text/xml";
|
||||||
using (MemoryStream outs = new MemoryStream())
|
using (MemoryStream outs = new MemoryStream())
|
||||||
|
using (XmlTextWriter writer = new XmlTextWriter(outs, Encoding.UTF8))
|
||||||
{
|
{
|
||||||
using (XmlTextWriter writer = new XmlTextWriter(outs, Encoding.UTF8))
|
writer.Formatting = Formatting.None;
|
||||||
|
XmlRpcResponseSerializer.Singleton.Serialize(writer, xmlRpcResponse);
|
||||||
|
writer.Flush();
|
||||||
|
outs.Flush();
|
||||||
|
outs.Position = 0;
|
||||||
|
using (StreamReader sr = new StreamReader(outs))
|
||||||
{
|
{
|
||||||
writer.Formatting = Formatting.None;
|
responseString = sr.ReadToEnd();
|
||||||
XmlRpcResponseSerializer.Singleton.Serialize(writer, xmlRpcResponse);
|
|
||||||
writer.Flush();
|
|
||||||
outs.Flush();
|
|
||||||
outs.Position = 0;
|
|
||||||
using (StreamReader sr = new StreamReader(outs))
|
|
||||||
{
|
|
||||||
responseString = sr.ReadToEnd();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,23 +52,25 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
request.Method = verb;
|
request.Method = verb;
|
||||||
request.ContentType = "text/xml";
|
request.ContentType = "text/xml";
|
||||||
|
|
||||||
MemoryStream buffer = new MemoryStream();
|
using (MemoryStream buffer = new MemoryStream())
|
||||||
|
|
||||||
XmlWriterSettings settings = new XmlWriterSettings();
|
|
||||||
settings.Encoding = Encoding.UTF8;
|
|
||||||
|
|
||||||
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
|
|
||||||
{
|
{
|
||||||
XmlSerializer serializer = new XmlSerializer(type);
|
XmlWriterSettings settings = new XmlWriterSettings();
|
||||||
serializer.Serialize(writer, obj);
|
settings.Encoding = Encoding.UTF8;
|
||||||
writer.Flush();
|
|
||||||
|
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
|
||||||
|
{
|
||||||
|
XmlSerializer serializer = new XmlSerializer(type);
|
||||||
|
serializer.Serialize(writer, obj);
|
||||||
|
writer.Flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
int length = (int)buffer.Length;
|
||||||
|
request.ContentLength = length;
|
||||||
|
|
||||||
|
using (Stream requestStream = request.GetRequestStream())
|
||||||
|
requestStream.Write(buffer.ToArray(), 0, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
int length = (int) buffer.Length;
|
|
||||||
request.ContentLength = length;
|
|
||||||
|
|
||||||
Stream requestStream = request.GetRequestStream();
|
|
||||||
requestStream.Write(buffer.ToArray(), 0, length);
|
|
||||||
// IAsyncResult result = request.BeginGetResponse(AsyncCallback, request);
|
// IAsyncResult result = request.BeginGetResponse(AsyncCallback, request);
|
||||||
request.BeginGetResponse(AsyncCallback, request);
|
request.BeginGetResponse(AsyncCallback, request);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,24 +60,25 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
request.ContentType = "text/xml";
|
request.ContentType = "text/xml";
|
||||||
request.Timeout = 10000;
|
request.Timeout = 10000;
|
||||||
|
|
||||||
MemoryStream buffer = new MemoryStream();
|
using (MemoryStream buffer = new MemoryStream())
|
||||||
|
|
||||||
XmlWriterSettings settings = new XmlWriterSettings();
|
|
||||||
settings.Encoding = Encoding.UTF8;
|
|
||||||
|
|
||||||
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
|
|
||||||
{
|
{
|
||||||
XmlSerializer serializer = new XmlSerializer(type);
|
XmlWriterSettings settings = new XmlWriterSettings();
|
||||||
serializer.Serialize(writer, obj);
|
settings.Encoding = Encoding.UTF8;
|
||||||
writer.Flush();
|
|
||||||
|
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
|
||||||
|
{
|
||||||
|
XmlSerializer serializer = new XmlSerializer(type);
|
||||||
|
serializer.Serialize(writer, obj);
|
||||||
|
writer.Flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
int length = (int)buffer.Length;
|
||||||
|
request.ContentLength = length;
|
||||||
|
|
||||||
|
using (Stream requestStream = request.GetRequestStream())
|
||||||
|
requestStream.Write(buffer.ToArray(), 0, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
int length = (int) buffer.Length;
|
|
||||||
request.ContentLength = length;
|
|
||||||
|
|
||||||
Stream requestStream = request.GetRequestStream();
|
|
||||||
requestStream.Write(buffer.ToArray(), 0, length);
|
|
||||||
requestStream.Close();
|
|
||||||
// IAsyncResult result = request.BeginGetResponse(AsyncCallback, request);
|
// IAsyncResult result = request.BeginGetResponse(AsyncCallback, request);
|
||||||
request.BeginGetResponse(AsyncCallback, request);
|
request.BeginGetResponse(AsyncCallback, request);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,26 +77,25 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
request.ContentType = "text/xml";
|
request.ContentType = "text/xml";
|
||||||
request.Timeout = 20000;
|
request.Timeout = 20000;
|
||||||
|
|
||||||
MemoryStream buffer = new MemoryStream();
|
using (MemoryStream buffer = new MemoryStream())
|
||||||
|
|
||||||
XmlWriterSettings settings = new XmlWriterSettings();
|
|
||||||
settings.Encoding = Encoding.UTF8;
|
|
||||||
|
|
||||||
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
|
|
||||||
{
|
{
|
||||||
XmlSerializer serializer = new XmlSerializer(type);
|
XmlWriterSettings settings = new XmlWriterSettings();
|
||||||
serializer.Serialize(writer, sobj);
|
settings.Encoding = Encoding.UTF8;
|
||||||
writer.Flush();
|
|
||||||
|
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
|
||||||
|
{
|
||||||
|
XmlSerializer serializer = new XmlSerializer(type);
|
||||||
|
serializer.Serialize(writer, sobj);
|
||||||
|
writer.Flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
int length = (int)buffer.Length;
|
||||||
|
request.ContentLength = length;
|
||||||
|
|
||||||
|
using (Stream requestStream = request.GetRequestStream())
|
||||||
|
requestStream.Write(buffer.ToArray(), 0, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
int length = (int)buffer.Length;
|
|
||||||
request.ContentLength = length;
|
|
||||||
|
|
||||||
Stream requestStream = request.GetRequestStream();
|
|
||||||
requestStream.Write(buffer.ToArray(), 0, length);
|
|
||||||
buffer.Close();
|
|
||||||
requestStream.Close();
|
|
||||||
|
|
||||||
TResponse deserial = default(TResponse);
|
TResponse deserial = default(TResponse);
|
||||||
using (WebResponse resp = request.GetResponse())
|
using (WebResponse resp = request.GetResponse())
|
||||||
{
|
{
|
||||||
|
@ -133,25 +132,25 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
request.ContentType = "text/xml";
|
request.ContentType = "text/xml";
|
||||||
request.Timeout = 10000;
|
request.Timeout = 10000;
|
||||||
|
|
||||||
MemoryStream buffer = new MemoryStream();
|
using (MemoryStream buffer = new MemoryStream())
|
||||||
|
|
||||||
XmlWriterSettings settings = new XmlWriterSettings();
|
|
||||||
settings.Encoding = Encoding.UTF8;
|
|
||||||
|
|
||||||
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
|
|
||||||
{
|
{
|
||||||
XmlSerializer serializer = new XmlSerializer(type);
|
XmlWriterSettings settings = new XmlWriterSettings();
|
||||||
serializer.Serialize(writer, sobj);
|
settings.Encoding = Encoding.UTF8;
|
||||||
writer.Flush();
|
|
||||||
|
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
|
||||||
|
{
|
||||||
|
XmlSerializer serializer = new XmlSerializer(type);
|
||||||
|
serializer.Serialize(writer, sobj);
|
||||||
|
writer.Flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
int length = (int)buffer.Length;
|
||||||
|
request.ContentLength = length;
|
||||||
|
|
||||||
|
using (Stream requestStream = request.GetRequestStream())
|
||||||
|
requestStream.Write(buffer.ToArray(), 0, length);
|
||||||
}
|
}
|
||||||
buffer.Close();
|
|
||||||
|
|
||||||
int length = (int)buffer.Length;
|
|
||||||
request.ContentLength = length;
|
|
||||||
|
|
||||||
Stream requestStream = request.GetRequestStream();
|
|
||||||
requestStream.Write(buffer.ToArray(), 0, length);
|
|
||||||
requestStream.Close();
|
|
||||||
// IAsyncResult result = request.BeginGetResponse(AsyncCallback, request);
|
// IAsyncResult result = request.BeginGetResponse(AsyncCallback, request);
|
||||||
request.BeginGetResponse(AsyncCallback, request);
|
request.BeginGetResponse(AsyncCallback, request);
|
||||||
}
|
}
|
||||||
|
|
|
@ -509,6 +509,19 @@ namespace OpenSim.Framework
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static byte[] DocToBytes(XmlDocument doc)
|
||||||
|
{
|
||||||
|
using (MemoryStream ms = new MemoryStream())
|
||||||
|
using (XmlTextWriter xw = new XmlTextWriter(ms, null))
|
||||||
|
{
|
||||||
|
xw.Formatting = Formatting.Indented;
|
||||||
|
doc.WriteTo(xw);
|
||||||
|
xw.Flush();
|
||||||
|
|
||||||
|
return ms.ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Is the platform Windows?
|
/// Is the platform Windows?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1307,46 +1320,6 @@ namespace OpenSim.Framework
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string Compress(string text)
|
|
||||||
{
|
|
||||||
byte[] buffer = Util.UTF8.GetBytes(text);
|
|
||||||
MemoryStream memory = new MemoryStream();
|
|
||||||
using (GZipStream compressor = new GZipStream(memory, CompressionMode.Compress, true))
|
|
||||||
{
|
|
||||||
compressor.Write(buffer, 0, buffer.Length);
|
|
||||||
}
|
|
||||||
|
|
||||||
memory.Position = 0;
|
|
||||||
|
|
||||||
byte[] compressed = new byte[memory.Length];
|
|
||||||
memory.Read(compressed, 0, compressed.Length);
|
|
||||||
|
|
||||||
byte[] compressedBuffer = new byte[compressed.Length + 4];
|
|
||||||
Buffer.BlockCopy(compressed, 0, compressedBuffer, 4, compressed.Length);
|
|
||||||
Buffer.BlockCopy(BitConverter.GetBytes(buffer.Length), 0, compressedBuffer, 0, 4);
|
|
||||||
return Convert.ToBase64String(compressedBuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string Decompress(string compressedText)
|
|
||||||
{
|
|
||||||
byte[] compressedBuffer = Convert.FromBase64String(compressedText);
|
|
||||||
using (MemoryStream memory = new MemoryStream())
|
|
||||||
{
|
|
||||||
int msgLength = BitConverter.ToInt32(compressedBuffer, 0);
|
|
||||||
memory.Write(compressedBuffer, 4, compressedBuffer.Length - 4);
|
|
||||||
|
|
||||||
byte[] buffer = new byte[msgLength];
|
|
||||||
|
|
||||||
memory.Position = 0;
|
|
||||||
using (GZipStream decompressor = new GZipStream(memory, CompressionMode.Decompress))
|
|
||||||
{
|
|
||||||
decompressor.Read(buffer, 0, buffer.Length);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Util.UTF8.GetString(buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Copy data from one stream to another, leaving the read position of both streams at the beginning.
|
/// Copy data from one stream to another, leaving the read position of both streams at the beginning.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -176,7 +176,8 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
public static void LogOutgoingDetail(string context, Stream outputStream)
|
public static void LogOutgoingDetail(string context, Stream outputStream)
|
||||||
{
|
{
|
||||||
using (StreamReader reader = new StreamReader(Util.Copy(outputStream), Encoding.UTF8))
|
using (Stream stream = Util.Copy(outputStream))
|
||||||
|
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
|
||||||
{
|
{
|
||||||
string output;
|
string output;
|
||||||
|
|
||||||
|
@ -262,12 +263,12 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
using (MemoryStream ms = new MemoryStream())
|
using (MemoryStream ms = new MemoryStream())
|
||||||
{
|
{
|
||||||
using (GZipStream comp = new GZipStream(ms, CompressionMode.Compress))
|
using (GZipStream comp = new GZipStream(ms, CompressionMode.Compress, true))
|
||||||
{
|
{
|
||||||
comp.Write(buffer, 0, buffer.Length);
|
comp.Write(buffer, 0, buffer.Length);
|
||||||
// We need to close the gzip stream before we write it anywhere
|
// We need to close the gzip stream before we write it anywhere
|
||||||
// because apparently something important related to gzip compression
|
// because apparently something important related to gzip compression
|
||||||
// gets written on the strteam upon Dispose()
|
// gets written on the stream upon Dispose()
|
||||||
}
|
}
|
||||||
byte[] buf = ms.ToArray();
|
byte[] buf = ms.ToArray();
|
||||||
request.ContentLength = buf.Length; //Count bytes to send
|
request.ContentLength = buf.Length; //Count bytes to send
|
||||||
|
|
|
@ -231,7 +231,11 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<int> layerStarts = CSJ2K.J2kImage.GetLayerBoundaries(new MemoryStream(j2kData));
|
List<int> layerStarts;
|
||||||
|
using (MemoryStream ms = new MemoryStream(j2kData))
|
||||||
|
{
|
||||||
|
layerStarts = CSJ2K.J2kImage.GetLayerBoundaries(ms);
|
||||||
|
}
|
||||||
|
|
||||||
if (layerStarts != null && layerStarts.Count > 0)
|
if (layerStarts != null && layerStarts.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
|
@ -289,18 +289,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
|
|
||||||
rootElement.AppendChild(result);
|
rootElement.AppendChild(result);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] DocToBytes(XmlDocument doc)
|
|
||||||
{
|
|
||||||
MemoryStream ms = new MemoryStream();
|
|
||||||
XmlTextWriter xw = new XmlTextWriter(ms, null);
|
|
||||||
xw.Formatting = Formatting.Indented;
|
|
||||||
doc.WriteTo(xw);
|
|
||||||
xw.Flush();
|
|
||||||
|
|
||||||
return ms.ToArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -918,17 +918,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
{
|
{
|
||||||
ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
|
ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
|
||||||
|
|
||||||
MemoryStream ms = new MemoryStream(data);
|
using (MemoryStream ms = new MemoryStream(data))
|
||||||
if (m_displacement != Vector3.Zero || m_rotation != 0f)
|
|
||||||
{
|
{
|
||||||
Vector2 rotationCenter = new Vector2(m_rotationCenter.X, m_rotationCenter.Y);
|
if (m_displacement != Vector3.Zero || m_rotation != 0f)
|
||||||
terrainModule.LoadFromStream(terrainPath, m_displacement, m_rotation, rotationCenter, ms);
|
{
|
||||||
|
Vector2 rotationCenter = new Vector2(m_rotationCenter.X, m_rotationCenter.Y);
|
||||||
|
terrainModule.LoadFromStream(terrainPath, m_displacement, m_rotation, rotationCenter, ms);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
terrainModule.LoadFromStream(terrainPath, ms);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
terrainModule.LoadFromStream(terrainPath, ms);
|
|
||||||
}
|
|
||||||
ms.Close();
|
|
||||||
|
|
||||||
m_log.DebugFormat("[ARCHIVER]: Restored terrain {0}", terrainPath);
|
m_log.DebugFormat("[ARCHIVER]: Restored terrain {0}", terrainPath);
|
||||||
|
|
||||||
|
|
|
@ -569,10 +569,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
string terrainPath = String.Format("{0}{1}{2}.r32",
|
string terrainPath = String.Format("{0}{1}{2}.r32",
|
||||||
regionDir, ArchiveConstants.TERRAINS_PATH, scene.RegionInfo.RegionName);
|
regionDir, ArchiveConstants.TERRAINS_PATH, scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
MemoryStream ms = new MemoryStream();
|
using (MemoryStream ms = new MemoryStream())
|
||||||
scene.RequestModuleInterface<ITerrainModule>().SaveToStream(terrainPath, ms);
|
{
|
||||||
m_archiveWriter.WriteFile(terrainPath, ms.ToArray());
|
scene.RequestModuleInterface<ITerrainModule>().SaveToStream(terrainPath, ms);
|
||||||
ms.Close();
|
m_archiveWriter.WriteFile(terrainPath, ms.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
m_log.InfoFormat("[ARCHIVER]: Adding scene objects to archive.");
|
m_log.InfoFormat("[ARCHIVER]: Adding scene objects to archive.");
|
||||||
|
|
||||||
|
|
|
@ -1116,9 +1116,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MemoryStream terrainStream = new MemoryStream(terrainData);
|
using (MemoryStream terrainStream = new MemoryStream(terrainData))
|
||||||
terr.LoadFromStream(filename, terrainStream);
|
terr.LoadFromStream(filename, terrainStream);
|
||||||
terrainStream.Close();
|
|
||||||
|
|
||||||
FileInfo x = new FileInfo(filename);
|
FileInfo x = new FileInfo(filename);
|
||||||
remoteClient.SendAlertMessage("Your terrain was loaded as a " + x.Extension + " file. It may take a few moments to appear.");
|
remoteClient.SendAlertMessage("Your terrain was loaded as a " + x.Extension + " file. It may take a few moments to appear.");
|
||||||
|
|
|
@ -281,18 +281,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
|
|
||||||
rootElement.AppendChild(result);
|
rootElement.AppendChild(result);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] DocToBytes(XmlDocument doc)
|
|
||||||
{
|
|
||||||
MemoryStream ms = new MemoryStream();
|
|
||||||
XmlTextWriter xw = new XmlTextWriter(ms, null);
|
|
||||||
xw.Formatting = Formatting.Indented;
|
|
||||||
doc.WriteTo(xw);
|
|
||||||
xw.Flush();
|
|
||||||
|
|
||||||
return ms.ToArray();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,13 +54,14 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
|
||||||
{
|
{
|
||||||
string xmlstream = GetObjectXml(scene);
|
string xmlstream = GetObjectXml(scene);
|
||||||
|
|
||||||
MemoryStream stream = ReformatXmlString(xmlstream);
|
using (MemoryStream stream = ReformatXmlString(xmlstream))
|
||||||
|
{
|
||||||
|
stream.Seek(0, SeekOrigin.Begin);
|
||||||
|
CreateXmlFile(stream, fileName);
|
||||||
|
|
||||||
stream.Seek(0, SeekOrigin.Begin);
|
stream.Seek(0, SeekOrigin.Begin);
|
||||||
CreateXmlFile(stream, fileName);
|
CreateCompressedXmlFile(stream, fileName);
|
||||||
|
}
|
||||||
stream.Seek(0, SeekOrigin.Begin);
|
|
||||||
CreateCompressedXmlFile(stream, fileName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MemoryStream ReformatXmlString(string xmlstream)
|
private static MemoryStream ReformatXmlString(string xmlstream)
|
||||||
|
@ -112,13 +113,16 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
|
||||||
{
|
{
|
||||||
#region GZip Compressed Version
|
#region GZip Compressed Version
|
||||||
|
|
||||||
FileStream objectsFileCompressed = new FileStream(fileName + ".gzs", FileMode.Create);
|
using (FileStream objectsFileCompressed = new FileStream(fileName + ".gzs", FileMode.Create))
|
||||||
MemoryStream gzipMSStream = new MemoryStream();
|
using (MemoryStream gzipMSStream = new MemoryStream())
|
||||||
GZipStream gzipStream = new GZipStream(gzipMSStream, CompressionMode.Compress);
|
{
|
||||||
xmlStream.WriteTo(gzipStream);
|
using (GZipStream gzipStream = new GZipStream(gzipMSStream, CompressionMode.Compress, true))
|
||||||
gzipMSStream.WriteTo(objectsFileCompressed);
|
{
|
||||||
objectsFileCompressed.Flush();
|
xmlStream.WriteTo(gzipStream);
|
||||||
objectsFileCompressed.Close();
|
}
|
||||||
|
|
||||||
|
gzipMSStream.WriteTo(objectsFileCompressed);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -1145,7 +1145,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
|
|
||||||
if (myMapImageJPEG.Length == 0)
|
if (myMapImageJPEG.Length == 0)
|
||||||
{
|
{
|
||||||
MemoryStream imgstream = new MemoryStream();
|
MemoryStream imgstream = null;
|
||||||
Bitmap mapTexture = new Bitmap(1,1);
|
Bitmap mapTexture = new Bitmap(1,1);
|
||||||
ManagedImage managedImage;
|
ManagedImage managedImage;
|
||||||
Image image = (Image)mapTexture;
|
Image image = (Image)mapTexture;
|
||||||
|
@ -1192,10 +1192,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
image.Dispose();
|
image.Dispose();
|
||||||
|
|
||||||
if (imgstream != null)
|
if (imgstream != null)
|
||||||
{
|
|
||||||
imgstream.Close();
|
|
||||||
imgstream.Dispose();
|
imgstream.Dispose();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1639,4 +1636,4 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
public uint itemtype;
|
public uint itemtype;
|
||||||
public ulong regionhandle;
|
public ulong regionhandle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -373,24 +373,27 @@ namespace OpenSim.Region.DataSnapshot
|
||||||
for (int i = 0; i < services.Length; i++)
|
for (int i = 0; i < services.Length; i++)
|
||||||
{
|
{
|
||||||
string url = services[i].Trim();
|
string url = services[i].Trim();
|
||||||
RestClient cli = new RestClient(url);
|
using (RestClient cli = new RestClient(url))
|
||||||
cli.AddQueryParameter("service", serviceName);
|
|
||||||
cli.AddQueryParameter("host", m_hostname);
|
|
||||||
cli.AddQueryParameter("port", m_listener_port);
|
|
||||||
cli.AddQueryParameter("secret", m_Secret.ToString());
|
|
||||||
cli.RequestMethod = "GET";
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
reply = cli.Request(null);
|
cli.AddQueryParameter("service", serviceName);
|
||||||
}
|
cli.AddQueryParameter("host", m_hostname);
|
||||||
catch (WebException)
|
cli.AddQueryParameter("port", m_listener_port);
|
||||||
{
|
cli.AddQueryParameter("secret", m_Secret.ToString());
|
||||||
m_log.Warn("[DATASNAPSHOT]: Unable to notify " + url);
|
cli.RequestMethod = "GET";
|
||||||
}
|
try
|
||||||
catch (Exception e)
|
{
|
||||||
{
|
reply = cli.Request(null);
|
||||||
m_log.Warn("[DATASNAPSHOT]: Ignoring unknown exception " + e.ToString());
|
}
|
||||||
|
catch (WebException)
|
||||||
|
{
|
||||||
|
m_log.Warn("[DATASNAPSHOT]: Unable to notify " + url);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Warn("[DATASNAPSHOT]: Ignoring unknown exception " + e.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] response = new byte[1024];
|
byte[] response = new byte[1024];
|
||||||
// int n = 0;
|
// int n = 0;
|
||||||
try
|
try
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
|
@ -113,31 +113,34 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||||
|
|
||||||
public byte[] ToBytes()
|
public byte[] ToBytes()
|
||||||
{
|
{
|
||||||
byte[] outputbytes = new byte[0];
|
byte[] outputbytes;
|
||||||
|
|
||||||
BinaryWriter iostream = new BinaryWriter(new MemoryStream());
|
using (MemoryStream ms = new MemoryStream())
|
||||||
iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(unknown0)));
|
using (BinaryWriter iostream = new BinaryWriter(ms))
|
||||||
iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(unknown1)));
|
|
||||||
iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(Priority)));
|
|
||||||
iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(Length)));
|
|
||||||
iostream.Write(BinBVHUtil.WriteNullTerminatedString(ExpressionName));
|
|
||||||
iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(InPoint)));
|
|
||||||
iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(OutPoint)));
|
|
||||||
iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(Loop ? 1 : 0)));
|
|
||||||
iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(EaseInTime)));
|
|
||||||
iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(EaseOutTime)));
|
|
||||||
iostream.Write(BinBVHUtil.ES(Utils.UIntToBytes(HandPose)));
|
|
||||||
iostream.Write(BinBVHUtil.ES(Utils.UIntToBytes((uint)(Joints.Length))));
|
|
||||||
|
|
||||||
for (int i = 0; i < Joints.Length; i++)
|
|
||||||
{
|
{
|
||||||
Joints[i].WriteBytesToStream(iostream, InPoint, OutPoint);
|
iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(unknown0)));
|
||||||
|
iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(unknown1)));
|
||||||
|
iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(Priority)));
|
||||||
|
iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(Length)));
|
||||||
|
iostream.Write(BinBVHUtil.WriteNullTerminatedString(ExpressionName));
|
||||||
|
iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(InPoint)));
|
||||||
|
iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(OutPoint)));
|
||||||
|
iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(Loop ? 1 : 0)));
|
||||||
|
iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(EaseInTime)));
|
||||||
|
iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(EaseOutTime)));
|
||||||
|
iostream.Write(BinBVHUtil.ES(Utils.UIntToBytes(HandPose)));
|
||||||
|
iostream.Write(BinBVHUtil.ES(Utils.UIntToBytes((uint)(Joints.Length))));
|
||||||
|
|
||||||
|
for (int i = 0; i < Joints.Length; i++)
|
||||||
|
{
|
||||||
|
Joints[i].WriteBytesToStream(iostream, InPoint, OutPoint);
|
||||||
|
}
|
||||||
|
iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(0)));
|
||||||
|
|
||||||
|
using (MemoryStream ms2 = (MemoryStream)iostream.BaseStream)
|
||||||
|
outputbytes = ms2.ToArray();
|
||||||
}
|
}
|
||||||
iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(0)));
|
|
||||||
MemoryStream ms = (MemoryStream)iostream.BaseStream;
|
|
||||||
outputbytes = ms.ToArray();
|
|
||||||
ms.Close();
|
|
||||||
iostream.Close();
|
|
||||||
return outputbytes;
|
return outputbytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -280,7 +280,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (!m_selected)
|
if (!m_selected)
|
||||||
{
|
{
|
||||||
StopTimer();
|
StopTimer();
|
||||||
m_serializedPosition = m_group.AbsolutePosition;
|
m_serializedPosition = m_group.AbsolutePosition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -308,10 +308,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MemoryStream ms = new MemoryStream(data);
|
using (MemoryStream ms = new MemoryStream(data))
|
||||||
BinaryFormatter fmt = new BinaryFormatter();
|
{
|
||||||
|
BinaryFormatter fmt = new BinaryFormatter();
|
||||||
newMotion = (KeyframeMotion)fmt.Deserialize(ms);
|
newMotion = (KeyframeMotion)fmt.Deserialize(ms);
|
||||||
|
}
|
||||||
|
|
||||||
newMotion.m_group = grp;
|
newMotion.m_group = grp;
|
||||||
|
|
||||||
|
@ -345,26 +346,26 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_group = grp;
|
m_group = grp;
|
||||||
m_scene = grp.Scene;
|
m_scene = grp.Scene;
|
||||||
|
|
||||||
Vector3 grppos = grp.AbsolutePosition;
|
Vector3 grppos = grp.AbsolutePosition;
|
||||||
Vector3 offset = grppos - m_serializedPosition;
|
Vector3 offset = grppos - m_serializedPosition;
|
||||||
// avoid doing it more than once
|
// avoid doing it more than once
|
||||||
// current this will happen dragging a prim to other region
|
// current this will happen dragging a prim to other region
|
||||||
m_serializedPosition = grppos;
|
m_serializedPosition = grppos;
|
||||||
|
|
||||||
m_basePosition += offset;
|
m_basePosition += offset;
|
||||||
m_nextPosition += offset;
|
m_nextPosition += offset;
|
||||||
|
|
||||||
m_currentFrame.StartPosition += offset;
|
m_currentFrame.StartPosition += offset;
|
||||||
m_currentFrame.Position += offset;
|
m_currentFrame.Position += offset;
|
||||||
|
|
||||||
for (int i = 0; i < m_frames.Count; i++)
|
for (int i = 0; i < m_frames.Count; i++)
|
||||||
{
|
{
|
||||||
Keyframe k = m_frames[i];
|
Keyframe k = m_frames[i];
|
||||||
k.StartPosition += offset;
|
k.StartPosition += offset;
|
||||||
k.Position += offset;
|
k.Position += offset;
|
||||||
m_frames[i]=k;
|
m_frames[i]=k;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_running)
|
if (m_running)
|
||||||
|
@ -527,7 +528,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
k.Position = pos;
|
k.Position = pos;
|
||||||
// k.Velocity = Vector3.Zero;
|
// k.Velocity = Vector3.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
k.StartRotation = rot;
|
k.StartRotation = rot;
|
||||||
if (k.Rotation.HasValue)
|
if (k.Rotation.HasValue)
|
||||||
|
@ -764,19 +765,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public Byte[] Serialize()
|
public Byte[] Serialize()
|
||||||
{
|
{
|
||||||
StopTimer();
|
StopTimer();
|
||||||
MemoryStream ms = new MemoryStream();
|
|
||||||
|
|
||||||
BinaryFormatter fmt = new BinaryFormatter();
|
|
||||||
SceneObjectGroup tmp = m_group;
|
SceneObjectGroup tmp = m_group;
|
||||||
m_group = null;
|
m_group = null;
|
||||||
if (!m_selected && tmp != null)
|
if (!m_selected && tmp != null)
|
||||||
m_serializedPosition = tmp.AbsolutePosition;
|
m_serializedPosition = tmp.AbsolutePosition;
|
||||||
fmt.Serialize(ms, this);
|
|
||||||
m_group = tmp;
|
|
||||||
if (m_running && !m_waitingCrossing)
|
|
||||||
StartTimer();
|
|
||||||
|
|
||||||
return ms.ToArray();
|
using (MemoryStream ms = new MemoryStream())
|
||||||
|
{
|
||||||
|
BinaryFormatter fmt = new BinaryFormatter();
|
||||||
|
fmt.Serialize(ms, this);
|
||||||
|
m_group = tmp;
|
||||||
|
if (m_running && !m_waitingCrossing)
|
||||||
|
StartTimer();
|
||||||
|
|
||||||
|
return ms.ToArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartCrossingCheck()
|
public void StartCrossingCheck()
|
||||||
|
|
|
@ -458,35 +458,36 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (null == assetBase)
|
if (null == assetBase)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MemoryStream ms = new MemoryStream(assetBase.Data);
|
using (MemoryStream ms = new MemoryStream(assetBase.Data))
|
||||||
StreamReader sr = new StreamReader(ms);
|
using (StreamReader sr = new StreamReader(ms))
|
||||||
|
|
||||||
sr.ReadLine(); // Unknown (Version?)
|
|
||||||
sr.ReadLine(); // Unknown
|
|
||||||
sr.ReadLine(); // Unknown
|
|
||||||
sr.ReadLine(); // Name
|
|
||||||
sr.ReadLine(); // Comment ?
|
|
||||||
int count = Convert.ToInt32(sr.ReadLine()); // Item count
|
|
||||||
|
|
||||||
for (int i = 0 ; i < count ; i++)
|
|
||||||
{
|
{
|
||||||
string type = sr.ReadLine();
|
sr.ReadLine(); // Unknown (Version?)
|
||||||
if (type == null)
|
sr.ReadLine(); // Unknown
|
||||||
break;
|
sr.ReadLine(); // Unknown
|
||||||
string name = sr.ReadLine();
|
sr.ReadLine(); // Name
|
||||||
if (name == null)
|
sr.ReadLine(); // Comment ?
|
||||||
break;
|
int count = Convert.ToInt32(sr.ReadLine()); // Item count
|
||||||
string id = sr.ReadLine();
|
|
||||||
if (id == null)
|
|
||||||
break;
|
|
||||||
string unknown = sr.ReadLine();
|
|
||||||
if (unknown == null)
|
|
||||||
break;
|
|
||||||
|
|
||||||
// If it can be parsed as a UUID, it is an asset ID
|
for (int i = 0 ; i < count ; i++)
|
||||||
UUID uuid;
|
{
|
||||||
if (UUID.TryParse(id, out uuid))
|
string type = sr.ReadLine();
|
||||||
assetUuids[uuid] = (sbyte)AssetType.Animation;
|
if (type == null)
|
||||||
|
break;
|
||||||
|
string name = sr.ReadLine();
|
||||||
|
if (name == null)
|
||||||
|
break;
|
||||||
|
string id = sr.ReadLine();
|
||||||
|
if (id == null)
|
||||||
|
break;
|
||||||
|
string unknown = sr.ReadLine();
|
||||||
|
if (unknown == null)
|
||||||
|
break;
|
||||||
|
|
||||||
|
// If it can be parsed as a UUID, it is an asset ID
|
||||||
|
UUID uuid;
|
||||||
|
if (UUID.TryParse(id, out uuid))
|
||||||
|
assetUuids[uuid] = (sbyte)AssetType.Animation; // the asset is either an Animation or a Sound, but this distinction isn't important
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,17 +196,19 @@ namespace OpenSim.Server.Base
|
||||||
|
|
||||||
public static byte[] SerializeResult(XmlSerializer xs, object data)
|
public static byte[] SerializeResult(XmlSerializer xs, object data)
|
||||||
{
|
{
|
||||||
MemoryStream ms = new MemoryStream();
|
using (MemoryStream ms = new MemoryStream())
|
||||||
XmlTextWriter xw = new XmlTextWriter(ms, Util.UTF8);
|
using (XmlTextWriter xw = new XmlTextWriter(ms, Util.UTF8))
|
||||||
xw.Formatting = Formatting.Indented;
|
{
|
||||||
xs.Serialize(xw, data);
|
xw.Formatting = Formatting.Indented;
|
||||||
xw.Flush();
|
xs.Serialize(xw, data);
|
||||||
|
xw.Flush();
|
||||||
|
|
||||||
ms.Seek(0, SeekOrigin.Begin);
|
ms.Seek(0, SeekOrigin.Begin);
|
||||||
byte[] ret = ms.GetBuffer();
|
byte[] ret = ms.GetBuffer();
|
||||||
Array.Resize(ref ret, (int)ms.Length);
|
Array.Resize(ref ret, (int)ms.Length);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -209,7 +209,7 @@ namespace OpenSim.Server.Handlers.Authentication
|
||||||
|
|
||||||
rootElement.AppendChild(result);
|
rootElement.AppendChild(result);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] GetAuthInfo(UUID principalID)
|
byte[] GetAuthInfo(UUID principalID)
|
||||||
|
@ -279,7 +279,7 @@ namespace OpenSim.Server.Handlers.Authentication
|
||||||
|
|
||||||
rootElement.AppendChild(result);
|
rootElement.AppendChild(result);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] SuccessResult(string token)
|
private byte[] SuccessResult(string token)
|
||||||
|
@ -306,18 +306,7 @@ namespace OpenSim.Server.Handlers.Authentication
|
||||||
|
|
||||||
rootElement.AppendChild(t);
|
rootElement.AppendChild(t);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] DocToBytes(XmlDocument doc)
|
|
||||||
{
|
|
||||||
MemoryStream ms = new MemoryStream();
|
|
||||||
XmlTextWriter xw = new XmlTextWriter(ms, null);
|
|
||||||
xw.Formatting = Formatting.Indented;
|
|
||||||
doc.WriteTo(xw);
|
|
||||||
xw.Flush();
|
|
||||||
|
|
||||||
return ms.GetBuffer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] ResultToBytes(Dictionary<string, object> result)
|
private byte[] ResultToBytes(Dictionary<string, object> result)
|
||||||
|
|
|
@ -247,7 +247,7 @@ namespace OpenSim.Server.Handlers.Avatar
|
||||||
|
|
||||||
rootElement.AppendChild(result);
|
rootElement.AppendChild(result);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] FailureResult()
|
private byte[] FailureResult()
|
||||||
|
@ -269,18 +269,7 @@ namespace OpenSim.Server.Handlers.Avatar
|
||||||
|
|
||||||
rootElement.AppendChild(result);
|
rootElement.AppendChild(result);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] DocToBytes(XmlDocument doc)
|
|
||||||
{
|
|
||||||
MemoryStream ms = new MemoryStream();
|
|
||||||
XmlTextWriter xw = new XmlTextWriter(ms, null);
|
|
||||||
xw.Formatting = Formatting.Indented;
|
|
||||||
doc.WriteTo(xw);
|
|
||||||
xw.Flush();
|
|
||||||
|
|
||||||
return ms.ToArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,7 +229,7 @@ namespace OpenSim.Server.Handlers.Friends
|
||||||
|
|
||||||
rootElement.AppendChild(result);
|
rootElement.AppendChild(result);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] FailureResult()
|
private byte[] FailureResult()
|
||||||
|
@ -261,18 +261,7 @@ namespace OpenSim.Server.Handlers.Friends
|
||||||
|
|
||||||
rootElement.AppendChild(message);
|
rootElement.AppendChild(message);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] DocToBytes(XmlDocument doc)
|
|
||||||
{
|
|
||||||
MemoryStream ms = new MemoryStream();
|
|
||||||
XmlTextWriter xw = new XmlTextWriter(ms, null);
|
|
||||||
xw.Formatting = Formatting.Indented;
|
|
||||||
doc.WriteTo(xw);
|
|
||||||
xw.Flush();
|
|
||||||
|
|
||||||
return ms.ToArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FromKeyValuePairs(Dictionary<string, object> kvp, out string principalID, out string friend, out int flags)
|
void FromKeyValuePairs(Dictionary<string, object> kvp, out string principalID, out string friend, out int flags)
|
||||||
|
|
|
@ -602,7 +602,7 @@ namespace OpenSim.Server.Handlers.Grid
|
||||||
|
|
||||||
rootElement.AppendChild(result);
|
rootElement.AppendChild(result);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] FailureResult()
|
private byte[] FailureResult()
|
||||||
|
@ -634,18 +634,7 @@ namespace OpenSim.Server.Handlers.Grid
|
||||||
|
|
||||||
rootElement.AppendChild(message);
|
rootElement.AppendChild(message);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] DocToBytes(XmlDocument doc)
|
|
||||||
{
|
|
||||||
MemoryStream ms = new MemoryStream();
|
|
||||||
XmlTextWriter xw = new XmlTextWriter(ms, null);
|
|
||||||
xw.Formatting = Formatting.Indented;
|
|
||||||
doc.WriteTo(xw);
|
|
||||||
xw.Flush();
|
|
||||||
|
|
||||||
return ms.ToArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -279,7 +279,7 @@ namespace OpenSim.Server.Handlers.GridUser
|
||||||
|
|
||||||
rootElement.AppendChild(result);
|
rootElement.AppendChild(result);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] FailureResult()
|
private byte[] FailureResult()
|
||||||
|
@ -301,20 +301,8 @@ namespace OpenSim.Server.Handlers.GridUser
|
||||||
|
|
||||||
rootElement.AppendChild(result);
|
rootElement.AppendChild(result);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] DocToBytes(XmlDocument doc)
|
|
||||||
{
|
|
||||||
MemoryStream ms = new MemoryStream();
|
|
||||||
XmlTextWriter xw = new XmlTextWriter(ms, null);
|
|
||||||
xw.Formatting = Formatting.Indented;
|
|
||||||
doc.WriteTo(xw);
|
|
||||||
xw.Flush();
|
|
||||||
|
|
||||||
return ms.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -335,7 +335,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||||
|
|
||||||
rootElement.AppendChild(result);
|
rootElement.AppendChild(result);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] SuccessResult(string value)
|
private byte[] SuccessResult(string value)
|
||||||
|
@ -362,7 +362,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||||
|
|
||||||
rootElement.AppendChild(message);
|
rootElement.AppendChild(message);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||||
|
|
||||||
rootElement.AppendChild(message);
|
rootElement.AppendChild(message);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] BoolResult(bool value)
|
private byte[] BoolResult(bool value)
|
||||||
|
@ -417,21 +417,9 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||||
|
|
||||||
rootElement.AppendChild(result);
|
rootElement.AppendChild(result);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] DocToBytes(XmlDocument doc)
|
|
||||||
{
|
|
||||||
MemoryStream ms = new MemoryStream();
|
|
||||||
XmlTextWriter xw = new XmlTextWriter(ms, null);
|
|
||||||
xw.Formatting = Formatting.Indented;
|
|
||||||
doc.WriteTo(xw);
|
|
||||||
xw.Flush();
|
|
||||||
|
|
||||||
return ms.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,18 +191,7 @@ namespace OpenSim.Server.Handlers.Asset
|
||||||
|
|
||||||
rootElement.AppendChild(result);
|
rootElement.AppendChild(result);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] DocToBytes(XmlDocument doc)
|
|
||||||
{
|
|
||||||
MemoryStream ms = new MemoryStream();
|
|
||||||
XmlTextWriter xw = new XmlTextWriter(ms, null);
|
|
||||||
xw.Formatting = Formatting.Indented;
|
|
||||||
doc.WriteTo(xw);
|
|
||||||
xw.Flush();
|
|
||||||
|
|
||||||
return ms.ToArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] HandleCreateUserInventory(Dictionary<string,object> request)
|
byte[] HandleCreateUserInventory(Dictionary<string,object> request)
|
||||||
|
|
|
@ -188,7 +188,7 @@ namespace OpenSim.Server.Handlers.MapImage
|
||||||
|
|
||||||
rootElement.AppendChild(result);
|
rootElement.AppendChild(result);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] FailureResult(string msg)
|
private byte[] FailureResult(string msg)
|
||||||
|
@ -215,18 +215,7 @@ namespace OpenSim.Server.Handlers.MapImage
|
||||||
|
|
||||||
rootElement.AppendChild(message);
|
rootElement.AppendChild(message);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] DocToBytes(XmlDocument doc)
|
|
||||||
{
|
|
||||||
MemoryStream ms = new MemoryStream();
|
|
||||||
XmlTextWriter xw = new XmlTextWriter(ms, null);
|
|
||||||
xw.Formatting = Formatting.Indented;
|
|
||||||
doc.WriteTo(xw);
|
|
||||||
xw.Flush();
|
|
||||||
|
|
||||||
return ms.ToArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private System.Net.IPAddress GetCallerIP(IOSHttpRequest request)
|
private System.Net.IPAddress GetCallerIP(IOSHttpRequest request)
|
||||||
|
|
|
@ -265,7 +265,7 @@ namespace OpenSim.Server.Handlers.Presence
|
||||||
|
|
||||||
rootElement.AppendChild(result);
|
rootElement.AppendChild(result);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] FailureResult()
|
private byte[] FailureResult()
|
||||||
|
@ -287,18 +287,7 @@ namespace OpenSim.Server.Handlers.Presence
|
||||||
|
|
||||||
rootElement.AppendChild(result);
|
rootElement.AppendChild(result);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] DocToBytes(XmlDocument doc)
|
|
||||||
{
|
|
||||||
MemoryStream ms = new MemoryStream();
|
|
||||||
XmlTextWriter xw = new XmlTextWriter(ms, null);
|
|
||||||
xw.Formatting = Formatting.Indented;
|
|
||||||
doc.WriteTo(xw);
|
|
||||||
xw.Flush();
|
|
||||||
|
|
||||||
return ms.ToArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,14 +250,30 @@ namespace OpenSim.Server.Handlers.Simulation
|
||||||
return encoding.GetBytes("false");
|
return encoding.GetBytes("false");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string requestBody;
|
||||||
|
|
||||||
Stream inputStream = request;
|
Stream inputStream = request;
|
||||||
if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip"))
|
Stream innerStream = null;
|
||||||
inputStream = new GZipStream(inputStream, CompressionMode.Decompress);
|
try
|
||||||
|
{
|
||||||
|
if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip"))
|
||||||
|
{
|
||||||
|
innerStream = inputStream;
|
||||||
|
inputStream = new GZipStream(innerStream, CompressionMode.Decompress);
|
||||||
|
}
|
||||||
|
|
||||||
StreamReader reader = new StreamReader(inputStream, encoding);
|
using (StreamReader reader = new StreamReader(inputStream, encoding))
|
||||||
|
{
|
||||||
|
requestBody = reader.ReadToEnd();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (innerStream != null)
|
||||||
|
innerStream.Dispose();
|
||||||
|
inputStream.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
string requestBody = reader.ReadToEnd();
|
|
||||||
reader.Close();
|
|
||||||
keysvals.Add("body", requestBody);
|
keysvals.Add("body", requestBody);
|
||||||
|
|
||||||
Hashtable responsedata = new Hashtable();
|
Hashtable responsedata = new Hashtable();
|
||||||
|
@ -461,15 +477,31 @@ namespace OpenSim.Server.Handlers.Simulation
|
||||||
keysvals.Add("headers", headervals);
|
keysvals.Add("headers", headervals);
|
||||||
keysvals.Add("querystringkeys", querystringkeys);
|
keysvals.Add("querystringkeys", querystringkeys);
|
||||||
|
|
||||||
Stream inputStream = request;
|
String requestBody;
|
||||||
if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip"))
|
|
||||||
inputStream = new GZipStream(inputStream, CompressionMode.Decompress);
|
|
||||||
|
|
||||||
Encoding encoding = Encoding.UTF8;
|
Encoding encoding = Encoding.UTF8;
|
||||||
StreamReader reader = new StreamReader(inputStream, encoding);
|
|
||||||
|
|
||||||
string requestBody = reader.ReadToEnd();
|
Stream inputStream = request;
|
||||||
reader.Close();
|
Stream innerStream = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip"))
|
||||||
|
{
|
||||||
|
innerStream = inputStream;
|
||||||
|
inputStream = new GZipStream(innerStream, CompressionMode.Decompress);
|
||||||
|
}
|
||||||
|
|
||||||
|
using (StreamReader reader = new StreamReader(inputStream, encoding))
|
||||||
|
{
|
||||||
|
requestBody = reader.ReadToEnd();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (innerStream != null)
|
||||||
|
innerStream.Dispose();
|
||||||
|
inputStream.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
keysvals.Add("body", requestBody);
|
keysvals.Add("body", requestBody);
|
||||||
|
|
||||||
httpResponse.StatusCode = 200;
|
httpResponse.StatusCode = 200;
|
||||||
|
|
|
@ -315,7 +315,7 @@ namespace OpenSim.Server.Handlers.UserAccounts
|
||||||
|
|
||||||
rootElement.AppendChild(result);
|
rootElement.AppendChild(result);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] FailureResult()
|
private byte[] FailureResult()
|
||||||
|
@ -337,18 +337,7 @@ namespace OpenSim.Server.Handlers.UserAccounts
|
||||||
|
|
||||||
rootElement.AppendChild(result);
|
rootElement.AppendChild(result);
|
||||||
|
|
||||||
return DocToBytes(doc);
|
return Util.DocToBytes(doc);
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] DocToBytes(XmlDocument doc)
|
|
||||||
{
|
|
||||||
MemoryStream ms = new MemoryStream();
|
|
||||||
XmlTextWriter xw = new XmlTextWriter(ms, null);
|
|
||||||
xw.Formatting = Formatting.Indented;
|
|
||||||
doc.WriteTo(xw);
|
|
||||||
xw.Flush();
|
|
||||||
|
|
||||||
return ms.ToArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] ResultToBytes(Dictionary<string, object> result)
|
private byte[] ResultToBytes(Dictionary<string, object> result)
|
||||||
|
|
|
@ -171,27 +171,29 @@ namespace OpenSim.Services.Connectors
|
||||||
return fullAsset.Data;
|
return fullAsset.Data;
|
||||||
}
|
}
|
||||||
|
|
||||||
RestClient rc = new RestClient(m_ServerURI);
|
using (RestClient rc = new RestClient(m_ServerURI))
|
||||||
rc.AddResourcePath("assets");
|
|
||||||
rc.AddResourcePath(id);
|
|
||||||
rc.AddResourcePath("data");
|
|
||||||
|
|
||||||
rc.RequestMethod = "GET";
|
|
||||||
|
|
||||||
Stream s = rc.Request(m_Auth);
|
|
||||||
|
|
||||||
if (s == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (s.Length > 0)
|
|
||||||
{
|
{
|
||||||
byte[] ret = new byte[s.Length];
|
rc.AddResourcePath("assets");
|
||||||
s.Read(ret, 0, (int)s.Length);
|
rc.AddResourcePath(id);
|
||||||
|
rc.AddResourcePath("data");
|
||||||
|
|
||||||
return ret;
|
rc.RequestMethod = "GET";
|
||||||
|
|
||||||
|
Stream s = rc.Request(m_Auth);
|
||||||
|
|
||||||
|
if (s == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (s.Length > 0)
|
||||||
|
{
|
||||||
|
byte[] ret = new byte[s.Length];
|
||||||
|
s.Read(ret, 0, (int)s.Length);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Get(string id, Object sender, AssetRetrieved handler)
|
public bool Get(string id, Object sender, AssetRetrieved handler)
|
||||||
|
|
Loading…
Reference in New Issue