diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs index 7c1d015..e9005ae 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs | |||
@@ -33,8 +33,9 @@ using OpenSim.Region.Environment.Modules.World.Terrain; | |||
33 | using OpenSim.Region.Environment.Scenes; | 33 | using OpenSim.Region.Environment.Scenes; |
34 | using System; | 34 | using System; |
35 | using System.Collections.Generic; | 35 | using System.Collections.Generic; |
36 | using System.IO; | ||
37 | using System.IO.Compression; | ||
36 | using System.Reflection; | 38 | using System.Reflection; |
37 | //using System.Text; | ||
38 | using System.Text.RegularExpressions; | 39 | using System.Text.RegularExpressions; |
39 | using System.Threading; | 40 | using System.Threading; |
40 | using OpenMetaverse; | 41 | using OpenMetaverse; |
@@ -51,7 +52,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | 53 | ||
53 | protected Scene m_scene; | 54 | protected Scene m_scene; |
54 | protected string m_savePath; | 55 | protected Stream m_saveStream; |
55 | 56 | ||
56 | /// <summary> | 57 | /// <summary> |
57 | /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate | 58 | /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate |
@@ -70,8 +71,19 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
70 | public ArchiveWriteRequestPreparation(Scene scene, string savePath) | 71 | public ArchiveWriteRequestPreparation(Scene scene, string savePath) |
71 | { | 72 | { |
72 | m_scene = scene; | 73 | m_scene = scene; |
73 | m_savePath = savePath; | 74 | m_saveStream = new GZipStream(new FileStream(savePath, FileMode.Create), CompressionMode.Compress); |
74 | } | 75 | } |
76 | |||
77 | /// <summary> | ||
78 | /// Constructor. | ||
79 | /// </summary> | ||
80 | /// <param name="scene"></param> | ||
81 | /// <param name="saveStream">The stream to which to save data.</param> | ||
82 | public ArchiveWriteRequestPreparation(Scene scene, Stream saveStream) | ||
83 | { | ||
84 | m_scene = scene; | ||
85 | m_saveStream = saveStream; | ||
86 | } | ||
75 | 87 | ||
76 | /// <summary> | 88 | /// <summary> |
77 | /// The callback made when we request the asset for an object from the asset service. | 89 | /// The callback made when we request the asset for an object from the asset service. |
@@ -257,8 +269,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
257 | } | 269 | } |
258 | } | 270 | } |
259 | 271 | ||
272 | /// <summary> | ||
273 | /// Archive the region requested. | ||
274 | /// </summary> | ||
275 | /// <exception cref="System.IO.IOException">if there was an io problem with creating the file</exception> | ||
260 | public void ArchiveRegion() | 276 | public void ArchiveRegion() |
261 | { | 277 | { |
262 | Dictionary<UUID, int> assetUuids = new Dictionary<UUID, int>(); | 278 | Dictionary<UUID, int> assetUuids = new Dictionary<UUID, int>(); |
263 | 279 | ||
264 | List<EntityBase> entities = m_scene.GetEntities(); | 280 | List<EntityBase> entities = m_scene.GetEntities(); |
@@ -309,7 +325,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
309 | m_scene.RequestModuleInterface<ITerrainModule>(), | 325 | m_scene.RequestModuleInterface<ITerrainModule>(), |
310 | m_scene.RequestModuleInterface<IRegionSerialiserModule>(), | 326 | m_scene.RequestModuleInterface<IRegionSerialiserModule>(), |
311 | m_scene.RegionInfo, | 327 | m_scene.RegionInfo, |
312 | m_savePath); | 328 | m_saveStream); |
313 | 329 | ||
314 | new AssetsRequest(assetUuids.Keys, m_scene.AssetCache, awre.ReceivedAllAssets).Execute(); | 330 | new AssetsRequest(assetUuids.Keys, m_scene.AssetCache, awre.ReceivedAllAssets).Execute(); |
315 | } | 331 | } |