diff options
author | Oren Hurvitz | 2014-06-01 17:39:11 +0300 |
---|---|---|
committer | Oren Hurvitz | 2014-07-21 08:30:03 +0100 |
commit | 99ac770abbe3a95887c4b10c82f3985aa878eeef (patch) | |
tree | 8c946dab083dd50a352f3861415eca43185d8d95 /OpenSim/Region/Framework/Scenes/UuidGatherer.cs | |
parent | Set "[Terrain]SendTerrainUpdatesByViewDistance=true" by default. (diff) | |
download | opensim-SC_OLD-99ac770abbe3a95887c4b10c82f3985aa878eeef.zip opensim-SC_OLD-99ac770abbe3a95887c4b10c82f3985aa878eeef.tar.gz opensim-SC_OLD-99ac770abbe3a95887c4b10c82f3985aa878eeef.tar.bz2 opensim-SC_OLD-99ac770abbe3a95887c4b10c82f3985aa878eeef.tar.xz |
Close streams immediately when we finish using them
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/UuidGatherer.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 57 |
1 files changed, 29 insertions, 28 deletions
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 | ||