aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs66
1 files changed, 35 insertions, 31 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
index c6c54b2..7d2cad6 100644
--- a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
@@ -103,47 +103,51 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
103 return null; 103 return null;
104 104
105 int size = 0; 105 int size = 0;
106 RestClient rc = new RestClient(m_URL);
107 List<WearableCacheItem> ret = new List<WearableCacheItem>();
108 rc.AddResourcePath("bakes");
109 rc.AddResourcePath(id.ToString());
110 106
111 rc.RequestMethod = "GET"; 107 using (RestClient rc = new RestClient(m_URL))
112
113 try
114 { 108 {
115 using (Stream s = rc.Request(m_Auth)) 109 List<WearableCacheItem> ret = new List<WearableCacheItem>();
116 using (XmlTextReader sr = new XmlTextReader(s)) 110 rc.AddResourcePath("bakes");
111 rc.AddResourcePath(id.ToString());
112
113 rc.RequestMethod = "GET";
114
115 try
117 { 116 {
118 sr.ReadStartElement("BakedAppearance"); 117 Stream s = rc.Request(m_Auth);
119 while (sr.LocalName == "BakedTexture") 118
119 using (XmlTextReader sr = new XmlTextReader(s))
120 { 120 {
121 string sTextureIndex = sr.GetAttribute("TextureIndex"); 121 sr.ReadStartElement("BakedAppearance");
122 int lTextureIndex = Convert.ToInt32(sTextureIndex); 122 while (sr.LocalName == "BakedTexture")
123 string sCacheId = sr.GetAttribute("CacheId");
124 UUID lCacheId = UUID.Zero;
125 if (!(UUID.TryParse(sCacheId, out lCacheId)))
126 { 123 {
127 // ?? Nothing here 124 string sTextureIndex = sr.GetAttribute("TextureIndex");
125 int lTextureIndex = Convert.ToInt32(sTextureIndex);
126 string sCacheId = sr.GetAttribute("CacheId");
127 UUID lCacheId = UUID.Zero;
128 if (!(UUID.TryParse(sCacheId, out lCacheId)))
129 {
130 // ?? Nothing here
131 }
132
133 ++size;
134
135 sr.ReadStartElement("BakedTexture");
136 AssetBase a = (AssetBase)m_serializer.Deserialize(sr);
137 ret.Add(new WearableCacheItem() { CacheId = lCacheId, TextureIndex = (uint)lTextureIndex, TextureAsset = a, TextureID = a.FullID });
138
139 sr.ReadEndElement();
128 } 140 }
129 141
130 ++size; 142 m_log.DebugFormat("[XBakes]: read {0} textures for user {1}", ret.Count, id);
131
132 sr.ReadStartElement("BakedTexture");
133 AssetBase a = (AssetBase)m_serializer.Deserialize(sr);
134 ret.Add(new WearableCacheItem() { CacheId = lCacheId, TextureIndex = (uint)lTextureIndex, TextureAsset = a, TextureID = a.FullID });
135
136 sr.ReadEndElement();
137 } 143 }
138 144
139 m_log.DebugFormat("[XBakes]: read {0} textures for user {1}", ret.Count, id); 145 return ret.ToArray();
146 }
147 catch (XmlException)
148 {
149 return null;
140 } 150 }
141
142 return ret.ToArray();
143 }
144 catch (XmlException)
145 {
146 return null;
147 } 151 }
148 } 152 }
149 153