diff options
author | dr scofield (aka dirk husemann) | 2009-10-02 11:10:52 +0200 |
---|---|---|
committer | dr scofield (aka dirk husemann) | 2009-10-02 11:31:30 +0200 |
commit | 2107b67f1b145f7718fdb1450be1a7b8dd1a0bf7 (patch) | |
tree | 74913862b829b7e56994f2c33ca5fe35638baad1 /OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-2107b67f1b145f7718fdb1450be1a7b8dd1a0bf7.zip opensim-SC_OLD-2107b67f1b145f7718fdb1450be1a7b8dd1a0bf7.tar.gz opensim-SC_OLD-2107b67f1b145f7718fdb1450be1a7b8dd1a0bf7.tar.bz2 opensim-SC_OLD-2107b67f1b145f7718fdb1450be1a7b8dd1a0bf7.tar.xz |
- cleaning up LandData/ILandObject capitalization issues
- adding LandDataSerializer to OAR mechanics
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 65f83fd..54acbc4 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -53,6 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
54 | 54 | ||
55 | private static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding(); | 55 | private static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding(); |
56 | private static UTF8Encoding m_utf8Encoding = new UTF8Encoding(); | ||
56 | 57 | ||
57 | private Scene m_scene; | 58 | private Scene m_scene; |
58 | private Stream m_loadStream; | 59 | private Stream m_loadStream; |
@@ -100,6 +101,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
100 | int successfulAssetRestores = 0; | 101 | int successfulAssetRestores = 0; |
101 | int failedAssetRestores = 0; | 102 | int failedAssetRestores = 0; |
102 | List<string> serialisedSceneObjects = new List<string>(); | 103 | List<string> serialisedSceneObjects = new List<string>(); |
104 | List<string> serialisedParcels = new List<string>(); | ||
103 | string filePath = "NONE"; | 105 | string filePath = "NONE"; |
104 | 106 | ||
105 | try | 107 | try |
@@ -119,7 +121,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
119 | 121 | ||
120 | if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH)) | 122 | if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH)) |
121 | { | 123 | { |
122 | serialisedSceneObjects.Add(m_asciiEncoding.GetString(data)); | 124 | serialisedSceneObjects.Add(m_utf8Encoding.GetString(data)); |
123 | } | 125 | } |
124 | else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) | 126 | else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) |
125 | { | 127 | { |
@@ -136,6 +138,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
136 | { | 138 | { |
137 | LoadRegionSettings(filePath, data); | 139 | LoadRegionSettings(filePath, data); |
138 | } | 140 | } |
141 | else if (!m_merge && filePath.StartsWith(ArchiveConstants.LANDDATA_PATH)) | ||
142 | { | ||
143 | serialisedParcels.Add(m_utf8Encoding.GetString(data)); | ||
144 | } | ||
139 | else if (filePath == ArchiveConstants.CONTROL_FILE_PATH) | 145 | else if (filePath == ArchiveConstants.CONTROL_FILE_PATH) |
140 | { | 146 | { |
141 | LoadControlFile(filePath, data); | 147 | LoadControlFile(filePath, data); |
@@ -169,6 +175,26 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
169 | m_scene.DeleteAllSceneObjects(); | 175 | m_scene.DeleteAllSceneObjects(); |
170 | } | 176 | } |
171 | 177 | ||
178 | // Try to retain the original creator/owner/lastowner if their uuid is present on this grid | ||
179 | // otherwise, use the master avatar uuid instead | ||
180 | UUID masterAvatarId = m_scene.RegionInfo.MasterAvatarAssignedUUID; | ||
181 | |||
182 | if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) | ||
183 | masterAvatarId = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
184 | |||
185 | // Reload serialized parcels | ||
186 | m_log.InfoFormat("[ARCHIVER]: Loading {0} parcels. Please wait.", serialisedParcels.Count); | ||
187 | List<LandData> landData = new List<LandData>(); | ||
188 | foreach (string serialisedParcel in serialisedParcels) | ||
189 | { | ||
190 | LandData parcel = LandDataSerializer.Deserialize(serialisedParcel); | ||
191 | if (!ResolveUserUuid(parcel.OwnerID)) | ||
192 | parcel.OwnerID = masterAvatarId; | ||
193 | landData.Add(parcel); | ||
194 | } | ||
195 | m_scene.EventManager.TriggerIncomingLandDataFromStorage(landData); | ||
196 | m_log.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count); | ||
197 | |||
172 | // Reload serialized prims | 198 | // Reload serialized prims |
173 | m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); | 199 | m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); |
174 | 200 | ||
@@ -198,12 +224,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
198 | // to the same scene (when this is possible). | 224 | // to the same scene (when this is possible). |
199 | sceneObject.ResetIDs(); | 225 | sceneObject.ResetIDs(); |
200 | 226 | ||
201 | // Try to retain the original creator/owner/lastowner if their uuid is present on this grid | ||
202 | // otherwise, use the master avatar uuid instead | ||
203 | UUID masterAvatarId = m_scene.RegionInfo.MasterAvatarAssignedUUID; | ||
204 | |||
205 | if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) | ||
206 | masterAvatarId = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
207 | 227 | ||
208 | foreach (SceneObjectPart part in sceneObject.Children.Values) | 228 | foreach (SceneObjectPart part in sceneObject.Children.Values) |
209 | { | 229 | { |