diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs index 199539b..3799c57 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs | |||
@@ -25,11 +25,15 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | using libsecondlife; | 31 | using libsecondlife; |
31 | using log4net; | 32 | using log4net; |
32 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Region.Environment.Interfaces; | ||
35 | using OpenSim.Region.Environment.Modules.World.Serialiser; | ||
36 | using OpenSim.Region.Environment.Scenes; | ||
33 | 37 | ||
34 | namespace OpenSim.Region.Environment.Modules.World.Archiver | 38 | namespace OpenSim.Region.Environment.Modules.World.Archiver |
35 | { | 39 | { |
@@ -45,12 +49,15 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
45 | { | 49 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 51 | ||
52 | protected IRegionSerialiser m_serialiser; | ||
53 | protected List<EntityBase> m_sceneObjects; | ||
48 | protected string m_savePath; | 54 | protected string m_savePath; |
49 | protected string m_serializedEntities; | ||
50 | 55 | ||
51 | public ArchiveWriteRequestExecution(string serializedEntities, string savePath) | 56 | public ArchiveWriteRequestExecution( |
57 | List<EntityBase> sceneObjects, IRegionSerialiser serialiser, string savePath) | ||
52 | { | 58 | { |
53 | m_serializedEntities = serializedEntities; | 59 | m_sceneObjects = sceneObjects; |
60 | m_serialiser = serialiser; | ||
54 | m_savePath = savePath; | 61 | m_savePath = savePath; |
55 | } | 62 | } |
56 | 63 | ||
@@ -59,8 +66,23 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
59 | m_log.DebugFormat("[ARCHIVER]: Received all {0} assets required", assets.Count); | 66 | m_log.DebugFormat("[ARCHIVER]: Received all {0} assets required", assets.Count); |
60 | 67 | ||
61 | TarArchiveWriter archive = new TarArchiveWriter(); | 68 | TarArchiveWriter archive = new TarArchiveWriter(); |
62 | 69 | ||
63 | archive.AddFile(ArchiveConstants.PRIMS_PATH, m_serializedEntities); | 70 | foreach (EntityBase entity in m_sceneObjects) |
71 | { | ||
72 | // FIXME: I'm fairly sure that all entities are in fact SceneObjectGroups... must fix this | ||
73 | SceneObjectGroup sceneObject = (SceneObjectGroup)entity; | ||
74 | LLVector3 position = sceneObject.AbsolutePosition; | ||
75 | |||
76 | string serializedObject = m_serialiser.SaveGroupToXml2(sceneObject); | ||
77 | string filename | ||
78 | = string.Format( | ||
79 | "{0}{1}_{2:000}-{3:000}-{4:000}__{5}.xml", | ||
80 | ArchiveConstants.OBJECTS_PATH, sceneObject.Name, | ||
81 | Math.Round(position.X), Math.Round(position.Y), Math.Round(position.Z), | ||
82 | sceneObject.UUID); | ||
83 | |||
84 | archive.AddFile(filename, serializedObject); | ||
85 | } | ||
64 | 86 | ||
65 | AssetsArchiver assetsArchiver = new AssetsArchiver(assets); | 87 | AssetsArchiver assetsArchiver = new AssetsArchiver(assets); |
66 | assetsArchiver.Archive(archive); | 88 | assetsArchiver.Archive(archive); |
@@ -68,6 +90,6 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
68 | archive.WriteTar(m_savePath); | 90 | archive.WriteTar(m_savePath); |
69 | 91 | ||
70 | m_log.InfoFormat("[ARCHIVER]: Wrote out OpenSimulator archive {0}", m_savePath); | 92 | m_log.InfoFormat("[ARCHIVER]: Wrote out OpenSimulator archive {0}", m_savePath); |
71 | } | 93 | } |
72 | } | 94 | } |
73 | } | 95 | } |