diff options
Diffstat (limited to '')
12 files changed, 143 insertions, 147 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index 732781a..5cdcab9 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs | |||
@@ -231,7 +231,11 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
231 | { | 231 | { |
232 | try | 232 | try |
233 | { | 233 | { |
234 | List<int> layerStarts = CSJ2K.J2kImage.GetLayerBoundaries(new MemoryStream(j2kData)); | 234 | List<int> layerStarts; |
235 | using (MemoryStream ms = new MemoryStream(j2kData)) | ||
236 | { | ||
237 | layerStarts = CSJ2K.J2kImage.GetLayerBoundaries(ms); | ||
238 | } | ||
235 | 239 | ||
236 | if (layerStarts != null && layerStarts.Count > 0) | 240 | if (layerStarts != null && layerStarts.Count > 0) |
237 | { | 241 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs index ff87ece..13512a2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -289,18 +289,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
289 | 289 | ||
290 | rootElement.AppendChild(result); | 290 | rootElement.AppendChild(result); |
291 | 291 | ||
292 | return DocToBytes(doc); | 292 | return Util.DocToBytes(doc); |
293 | } | ||
294 | |||
295 | private byte[] DocToBytes(XmlDocument doc) | ||
296 | { | ||
297 | MemoryStream ms = new MemoryStream(); | ||
298 | XmlTextWriter xw = new XmlTextWriter(ms, null); | ||
299 | xw.Formatting = Formatting.Indented; | ||
300 | doc.WriteTo(xw); | ||
301 | xw.Flush(); | ||
302 | |||
303 | return ms.ToArray(); | ||
304 | } | 293 | } |
305 | 294 | ||
306 | #endregion | 295 | #endregion |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index e9c6fb6..c8056d4 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -918,17 +918,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
918 | { | 918 | { |
919 | ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>(); | 919 | ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>(); |
920 | 920 | ||
921 | MemoryStream ms = new MemoryStream(data); | 921 | using (MemoryStream ms = new MemoryStream(data)) |
922 | if (m_displacement != Vector3.Zero || m_rotation != 0f) | ||
923 | { | 922 | { |
924 | Vector2 rotationCenter = new Vector2(m_rotationCenter.X, m_rotationCenter.Y); | 923 | if (m_displacement != Vector3.Zero || m_rotation != 0f) |
925 | terrainModule.LoadFromStream(terrainPath, m_displacement, m_rotation, rotationCenter, ms); | 924 | { |
926 | } | 925 | Vector2 rotationCenter = new Vector2(m_rotationCenter.X, m_rotationCenter.Y); |
927 | else | 926 | terrainModule.LoadFromStream(terrainPath, m_displacement, m_rotation, rotationCenter, ms); |
928 | { | 927 | } |
929 | terrainModule.LoadFromStream(terrainPath, ms); | 928 | else |
929 | { | ||
930 | terrainModule.LoadFromStream(terrainPath, ms); | ||
931 | } | ||
930 | } | 932 | } |
931 | ms.Close(); | ||
932 | 933 | ||
933 | m_log.DebugFormat("[ARCHIVER]: Restored terrain {0}", terrainPath); | 934 | m_log.DebugFormat("[ARCHIVER]: Restored terrain {0}", terrainPath); |
934 | 935 | ||
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs index 136a16e..448147a 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs | |||
@@ -569,10 +569,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
569 | string terrainPath = String.Format("{0}{1}{2}.r32", | 569 | string terrainPath = String.Format("{0}{1}{2}.r32", |
570 | regionDir, ArchiveConstants.TERRAINS_PATH, scene.RegionInfo.RegionName); | 570 | regionDir, ArchiveConstants.TERRAINS_PATH, scene.RegionInfo.RegionName); |
571 | 571 | ||
572 | MemoryStream ms = new MemoryStream(); | 572 | using (MemoryStream ms = new MemoryStream()) |
573 | scene.RequestModuleInterface<ITerrainModule>().SaveToStream(terrainPath, ms); | 573 | { |
574 | m_archiveWriter.WriteFile(terrainPath, ms.ToArray()); | 574 | scene.RequestModuleInterface<ITerrainModule>().SaveToStream(terrainPath, ms); |
575 | ms.Close(); | 575 | m_archiveWriter.WriteFile(terrainPath, ms.ToArray()); |
576 | } | ||
576 | 577 | ||
577 | m_log.InfoFormat("[ARCHIVER]: Adding scene objects to archive."); | 578 | m_log.InfoFormat("[ARCHIVER]: Adding scene objects to archive."); |
578 | 579 | ||
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 9fac9ff..80fa08a 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -1121,9 +1121,8 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1121 | { | 1121 | { |
1122 | try | 1122 | try |
1123 | { | 1123 | { |
1124 | MemoryStream terrainStream = new MemoryStream(terrainData); | 1124 | using (MemoryStream terrainStream = new MemoryStream(terrainData)) |
1125 | terr.LoadFromStream(filename, terrainStream); | 1125 | terr.LoadFromStream(filename, terrainStream); |
1126 | terrainStream.Close(); | ||
1127 | 1126 | ||
1128 | FileInfo x = new FileInfo(filename); | 1127 | FileInfo x = new FileInfo(filename); |
1129 | remoteClient.SendAlertMessage("Your terrain was loaded as a " + x.Extension + " file. It may take a few moments to appear."); | 1128 | remoteClient.SendAlertMessage("Your terrain was loaded as a " + x.Extension + " file. It may take a few moments to appear."); |
diff --git a/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs b/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs index 2366767..ec5af2b 100644 --- a/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs +++ b/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs | |||
@@ -281,18 +281,8 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
281 | 281 | ||
282 | rootElement.AppendChild(result); | 282 | rootElement.AppendChild(result); |
283 | 283 | ||
284 | return DocToBytes(doc); | 284 | return Util.DocToBytes(doc); |
285 | } | 285 | } |
286 | 286 | ||
287 | private byte[] DocToBytes(XmlDocument doc) | ||
288 | { | ||
289 | MemoryStream ms = new MemoryStream(); | ||
290 | XmlTextWriter xw = new XmlTextWriter(ms, null); | ||
291 | xw.Formatting = Formatting.Indented; | ||
292 | doc.WriteTo(xw); | ||
293 | xw.Flush(); | ||
294 | |||
295 | return ms.ToArray(); | ||
296 | } | ||
297 | } | 287 | } |
298 | } | 288 | } |
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs index 328fbf0..65f464a 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs | |||
@@ -54,13 +54,14 @@ namespace OpenSim.Region.CoreModules.World.Serialiser | |||
54 | { | 54 | { |
55 | string xmlstream = GetObjectXml(scene); | 55 | string xmlstream = GetObjectXml(scene); |
56 | 56 | ||
57 | MemoryStream stream = ReformatXmlString(xmlstream); | 57 | using (MemoryStream stream = ReformatXmlString(xmlstream)) |
58 | 58 | { | |
59 | stream.Seek(0, SeekOrigin.Begin); | 59 | stream.Seek(0, SeekOrigin.Begin); |
60 | CreateXmlFile(stream, fileName); | 60 | CreateXmlFile(stream, fileName); |
61 | 61 | ||
62 | stream.Seek(0, SeekOrigin.Begin); | 62 | stream.Seek(0, SeekOrigin.Begin); |
63 | CreateCompressedXmlFile(stream, fileName); | 63 | CreateCompressedXmlFile(stream, fileName); |
64 | } | ||
64 | } | 65 | } |
65 | 66 | ||
66 | private static MemoryStream ReformatXmlString(string xmlstream) | 67 | private static MemoryStream ReformatXmlString(string xmlstream) |
@@ -112,13 +113,16 @@ namespace OpenSim.Region.CoreModules.World.Serialiser | |||
112 | { | 113 | { |
113 | #region GZip Compressed Version | 114 | #region GZip Compressed Version |
114 | 115 | ||
115 | FileStream objectsFileCompressed = new FileStream(fileName + ".gzs", FileMode.Create); | 116 | using (FileStream objectsFileCompressed = new FileStream(fileName + ".gzs", FileMode.Create)) |
116 | MemoryStream gzipMSStream = new MemoryStream(); | 117 | using (MemoryStream gzipMSStream = new MemoryStream()) |
117 | GZipStream gzipStream = new GZipStream(gzipMSStream, CompressionMode.Compress); | 118 | { |
118 | xmlStream.WriteTo(gzipStream); | 119 | using (GZipStream gzipStream = new GZipStream(gzipMSStream, CompressionMode.Compress, true)) |
119 | gzipMSStream.WriteTo(objectsFileCompressed); | 120 | { |
120 | objectsFileCompressed.Flush(); | 121 | xmlStream.WriteTo(gzipStream); |
121 | objectsFileCompressed.Close(); | 122 | } |
123 | |||
124 | gzipMSStream.WriteTo(objectsFileCompressed); | ||
125 | } | ||
122 | 126 | ||
123 | #endregion | 127 | #endregion |
124 | } | 128 | } |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 2d28d6e..995e297 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -1145,7 +1145,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1145 | 1145 | ||
1146 | if (myMapImageJPEG.Length == 0) | 1146 | if (myMapImageJPEG.Length == 0) |
1147 | { | 1147 | { |
1148 | MemoryStream imgstream = new MemoryStream(); | 1148 | MemoryStream imgstream = null; |
1149 | Bitmap mapTexture = new Bitmap(1,1); | 1149 | Bitmap mapTexture = new Bitmap(1,1); |
1150 | ManagedImage managedImage; | 1150 | ManagedImage managedImage; |
1151 | Image image = (Image)mapTexture; | 1151 | Image image = (Image)mapTexture; |
@@ -1192,10 +1192,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1192 | image.Dispose(); | 1192 | image.Dispose(); |
1193 | 1193 | ||
1194 | if (imgstream != null) | 1194 | if (imgstream != null) |
1195 | { | ||
1196 | imgstream.Close(); | ||
1197 | imgstream.Dispose(); | 1195 | imgstream.Dispose(); |
1198 | } | ||
1199 | } | 1196 | } |
1200 | } | 1197 | } |
1201 | else | 1198 | else |
@@ -1639,4 +1636,4 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1639 | public uint itemtype; | 1636 | public uint itemtype; |
1640 | public ulong regionhandle; | 1637 | public ulong regionhandle; |
1641 | } | 1638 | } |
1642 | } \ No newline at end of file | 1639 | } |
diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs index 4a06f6e..33899aa 100644 --- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs +++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs | |||
@@ -373,24 +373,27 @@ namespace OpenSim.Region.DataSnapshot | |||
373 | for (int i = 0; i < services.Length; i++) | 373 | for (int i = 0; i < services.Length; i++) |
374 | { | 374 | { |
375 | string url = services[i].Trim(); | 375 | string url = services[i].Trim(); |
376 | RestClient cli = new RestClient(url); | 376 | using (RestClient cli = new RestClient(url)) |
377 | cli.AddQueryParameter("service", serviceName); | ||
378 | cli.AddQueryParameter("host", m_hostname); | ||
379 | cli.AddQueryParameter("port", m_listener_port); | ||
380 | cli.AddQueryParameter("secret", m_Secret.ToString()); | ||
381 | cli.RequestMethod = "GET"; | ||
382 | try | ||
383 | { | ||
384 | reply = cli.Request(null); | ||
385 | } | ||
386 | catch (WebException) | ||
387 | { | 377 | { |
388 | m_log.Warn("[DATASNAPSHOT]: Unable to notify " + url); | 378 | cli.AddQueryParameter("service", serviceName); |
389 | } | 379 | cli.AddQueryParameter("host", m_hostname); |
390 | catch (Exception e) | 380 | cli.AddQueryParameter("port", m_listener_port); |
391 | { | 381 | cli.AddQueryParameter("secret", m_Secret.ToString()); |
392 | m_log.Warn("[DATASNAPSHOT]: Ignoring unknown exception " + e.ToString()); | 382 | cli.RequestMethod = "GET"; |
383 | try | ||
384 | { | ||
385 | reply = cli.Request(null); | ||
386 | } | ||
387 | catch (WebException) | ||
388 | { | ||
389 | m_log.Warn("[DATASNAPSHOT]: Unable to notify " + url); | ||
390 | } | ||
391 | catch (Exception e) | ||
392 | { | ||
393 | m_log.Warn("[DATASNAPSHOT]: Ignoring unknown exception " + e.ToString()); | ||
394 | } | ||
393 | } | 395 | } |
396 | |||
394 | byte[] response = new byte[1024]; | 397 | byte[] response = new byte[1024]; |
395 | // int n = 0; | 398 | // int n = 0; |
396 | try | 399 | try |
diff --git a/OpenSim/Region/Framework/Scenes/Animation/BinBVHAnimation.cs b/OpenSim/Region/Framework/Scenes/Animation/BinBVHAnimation.cs index 3afc87f..b3b38b2 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/BinBVHAnimation.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/BinBVHAnimation.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -113,31 +113,34 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
113 | 113 | ||
114 | public byte[] ToBytes() | 114 | public byte[] ToBytes() |
115 | { | 115 | { |
116 | byte[] outputbytes = new byte[0]; | 116 | byte[] outputbytes; |
117 | 117 | ||
118 | BinaryWriter iostream = new BinaryWriter(new MemoryStream()); | 118 | using (MemoryStream ms = new MemoryStream()) |
119 | iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(unknown0))); | 119 | using (BinaryWriter iostream = new BinaryWriter(ms)) |
120 | iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(unknown1))); | ||
121 | iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(Priority))); | ||
122 | iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(Length))); | ||
123 | iostream.Write(BinBVHUtil.WriteNullTerminatedString(ExpressionName)); | ||
124 | iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(InPoint))); | ||
125 | iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(OutPoint))); | ||
126 | iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(Loop ? 1 : 0))); | ||
127 | iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(EaseInTime))); | ||
128 | iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(EaseOutTime))); | ||
129 | iostream.Write(BinBVHUtil.ES(Utils.UIntToBytes(HandPose))); | ||
130 | iostream.Write(BinBVHUtil.ES(Utils.UIntToBytes((uint)(Joints.Length)))); | ||
131 | |||
132 | for (int i = 0; i < Joints.Length; i++) | ||
133 | { | 120 | { |
134 | Joints[i].WriteBytesToStream(iostream, InPoint, OutPoint); | 121 | iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(unknown0))); |
122 | iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(unknown1))); | ||
123 | iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(Priority))); | ||
124 | iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(Length))); | ||
125 | iostream.Write(BinBVHUtil.WriteNullTerminatedString(ExpressionName)); | ||
126 | iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(InPoint))); | ||
127 | iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(OutPoint))); | ||
128 | iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(Loop ? 1 : 0))); | ||
129 | iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(EaseInTime))); | ||
130 | iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(EaseOutTime))); | ||
131 | iostream.Write(BinBVHUtil.ES(Utils.UIntToBytes(HandPose))); | ||
132 | iostream.Write(BinBVHUtil.ES(Utils.UIntToBytes((uint)(Joints.Length)))); | ||
133 | |||
134 | for (int i = 0; i < Joints.Length; i++) | ||
135 | { | ||
136 | Joints[i].WriteBytesToStream(iostream, InPoint, OutPoint); | ||
137 | } | ||
138 | iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(0))); | ||
139 | |||
140 | using (MemoryStream ms2 = (MemoryStream)iostream.BaseStream) | ||
141 | outputbytes = ms2.ToArray(); | ||
135 | } | 142 | } |
136 | iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(0))); | 143 | |
137 | MemoryStream ms = (MemoryStream)iostream.BaseStream; | ||
138 | outputbytes = ms.ToArray(); | ||
139 | ms.Close(); | ||
140 | iostream.Close(); | ||
141 | return outputbytes; | 144 | return outputbytes; |
142 | } | 145 | } |
143 | 146 | ||
diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index 2d489ea..b4a171f 100644 --- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs +++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs | |||
@@ -280,7 +280,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
280 | if (!m_selected) | 280 | if (!m_selected) |
281 | { | 281 | { |
282 | StopTimer(); | 282 | StopTimer(); |
283 | m_serializedPosition = m_group.AbsolutePosition; | 283 | m_serializedPosition = m_group.AbsolutePosition; |
284 | } | 284 | } |
285 | } | 285 | } |
286 | } | 286 | } |
@@ -308,10 +308,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
308 | 308 | ||
309 | try | 309 | try |
310 | { | 310 | { |
311 | MemoryStream ms = new MemoryStream(data); | 311 | using (MemoryStream ms = new MemoryStream(data)) |
312 | BinaryFormatter fmt = new BinaryFormatter(); | 312 | { |
313 | 313 | BinaryFormatter fmt = new BinaryFormatter(); | |
314 | newMotion = (KeyframeMotion)fmt.Deserialize(ms); | 314 | newMotion = (KeyframeMotion)fmt.Deserialize(ms); |
315 | } | ||
315 | 316 | ||
316 | newMotion.m_group = grp; | 317 | newMotion.m_group = grp; |
317 | 318 | ||
@@ -345,26 +346,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
345 | return; | 346 | return; |
346 | 347 | ||
347 | m_group = grp; | 348 | m_group = grp; |
348 | m_scene = grp.Scene; | 349 | m_scene = grp.Scene; |
349 | 350 | ||
350 | Vector3 grppos = grp.AbsolutePosition; | 351 | Vector3 grppos = grp.AbsolutePosition; |
351 | Vector3 offset = grppos - m_serializedPosition; | 352 | Vector3 offset = grppos - m_serializedPosition; |
352 | // avoid doing it more than once | 353 | // avoid doing it more than once |
353 | // current this will happen dragging a prim to other region | 354 | // current this will happen dragging a prim to other region |
354 | m_serializedPosition = grppos; | 355 | m_serializedPosition = grppos; |
355 | 356 | ||
356 | m_basePosition += offset; | 357 | m_basePosition += offset; |
357 | m_nextPosition += offset; | 358 | m_nextPosition += offset; |
358 | 359 | ||
359 | m_currentFrame.StartPosition += offset; | 360 | m_currentFrame.StartPosition += offset; |
360 | m_currentFrame.Position += offset; | 361 | m_currentFrame.Position += offset; |
361 | 362 | ||
362 | for (int i = 0; i < m_frames.Count; i++) | 363 | for (int i = 0; i < m_frames.Count; i++) |
363 | { | 364 | { |
364 | Keyframe k = m_frames[i]; | 365 | Keyframe k = m_frames[i]; |
365 | k.StartPosition += offset; | 366 | k.StartPosition += offset; |
366 | k.Position += offset; | 367 | k.Position += offset; |
367 | m_frames[i]=k; | 368 | m_frames[i]=k; |
368 | } | 369 | } |
369 | 370 | ||
370 | if (m_running) | 371 | if (m_running) |
@@ -527,7 +528,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
527 | { | 528 | { |
528 | k.Position = pos; | 529 | k.Position = pos; |
529 | // k.Velocity = Vector3.Zero; | 530 | // k.Velocity = Vector3.Zero; |
530 | } | 531 | } |
531 | 532 | ||
532 | k.StartRotation = rot; | 533 | k.StartRotation = rot; |
533 | if (k.Rotation.HasValue) | 534 | if (k.Rotation.HasValue) |
@@ -764,19 +765,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
764 | public Byte[] Serialize() | 765 | public Byte[] Serialize() |
765 | { | 766 | { |
766 | StopTimer(); | 767 | StopTimer(); |
767 | MemoryStream ms = new MemoryStream(); | ||
768 | 768 | ||
769 | BinaryFormatter fmt = new BinaryFormatter(); | ||
770 | SceneObjectGroup tmp = m_group; | 769 | SceneObjectGroup tmp = m_group; |
771 | m_group = null; | 770 | m_group = null; |
772 | if (!m_selected && tmp != null) | 771 | if (!m_selected && tmp != null) |
773 | m_serializedPosition = tmp.AbsolutePosition; | 772 | m_serializedPosition = tmp.AbsolutePosition; |
774 | fmt.Serialize(ms, this); | 773 | |
775 | m_group = tmp; | 774 | using (MemoryStream ms = new MemoryStream()) |
776 | if (m_running && !m_waitingCrossing) | 775 | { |
777 | StartTimer(); | 776 | BinaryFormatter fmt = new BinaryFormatter(); |
777 | fmt.Serialize(ms, this); | ||
778 | m_group = tmp; | ||
779 | if (m_running && !m_waitingCrossing) | ||
780 | StartTimer(); | ||
778 | 781 | ||
779 | return ms.ToArray(); | 782 | return ms.ToArray(); |
783 | } | ||
780 | } | 784 | } |
781 | 785 | ||
782 | public void StartCrossingCheck() | 786 | public void StartCrossingCheck() |
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index a7015e1..d07cc6a 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs | |||
@@ -458,35 +458,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
458 | if (null == assetBase) | 458 | if (null == assetBase) |
459 | return; | 459 | return; |
460 | 460 | ||
461 | MemoryStream ms = new MemoryStream(assetBase.Data); | 461 | using (MemoryStream ms = new MemoryStream(assetBase.Data)) |
462 | StreamReader sr = new StreamReader(ms); | 462 | using (StreamReader sr = new StreamReader(ms)) |
463 | |||
464 | sr.ReadLine(); // Unknown (Version?) | ||
465 | sr.ReadLine(); // Unknown | ||
466 | sr.ReadLine(); // Unknown | ||
467 | sr.ReadLine(); // Name | ||
468 | sr.ReadLine(); // Comment ? | ||
469 | int count = Convert.ToInt32(sr.ReadLine()); // Item count | ||
470 | |||
471 | for (int i = 0 ; i < count ; i++) | ||
472 | { | 463 | { |
473 | string type = sr.ReadLine(); | 464 | sr.ReadLine(); // Unknown (Version?) |
474 | if (type == null) | 465 | sr.ReadLine(); // Unknown |
475 | break; | 466 | sr.ReadLine(); // Unknown |
476 | string name = sr.ReadLine(); | 467 | sr.ReadLine(); // Name |
477 | if (name == null) | 468 | sr.ReadLine(); // Comment ? |
478 | break; | 469 | int count = Convert.ToInt32(sr.ReadLine()); // Item count |
479 | string id = sr.ReadLine(); | 470 | |
480 | if (id == null) | 471 | for (int i = 0 ; i < count ; i++) |
481 | break; | 472 | { |
482 | string unknown = sr.ReadLine(); | 473 | string type = sr.ReadLine(); |
483 | if (unknown == null) | 474 | if (type == null) |
484 | break; | 475 | break; |
485 | 476 | string name = sr.ReadLine(); | |
486 | // If it can be parsed as a UUID, it is an asset ID | 477 | if (name == null) |
487 | UUID uuid; | 478 | break; |
488 | if (UUID.TryParse(id, out uuid)) | 479 | string id = sr.ReadLine(); |
489 | assetUuids[uuid] = (sbyte)AssetType.Animation; | 480 | if (id == null) |
481 | break; | ||
482 | string unknown = sr.ReadLine(); | ||
483 | if (unknown == null) | ||
484 | break; | ||
485 | |||
486 | // If it can be parsed as a UUID, it is an asset ID | ||
487 | UUID uuid; | ||
488 | if (UUID.TryParse(id, out uuid)) | ||
489 | assetUuids[uuid] = (sbyte)AssetType.Animation; // the asset is either an Animation or a Sound, but this distinction isn't important | ||
490 | } | ||
490 | } | 491 | } |
491 | } | 492 | } |
492 | 493 | ||