diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | 160 |
1 files changed, 80 insertions, 80 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 4a06fd1..3838316 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -56,7 +56,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
56 | /// bumps here should be compatible. | 56 | /// bumps here should be compatible. |
57 | /// </summary> | 57 | /// </summary> |
58 | public static int MAX_MAJOR_VERSION = 1; | 58 | public static int MAX_MAJOR_VERSION = 1; |
59 | 59 | ||
60 | protected TarArchiveReader archive; | 60 | protected TarArchiveReader archive; |
61 | 61 | ||
62 | private UserAccount m_userInfo; | 62 | private UserAccount m_userInfo; |
@@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
66 | /// ID of this request | 66 | /// ID of this request |
67 | /// </value> | 67 | /// </value> |
68 | protected UUID m_id; | 68 | protected UUID m_id; |
69 | 69 | ||
70 | /// <summary> | 70 | /// <summary> |
71 | /// Do we want to merge this load with existing inventory? | 71 | /// Do we want to merge this load with existing inventory? |
72 | /// </summary> | 72 | /// </summary> |
@@ -82,41 +82,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
82 | /// The stream from which the inventory archive will be loaded. | 82 | /// The stream from which the inventory archive will be loaded. |
83 | /// </value> | 83 | /// </value> |
84 | private Stream m_loadStream; | 84 | private Stream m_loadStream; |
85 | 85 | ||
86 | /// <summary> | 86 | /// <summary> |
87 | /// Has the control file been loaded for this archive? | 87 | /// Has the control file been loaded for this archive? |
88 | /// </summary> | 88 | /// </summary> |
89 | public bool ControlFileLoaded { get; private set; } | 89 | public bool ControlFileLoaded { get; private set; } |
90 | 90 | ||
91 | /// <summary> | 91 | /// <summary> |
92 | /// Do we want to enforce the check. IAR versions before 0.2 and 1.1 do not guarantee this order, so we can't | 92 | /// Do we want to enforce the check. IAR versions before 0.2 and 1.1 do not guarantee this order, so we can't |
93 | /// enforce. | 93 | /// enforce. |
94 | /// </summary> | 94 | /// </summary> |
95 | public bool EnforceControlFileCheck { get; private set; } | 95 | public bool EnforceControlFileCheck { get; private set; } |
96 | 96 | ||
97 | protected bool m_assetsLoaded; | 97 | protected bool m_assetsLoaded; |
98 | protected bool m_inventoryNodesLoaded; | 98 | protected bool m_inventoryNodesLoaded; |
99 | 99 | ||
100 | protected int m_successfulAssetRestores; | 100 | protected int m_successfulAssetRestores; |
101 | protected int m_failedAssetRestores; | 101 | protected int m_failedAssetRestores; |
102 | protected int m_successfulItemRestores; | 102 | protected int m_successfulItemRestores; |
103 | 103 | ||
104 | /// <summary> | 104 | /// <summary> |
105 | /// Root destination folder for the IAR load. | 105 | /// Root destination folder for the IAR load. |
106 | /// </summary> | 106 | /// </summary> |
107 | protected InventoryFolderBase m_rootDestinationFolder; | 107 | protected InventoryFolderBase m_rootDestinationFolder; |
108 | 108 | ||
109 | /// <summary> | 109 | /// <summary> |
110 | /// Inventory nodes loaded from the iar. | 110 | /// Inventory nodes loaded from the iar. |
111 | /// </summary> | 111 | /// </summary> |
112 | protected HashSet<InventoryNodeBase> m_loadedNodes = new HashSet<InventoryNodeBase>(); | 112 | protected HashSet<InventoryNodeBase> m_loadedNodes = new HashSet<InventoryNodeBase>(); |
113 | 113 | ||
114 | /// <summary> | 114 | /// <summary> |
115 | /// In order to load identically named folders, we need to keep track of the folders that we have already | 115 | /// In order to load identically named folders, we need to keep track of the folders that we have already |
116 | /// resolved. | 116 | /// resolved. |
117 | /// </summary> | 117 | /// </summary> |
118 | Dictionary <string, InventoryFolderBase> m_resolvedFolders = new Dictionary<string, InventoryFolderBase>(); | 118 | Dictionary <string, InventoryFolderBase> m_resolvedFolders = new Dictionary<string, InventoryFolderBase>(); |
119 | 119 | ||
120 | /// <summary> | 120 | /// <summary> |
121 | /// Record the creator id that should be associated with an asset. This is used to adjust asset creator ids | 121 | /// Record the creator id that should be associated with an asset. This is used to adjust asset creator ids |
122 | /// after OSP resolution (since OSP creators are only stored in the item | 122 | /// after OSP resolution (since OSP creators are only stored in the item |
@@ -163,9 +163,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
163 | m_invPath = invPath; | 163 | m_invPath = invPath; |
164 | m_loadStream = loadStream; | 164 | m_loadStream = loadStream; |
165 | m_module = module; | 165 | m_module = module; |
166 | 166 | ||
167 | // FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things | 167 | // FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things |
168 | // (I thought they weren't). We will need to bump the version number and perform this check on all | 168 | // (I thought they weren't). We will need to bump the version number and perform this check on all |
169 | // subsequent IAR versions only | 169 | // subsequent IAR versions only |
170 | ControlFileLoaded = true; | 170 | ControlFileLoaded = true; |
171 | } | 171 | } |
@@ -188,19 +188,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
188 | Exception reportedException = null; | 188 | Exception reportedException = null; |
189 | 189 | ||
190 | string filePath = "ERROR"; | 190 | string filePath = "ERROR"; |
191 | 191 | ||
192 | List<InventoryFolderBase> folderCandidates | 192 | List<InventoryFolderBase> folderCandidates |
193 | = InventoryArchiveUtils.FindFoldersByPath( | 193 | = InventoryArchiveUtils.FindFoldersByPath( |
194 | m_InventoryService, m_userInfo.PrincipalID, m_invPath); | 194 | m_InventoryService, m_userInfo.PrincipalID, m_invPath); |
195 | 195 | ||
196 | if (folderCandidates.Count == 0) | 196 | if (folderCandidates.Count == 0) |
197 | { | 197 | { |
198 | // Possibly provide an option later on to automatically create this folder if it does not exist | 198 | // Possibly provide an option later on to automatically create this folder if it does not exist |
199 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath); | 199 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath); |
200 | 200 | ||
201 | return m_loadedNodes; | 201 | return m_loadedNodes; |
202 | } | 202 | } |
203 | 203 | ||
204 | m_rootDestinationFolder = folderCandidates[0]; | 204 | m_rootDestinationFolder = folderCandidates[0]; |
205 | archive = new TarArchiveReader(m_loadStream); | 205 | archive = new TarArchiveReader(m_loadStream); |
206 | byte[] data; | 206 | byte[] data; |
@@ -211,7 +211,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
211 | if (filePath == ArchiveConstants.CONTROL_FILE_PATH) | 211 | if (filePath == ArchiveConstants.CONTROL_FILE_PATH) |
212 | { | 212 | { |
213 | LoadControlFile(filePath, data); | 213 | LoadControlFile(filePath, data); |
214 | } | 214 | } |
215 | else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) | 215 | else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) |
216 | { | 216 | { |
217 | LoadAssetFile(filePath, data); | 217 | LoadAssetFile(filePath, data); |
@@ -221,17 +221,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
221 | LoadInventoryFile(filePath, entryType, data); | 221 | LoadInventoryFile(filePath, entryType, data); |
222 | } | 222 | } |
223 | } | 223 | } |
224 | 224 | ||
225 | archive.Close(); | 225 | archive.Close(); |
226 | 226 | ||
227 | m_log.DebugFormat( | 227 | m_log.DebugFormat( |
228 | "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", | 228 | "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", |
229 | m_successfulAssetRestores, m_failedAssetRestores); | 229 | m_successfulAssetRestores, m_failedAssetRestores); |
230 | 230 | ||
231 | //Alicia: When this is called by LibraryModule or Tests, m_module will be null as event is not required | 231 | //Alicia: When this is called by LibraryModule or Tests, m_module will be null as event is not required |
232 | if(m_module != null) | 232 | if(m_module != null) |
233 | m_module.TriggerInventoryArchiveLoaded(m_id, true, m_userInfo, m_invPath, m_loadStream, reportedException, m_successfulItemRestores); | 233 | m_module.TriggerInventoryArchiveLoaded(m_id, true, m_userInfo, m_invPath, m_loadStream, reportedException, m_successfulItemRestores); |
234 | 234 | ||
235 | return m_loadedNodes; | 235 | return m_loadedNodes; |
236 | } | 236 | } |
237 | catch(Exception Ex) | 237 | catch(Exception Ex) |
@@ -268,8 +268,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
268 | /// </param> | 268 | /// </param> |
269 | /// <returns>The last user inventory folder created or found for the archive path</returns> | 269 | /// <returns>The last user inventory folder created or found for the archive path</returns> |
270 | public InventoryFolderBase ReplicateArchivePathToUserInventory( | 270 | public InventoryFolderBase ReplicateArchivePathToUserInventory( |
271 | string iarPath, | 271 | string iarPath, |
272 | InventoryFolderBase rootDestFolder, | 272 | InventoryFolderBase rootDestFolder, |
273 | Dictionary <string, InventoryFolderBase> resolvedFolders, | 273 | Dictionary <string, InventoryFolderBase> resolvedFolders, |
274 | HashSet<InventoryNodeBase> loadedNodes) | 274 | HashSet<InventoryNodeBase> loadedNodes) |
275 | { | 275 | { |
@@ -277,27 +277,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
277 | 277 | ||
278 | // m_log.DebugFormat( | 278 | // m_log.DebugFormat( |
279 | // "[INVENTORY ARCHIVER]: Loading folder {0} {1}", rootDestFolder.Name, rootDestFolder.ID); | 279 | // "[INVENTORY ARCHIVER]: Loading folder {0} {1}", rootDestFolder.Name, rootDestFolder.ID); |
280 | 280 | ||
281 | InventoryFolderBase destFolder | 281 | InventoryFolderBase destFolder |
282 | = ResolveDestinationFolder(rootDestFolder, ref iarPathExisting, resolvedFolders); | 282 | = ResolveDestinationFolder(rootDestFolder, ref iarPathExisting, resolvedFolders); |
283 | 283 | ||
284 | // m_log.DebugFormat( | 284 | // m_log.DebugFormat( |
285 | // "[INVENTORY ARCHIVER]: originalArchivePath [{0}], section already loaded [{1}]", | 285 | // "[INVENTORY ARCHIVER]: originalArchivePath [{0}], section already loaded [{1}]", |
286 | // iarPath, iarPathExisting); | 286 | // iarPath, iarPathExisting); |
287 | 287 | ||
288 | string iarPathToCreate = iarPath.Substring(iarPathExisting.Length); | 288 | string iarPathToCreate = iarPath.Substring(iarPathExisting.Length); |
289 | CreateFoldersForPath(destFolder, iarPathExisting, iarPathToCreate, resolvedFolders, loadedNodes); | 289 | CreateFoldersForPath(destFolder, iarPathExisting, iarPathToCreate, resolvedFolders, loadedNodes); |
290 | 290 | ||
291 | return destFolder; | 291 | return destFolder; |
292 | } | 292 | } |
293 | 293 | ||
294 | /// <summary> | 294 | /// <summary> |
295 | /// Resolve a destination folder | 295 | /// Resolve a destination folder |
296 | /// </summary> | 296 | /// </summary> |
297 | /// | 297 | /// |
298 | /// We require here a root destination folder (usually the root of the user's inventory) and the archive | 298 | /// We require here a root destination folder (usually the root of the user's inventory) and the archive |
299 | /// path. We also pass in a list of previously resolved folders in case we've found this one previously. | 299 | /// path. We also pass in a list of previously resolved folders in case we've found this one previously. |
300 | /// | 300 | /// |
301 | /// <param name="archivePath"> | 301 | /// <param name="archivePath"> |
302 | /// The item archive path to resolve. The portion of the path passed back is that | 302 | /// The item archive path to resolve. The portion of the path passed back is that |
303 | /// which corresponds to the resolved desintation folder. | 303 | /// which corresponds to the resolved desintation folder. |
@@ -321,7 +321,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
321 | while (archivePath.Length > 0) | 321 | while (archivePath.Length > 0) |
322 | { | 322 | { |
323 | // m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath); | 323 | // m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath); |
324 | 324 | ||
325 | if (resolvedFolders.ContainsKey(archivePath)) | 325 | if (resolvedFolders.ContainsKey(archivePath)) |
326 | { | 326 | { |
327 | // m_log.DebugFormat( | 327 | // m_log.DebugFormat( |
@@ -332,13 +332,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
332 | { | 332 | { |
333 | if (m_merge) | 333 | if (m_merge) |
334 | { | 334 | { |
335 | // TODO: Using m_invPath is totally wrong - what we need to do is strip the uuid from the | 335 | // TODO: Using m_invPath is totally wrong - what we need to do is strip the uuid from the |
336 | // iar name and try to find that instead. | 336 | // iar name and try to find that instead. |
337 | string plainPath = ArchiveConstants.ExtractPlainPathFromIarPath(archivePath); | 337 | string plainPath = ArchiveConstants.ExtractPlainPathFromIarPath(archivePath); |
338 | List<InventoryFolderBase> folderCandidates | 338 | List<InventoryFolderBase> folderCandidates |
339 | = InventoryArchiveUtils.FindFoldersByPath( | 339 | = InventoryArchiveUtils.FindFoldersByPath( |
340 | m_InventoryService, m_userInfo.PrincipalID, plainPath); | 340 | m_InventoryService, m_userInfo.PrincipalID, plainPath); |
341 | 341 | ||
342 | if (folderCandidates.Count != 0) | 342 | if (folderCandidates.Count != 0) |
343 | { | 343 | { |
344 | InventoryFolderBase destFolder = folderCandidates[0]; | 344 | InventoryFolderBase destFolder = folderCandidates[0]; |
@@ -346,7 +346,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
346 | return destFolder; | 346 | return destFolder; |
347 | } | 347 | } |
348 | } | 348 | } |
349 | 349 | ||
350 | // Don't include the last slash so find the penultimate one | 350 | // Don't include the last slash so find the penultimate one |
351 | int penultimateSlashIndex = archivePath.LastIndexOf("/", archivePath.Length - 2); | 351 | int penultimateSlashIndex = archivePath.LastIndexOf("/", archivePath.Length - 2); |
352 | 352 | ||
@@ -365,10 +365,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
365 | } | 365 | } |
366 | } | 366 | } |
367 | } | 367 | } |
368 | 368 | ||
369 | return rootDestFolder; | 369 | return rootDestFolder; |
370 | } | 370 | } |
371 | 371 | ||
372 | /// <summary> | 372 | /// <summary> |
373 | /// Create a set of folders for the given path. | 373 | /// Create a set of folders for the given path. |
374 | /// </summary> | 374 | /// </summary> |
@@ -388,10 +388,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
388 | /// Track the inventory nodes created. | 388 | /// Track the inventory nodes created. |
389 | /// </param> | 389 | /// </param> |
390 | protected void CreateFoldersForPath( | 390 | protected void CreateFoldersForPath( |
391 | InventoryFolderBase destFolder, | 391 | InventoryFolderBase destFolder, |
392 | string iarPathExisting, | 392 | string iarPathExisting, |
393 | string iarPathToReplicate, | 393 | string iarPathToReplicate, |
394 | Dictionary <string, InventoryFolderBase> resolvedFolders, | 394 | Dictionary <string, InventoryFolderBase> resolvedFolders, |
395 | HashSet<InventoryNodeBase> loadedNodes) | 395 | HashSet<InventoryNodeBase> loadedNodes) |
396 | { | 396 | { |
397 | string[] rawDirsToCreate = iarPathToReplicate.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); | 397 | string[] rawDirsToCreate = iarPathToReplicate.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); |
@@ -402,7 +402,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
402 | 402 | ||
403 | if (!rawDirsToCreate[i].Contains(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR)) | 403 | if (!rawDirsToCreate[i].Contains(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR)) |
404 | continue; | 404 | continue; |
405 | 405 | ||
406 | int identicalNameIdentifierIndex | 406 | int identicalNameIdentifierIndex |
407 | = rawDirsToCreate[i].LastIndexOf( | 407 | = rawDirsToCreate[i].LastIndexOf( |
408 | ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR); | 408 | ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR); |
@@ -412,7 +412,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
412 | newFolderName = InventoryArchiveUtils.UnescapeArchivePath(newFolderName); | 412 | newFolderName = InventoryArchiveUtils.UnescapeArchivePath(newFolderName); |
413 | UUID newFolderId = UUID.Random(); | 413 | UUID newFolderId = UUID.Random(); |
414 | 414 | ||
415 | destFolder | 415 | destFolder |
416 | = new InventoryFolderBase( | 416 | = new InventoryFolderBase( |
417 | newFolderId, newFolderName, m_userInfo.PrincipalID, | 417 | newFolderId, newFolderName, m_userInfo.PrincipalID, |
418 | (short)FolderType.None, destFolder.ID, 1); | 418 | (short)FolderType.None, destFolder.ID, 1); |
@@ -427,7 +427,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
427 | loadedNodes.Add(destFolder); | 427 | loadedNodes.Add(destFolder); |
428 | } | 428 | } |
429 | } | 429 | } |
430 | 430 | ||
431 | /// <summary> | 431 | /// <summary> |
432 | /// Load an item from the archive | 432 | /// Load an item from the archive |
433 | /// </summary> | 433 | /// </summary> |
@@ -438,7 +438,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
438 | protected InventoryItemBase LoadItem(byte[] data, InventoryFolderBase loadFolder) | 438 | protected InventoryItemBase LoadItem(byte[] data, InventoryFolderBase loadFolder) |
439 | { | 439 | { |
440 | InventoryItemBase item = UserInventoryItemSerializer.Deserialize(data); | 440 | InventoryItemBase item = UserInventoryItemSerializer.Deserialize(data); |
441 | 441 | ||
442 | // Don't use the item ID that's in the file | 442 | // Don't use the item ID that's in the file |
443 | item.ID = UUID.Random(); | 443 | item.ID = UUID.Random(); |
444 | 444 | ||
@@ -446,7 +446,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
446 | if (UUID.Zero != ospResolvedId) // The user exists in this grid | 446 | if (UUID.Zero != ospResolvedId) // The user exists in this grid |
447 | { | 447 | { |
448 | // m_log.DebugFormat("[INVENTORY ARCHIVER]: Found creator {0} via OSPA resolution", ospResolvedId); | 448 | // m_log.DebugFormat("[INVENTORY ARCHIVER]: Found creator {0} via OSPA resolution", ospResolvedId); |
449 | 449 | ||
450 | // item.CreatorIdAsUuid = ospResolvedId; | 450 | // item.CreatorIdAsUuid = ospResolvedId; |
451 | 451 | ||
452 | // Don't preserve the OSPA in the creator id (which actually gets persisted to the | 452 | // Don't preserve the OSPA in the creator id (which actually gets persisted to the |
@@ -474,7 +474,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
474 | 474 | ||
475 | if (!m_InventoryService.AddItem(item)) | 475 | if (!m_InventoryService.AddItem(item)) |
476 | m_log.WarnFormat("[INVENTORY ARCHIVER]: Unable to save item {0} in folder {1}", item.Name, item.Folder); | 476 | m_log.WarnFormat("[INVENTORY ARCHIVER]: Unable to save item {0} in folder {1}", item.Name, item.Folder); |
477 | 477 | ||
478 | return item; | 478 | return item; |
479 | } | 479 | } |
480 | 480 | ||
@@ -519,7 +519,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
519 | data = SceneObjectSerializer.ModifySerializedObject(assetId, data, | 519 | data = SceneObjectSerializer.ModifySerializedObject(assetId, data, |
520 | sog => { | 520 | sog => { |
521 | bool modified = false; | 521 | bool modified = false; |
522 | 522 | ||
523 | foreach (SceneObjectPart sop in sog.Parts) | 523 | foreach (SceneObjectPart sop in sog.Parts) |
524 | { | 524 | { |
525 | if (string.IsNullOrEmpty(sop.CreatorData)) | 525 | if (string.IsNullOrEmpty(sop.CreatorData)) |
@@ -528,10 +528,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
528 | modified = true; | 528 | modified = true; |
529 | } | 529 | } |
530 | } | 530 | } |
531 | 531 | ||
532 | return modified; | 532 | return modified; |
533 | }); | 533 | }); |
534 | 534 | ||
535 | if (data == null) | 535 | if (data == null) |
536 | return false; | 536 | return false; |
537 | } | 537 | } |
@@ -568,7 +568,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
568 | int majorVersion = int.Parse(archiveElement.Attribute("major_version").Value); | 568 | int majorVersion = int.Parse(archiveElement.Attribute("major_version").Value); |
569 | int minorVersion = int.Parse(archiveElement.Attribute("minor_version").Value); | 569 | int minorVersion = int.Parse(archiveElement.Attribute("minor_version").Value); |
570 | string version = string.Format("{0}.{1}", majorVersion, minorVersion); | 570 | string version = string.Format("{0}.{1}", majorVersion, minorVersion); |
571 | 571 | ||
572 | if (majorVersion > MAX_MAJOR_VERSION) | 572 | if (majorVersion > MAX_MAJOR_VERSION) |
573 | { | 573 | { |
574 | throw new Exception( | 574 | throw new Exception( |
@@ -576,38 +576,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
576 | "The IAR you are trying to load has major version number of {0} but this version of OpenSim can only load IARs with major version number {1} and below", | 576 | "The IAR you are trying to load has major version number of {0} but this version of OpenSim can only load IARs with major version number {1} and below", |
577 | majorVersion, MAX_MAJOR_VERSION)); | 577 | majorVersion, MAX_MAJOR_VERSION)); |
578 | } | 578 | } |
579 | 579 | ||
580 | ControlFileLoaded = true; | 580 | ControlFileLoaded = true; |
581 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version); | 581 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version); |
582 | } | 582 | } |
583 | 583 | ||
584 | /// <summary> | 584 | /// <summary> |
585 | /// Load inventory file | 585 | /// Load inventory file |
586 | /// </summary> | 586 | /// </summary> |
587 | /// <param name="path"></param> | 587 | /// <param name="path"></param> |
588 | /// <param name="entryType"></param> | 588 | /// <param name="entryType"></param> |
589 | /// <param name="data"></param> | 589 | /// <param name="data"></param> |
590 | protected void LoadInventoryFile(string path, TarArchiveReader.TarEntryType entryType, byte[] data) | 590 | protected void LoadInventoryFile(string path, TarArchiveReader.TarEntryType entryType, byte[] data) |
591 | { | 591 | { |
592 | if (!ControlFileLoaded) | 592 | if (!ControlFileLoaded) |
593 | throw new Exception( | 593 | throw new Exception( |
594 | string.Format( | 594 | string.Format( |
595 | "The IAR you are trying to load does not list {0} before {1}. Aborting load", | 595 | "The IAR you are trying to load does not list {0} before {1}. Aborting load", |
596 | ArchiveConstants.CONTROL_FILE_PATH, ArchiveConstants.INVENTORY_PATH)); | 596 | ArchiveConstants.CONTROL_FILE_PATH, ArchiveConstants.INVENTORY_PATH)); |
597 | 597 | ||
598 | if (m_assetsLoaded) | 598 | if (m_assetsLoaded) |
599 | throw new Exception( | 599 | throw new Exception( |
600 | string.Format( | 600 | string.Format( |
601 | "The IAR you are trying to load does not list all {0} before {1}. Aborting load", | 601 | "The IAR you are trying to load does not list all {0} before {1}. Aborting load", |
602 | ArchiveConstants.INVENTORY_PATH, ArchiveConstants.ASSETS_PATH)); | 602 | ArchiveConstants.INVENTORY_PATH, ArchiveConstants.ASSETS_PATH)); |
603 | 603 | ||
604 | path = path.Substring(ArchiveConstants.INVENTORY_PATH.Length); | 604 | path = path.Substring(ArchiveConstants.INVENTORY_PATH.Length); |
605 | 605 | ||
606 | // Trim off the file portion if we aren't already dealing with a directory path | 606 | // Trim off the file portion if we aren't already dealing with a directory path |
607 | if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType) | 607 | if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType) |
608 | path = path.Remove(path.LastIndexOf("/") + 1); | 608 | path = path.Remove(path.LastIndexOf("/") + 1); |
609 | 609 | ||
610 | InventoryFolderBase foundFolder | 610 | InventoryFolderBase foundFolder |
611 | = ReplicateArchivePathToUserInventory( | 611 | = ReplicateArchivePathToUserInventory( |
612 | path, m_rootDestinationFolder, m_resolvedFolders, m_loadedNodes); | 612 | path, m_rootDestinationFolder, m_resolvedFolders, m_loadedNodes); |
613 | 613 | ||
@@ -618,17 +618,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
618 | if (item != null) | 618 | if (item != null) |
619 | { | 619 | { |
620 | m_successfulItemRestores++; | 620 | m_successfulItemRestores++; |
621 | 621 | ||
622 | // If we aren't loading the folder containing the item then well need to update the | 622 | // If we aren't loading the folder containing the item then well need to update the |
623 | // viewer separately for that item. | 623 | // viewer separately for that item. |
624 | if (!m_loadedNodes.Contains(foundFolder)) | 624 | if (!m_loadedNodes.Contains(foundFolder)) |
625 | m_loadedNodes.Add(item); | 625 | m_loadedNodes.Add(item); |
626 | } | 626 | } |
627 | } | 627 | } |
628 | 628 | ||
629 | m_inventoryNodesLoaded = true; | 629 | m_inventoryNodesLoaded = true; |
630 | } | 630 | } |
631 | 631 | ||
632 | /// <summary> | 632 | /// <summary> |
633 | /// Load asset file | 633 | /// Load asset file |
634 | /// </summary> | 634 | /// </summary> |
@@ -639,15 +639,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
639 | if (!ControlFileLoaded) | 639 | if (!ControlFileLoaded) |
640 | throw new Exception( | 640 | throw new Exception( |
641 | string.Format( | 641 | string.Format( |
642 | "The IAR you are trying to load does not list {0} before {1}. Aborting load", | 642 | "The IAR you are trying to load does not list {0} before {1}. Aborting load", |
643 | ArchiveConstants.CONTROL_FILE_PATH, ArchiveConstants.ASSETS_PATH)); | 643 | ArchiveConstants.CONTROL_FILE_PATH, ArchiveConstants.ASSETS_PATH)); |
644 | 644 | ||
645 | if (!m_inventoryNodesLoaded) | 645 | if (!m_inventoryNodesLoaded) |
646 | throw new Exception( | 646 | throw new Exception( |
647 | string.Format( | 647 | string.Format( |
648 | "The IAR you are trying to load does not list all {0} before {1}. Aborting load", | 648 | "The IAR you are trying to load does not list all {0} before {1}. Aborting load", |
649 | ArchiveConstants.INVENTORY_PATH, ArchiveConstants.ASSETS_PATH)); | 649 | ArchiveConstants.INVENTORY_PATH, ArchiveConstants.ASSETS_PATH)); |
650 | 650 | ||
651 | if (LoadAsset(path, data)) | 651 | if (LoadAsset(path, data)) |
652 | m_successfulAssetRestores++; | 652 | m_successfulAssetRestores++; |
653 | else | 653 | else |
@@ -655,10 +655,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
655 | 655 | ||
656 | if ((m_successfulAssetRestores) % 50 == 0) | 656 | if ((m_successfulAssetRestores) % 50 == 0) |
657 | m_log.DebugFormat( | 657 | m_log.DebugFormat( |
658 | "[INVENTORY ARCHIVER]: Loaded {0} assets...", | 658 | "[INVENTORY ARCHIVER]: Loaded {0} assets...", |
659 | m_successfulAssetRestores); | 659 | m_successfulAssetRestores); |
660 | 660 | ||
661 | m_assetsLoaded = true; | 661 | m_assetsLoaded = true; |
662 | } | 662 | } |
663 | } | 663 | } |
664 | } | 664 | } |