diff options
author | Justin Clarke Casey | 2008-06-29 19:53:33 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-06-29 19:53:33 +0000 |
commit | f8d9ccc70ec894e4cecfe24f35067ccc80ecfe50 (patch) | |
tree | f6dfc8cbe583b590924cbd628873379a9cc55035 /OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs | |
parent | Add minor comments. (diff) | |
download | opensim-SC-f8d9ccc70ec894e4cecfe24f35067ccc80ecfe50.zip opensim-SC-f8d9ccc70ec894e4cecfe24f35067ccc80ecfe50.tar.gz opensim-SC-f8d9ccc70ec894e4cecfe24f35067ccc80ecfe50.tar.bz2 opensim-SC-f8d9ccc70ec894e4cecfe24f35067ccc80ecfe50.tar.xz |
* Save terrain information in archive
* Not yet reloading
* Terrain saving will be optional a little further down the line
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs index 3ef8149..2c43ffd 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs | |||
@@ -27,12 +27,14 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | ||
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using libsecondlife; | 32 | using libsecondlife; |
32 | using log4net; | 33 | using log4net; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Region.Environment.Interfaces; | 35 | using OpenSim.Region.Environment.Interfaces; |
35 | using OpenSim.Region.Environment.Modules.World.Serialiser; | 36 | using OpenSim.Region.Environment.Modules.World.Serialiser; |
37 | using OpenSim.Region.Environment.Modules.World.Terrain; | ||
36 | using OpenSim.Region.Environment.Scenes; | 38 | using OpenSim.Region.Environment.Scenes; |
37 | 39 | ||
38 | namespace OpenSim.Region.Environment.Modules.World.Archiver | 40 | namespace OpenSim.Region.Environment.Modules.World.Archiver |
@@ -49,15 +51,23 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
49 | { | 51 | { |
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | 53 | ||
54 | protected ITerrainModule m_terrainModule; | ||
52 | protected IRegionSerialiser m_serialiser; | 55 | protected IRegionSerialiser m_serialiser; |
53 | protected List<SceneObjectGroup> m_sceneObjects; | 56 | protected List<SceneObjectGroup> m_sceneObjects; |
57 | protected string m_sceneName; | ||
54 | protected string m_savePath; | 58 | protected string m_savePath; |
55 | 59 | ||
56 | public ArchiveWriteRequestExecution( | 60 | public ArchiveWriteRequestExecution( |
57 | List<SceneObjectGroup> sceneObjects, IRegionSerialiser serialiser, string savePath) | 61 | List<SceneObjectGroup> sceneObjects, |
62 | ITerrainModule terrainModule, | ||
63 | IRegionSerialiser serialiser, | ||
64 | string sceneName, | ||
65 | string savePath) | ||
58 | { | 66 | { |
59 | m_sceneObjects = sceneObjects; | 67 | m_sceneObjects = sceneObjects; |
68 | m_terrainModule = terrainModule; | ||
60 | m_serialiser = serialiser; | 69 | m_serialiser = serialiser; |
70 | m_sceneName = sceneName; | ||
61 | m_savePath = savePath; | 71 | m_savePath = savePath; |
62 | } | 72 | } |
63 | 73 | ||
@@ -67,6 +77,14 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
67 | 77 | ||
68 | TarArchiveWriter archive = new TarArchiveWriter(); | 78 | TarArchiveWriter archive = new TarArchiveWriter(); |
69 | 79 | ||
80 | // Write out terrain | ||
81 | string terrainPath = String.Format("{0}{1}.png", ArchiveConstants.TERRAINS_PATH, m_sceneName); | ||
82 | MemoryStream ms = new MemoryStream(); | ||
83 | m_terrainModule.SaveToStream(terrainPath, ms); | ||
84 | archive.AddFile(terrainPath, ms.ToArray()); | ||
85 | ms.Close(); | ||
86 | |||
87 | // Write out scene object metadata | ||
70 | foreach (SceneObjectGroup sceneObject in m_sceneObjects) | 88 | foreach (SceneObjectGroup sceneObject in m_sceneObjects) |
71 | { | 89 | { |
72 | //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType()); | 90 | //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType()); |
@@ -84,6 +102,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
84 | archive.AddFile(filename, serializedObject); | 102 | archive.AddFile(filename, serializedObject); |
85 | } | 103 | } |
86 | 104 | ||
105 | // Write out assets | ||
87 | AssetsArchiver assetsArchiver = new AssetsArchiver(assets); | 106 | AssetsArchiver assetsArchiver = new AssetsArchiver(assets); |
88 | assetsArchiver.Archive(archive); | 107 | assetsArchiver.Archive(archive); |
89 | 108 | ||