In XBakesModule.Get() use using() to always dispose of RestClient which disposes the stream rather than disposing the stream directly
parent
e3d07bd0cc
commit
9cff0bbd7c
|
@ -103,47 +103,51 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
int size = 0;
|
int size = 0;
|
||||||
RestClient rc = new RestClient(m_URL);
|
|
||||||
List<WearableCacheItem> ret = new List<WearableCacheItem>();
|
|
||||||
rc.AddResourcePath("bakes");
|
|
||||||
rc.AddResourcePath(id.ToString());
|
|
||||||
|
|
||||||
rc.RequestMethod = "GET";
|
using (RestClient rc = new RestClient(m_URL))
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
using (Stream s = rc.Request(m_Auth))
|
List<WearableCacheItem> ret = new List<WearableCacheItem>();
|
||||||
using (XmlTextReader sr = new XmlTextReader(s))
|
rc.AddResourcePath("bakes");
|
||||||
|
rc.AddResourcePath(id.ToString());
|
||||||
|
|
||||||
|
rc.RequestMethod = "GET";
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
sr.ReadStartElement("BakedAppearance");
|
Stream s = rc.Request(m_Auth);
|
||||||
while (sr.LocalName == "BakedTexture")
|
|
||||||
|
using (XmlTextReader sr = new XmlTextReader(s))
|
||||||
{
|
{
|
||||||
string sTextureIndex = sr.GetAttribute("TextureIndex");
|
sr.ReadStartElement("BakedAppearance");
|
||||||
int lTextureIndex = Convert.ToInt32(sTextureIndex);
|
while (sr.LocalName == "BakedTexture")
|
||||||
string sCacheId = sr.GetAttribute("CacheId");
|
|
||||||
UUID lCacheId = UUID.Zero;
|
|
||||||
if (!(UUID.TryParse(sCacheId, out lCacheId)))
|
|
||||||
{
|
{
|
||||||
// ?? Nothing here
|
string sTextureIndex = sr.GetAttribute("TextureIndex");
|
||||||
|
int lTextureIndex = Convert.ToInt32(sTextureIndex);
|
||||||
|
string sCacheId = sr.GetAttribute("CacheId");
|
||||||
|
UUID lCacheId = UUID.Zero;
|
||||||
|
if (!(UUID.TryParse(sCacheId, out lCacheId)))
|
||||||
|
{
|
||||||
|
// ?? Nothing here
|
||||||
|
}
|
||||||
|
|
||||||
|
++size;
|
||||||
|
|
||||||
|
sr.ReadStartElement("BakedTexture");
|
||||||
|
AssetBase a = (AssetBase)m_serializer.Deserialize(sr);
|
||||||
|
ret.Add(new WearableCacheItem() { CacheId = lCacheId, TextureIndex = (uint)lTextureIndex, TextureAsset = a, TextureID = a.FullID });
|
||||||
|
|
||||||
|
sr.ReadEndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
++size;
|
m_log.DebugFormat("[XBakes]: read {0} textures for user {1}", ret.Count, id);
|
||||||
|
|
||||||
sr.ReadStartElement("BakedTexture");
|
|
||||||
AssetBase a = (AssetBase)m_serializer.Deserialize(sr);
|
|
||||||
ret.Add(new WearableCacheItem() { CacheId = lCacheId, TextureIndex = (uint)lTextureIndex, TextureAsset = a, TextureID = a.FullID });
|
|
||||||
|
|
||||||
sr.ReadEndElement();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.DebugFormat("[XBakes]: read {0} textures for user {1}", ret.Count, id);
|
return ret.ToArray();
|
||||||
|
}
|
||||||
|
catch (XmlException)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret.ToArray();
|
|
||||||
}
|
|
||||||
catch (XmlException)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue