diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | 54 |
1 files changed, 39 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 01170aa..6b24718 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -78,11 +78,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
78 | private Stream m_loadStream; | 78 | private Stream m_loadStream; |
79 | 79 | ||
80 | /// <summary> | 80 | /// <summary> |
81 | /// FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things | 81 | /// Has the control file been loaded for this archive? |
82 | /// (I thought they weren't). We will need to bump the version number and perform this check on all | ||
83 | /// subsequent IAR versions only | ||
84 | /// </summary> | 82 | /// </summary> |
85 | protected bool m_controlFileLoaded = true; | 83 | public bool ControlFileLoaded { get; private set; } |
84 | |||
85 | /// <summary> | ||
86 | /// Do we want to enforce the check. IAR versions before 0.2 and 1.1 do not guarantee this order, so we can't | ||
87 | /// enforce. | ||
88 | /// </summary> | ||
89 | public bool EnforceControlFileCheck { get; private set; } | ||
90 | |||
86 | protected bool m_assetsLoaded; | 91 | protected bool m_assetsLoaded; |
87 | protected bool m_inventoryNodesLoaded; | 92 | protected bool m_inventoryNodesLoaded; |
88 | 93 | ||
@@ -131,6 +136,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
131 | m_userInfo = userInfo; | 136 | m_userInfo = userInfo; |
132 | m_invPath = invPath; | 137 | m_invPath = invPath; |
133 | m_loadStream = loadStream; | 138 | m_loadStream = loadStream; |
139 | |||
140 | // FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things | ||
141 | // (I thought they weren't). We will need to bump the version number and perform this check on all | ||
142 | // subsequent IAR versions only | ||
143 | ControlFileLoaded = true; | ||
134 | } | 144 | } |
135 | 145 | ||
136 | /// <summary> | 146 | /// <summary> |
@@ -471,16 +481,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
471 | if (m_creatorIdForAssetId.ContainsKey(assetId)) | 481 | if (m_creatorIdForAssetId.ContainsKey(assetId)) |
472 | { | 482 | { |
473 | string xmlData = Utils.BytesToString(data); | 483 | string xmlData = Utils.BytesToString(data); |
474 | SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | 484 | List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); |
475 | foreach (SceneObjectPart sop in sog.Parts) | 485 | |
486 | CoalescedSceneObjects coa = null; | ||
487 | if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) | ||
488 | { | ||
489 | // m_log.DebugFormat( | ||
490 | // "[INVENTORY ARCHIVER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count); | ||
491 | |||
492 | sceneObjects.AddRange(coa.Objects); | ||
493 | } | ||
494 | else | ||
476 | { | 495 | { |
477 | if (sop.CreatorData == null || sop.CreatorData == "") | 496 | sceneObjects.Add(SceneObjectSerializer.FromOriginalXmlFormat(xmlData)); |
478 | { | ||
479 | sop.CreatorID = m_creatorIdForAssetId[assetId]; | ||
480 | } | ||
481 | } | 497 | } |
482 | 498 | ||
483 | data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog)); | 499 | foreach (SceneObjectGroup sog in sceneObjects) |
500 | foreach (SceneObjectPart sop in sog.Parts) | ||
501 | if (sop.CreatorData == null || sop.CreatorData == "") | ||
502 | sop.CreatorID = m_creatorIdForAssetId[assetId]; | ||
503 | |||
504 | if (coa != null) | ||
505 | data = Utils.StringToBytes(CoalescedSceneObjectsSerializer.ToXml(coa)); | ||
506 | else | ||
507 | data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sceneObjects[0])); | ||
484 | } | 508 | } |
485 | } | 509 | } |
486 | 510 | ||
@@ -508,7 +532,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
508 | /// </summary> | 532 | /// </summary> |
509 | /// <param name="path"></param> | 533 | /// <param name="path"></param> |
510 | /// <param name="data"></param> | 534 | /// <param name="data"></param> |
511 | protected void LoadControlFile(string path, byte[] data) | 535 | public void LoadControlFile(string path, byte[] data) |
512 | { | 536 | { |
513 | XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data)); | 537 | XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data)); |
514 | XElement archiveElement = doc.Element("archive"); | 538 | XElement archiveElement = doc.Element("archive"); |
@@ -524,7 +548,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
524 | majorVersion, MAX_MAJOR_VERSION)); | 548 | majorVersion, MAX_MAJOR_VERSION)); |
525 | } | 549 | } |
526 | 550 | ||
527 | m_controlFileLoaded = true; | 551 | ControlFileLoaded = true; |
528 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version); | 552 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version); |
529 | } | 553 | } |
530 | 554 | ||
@@ -536,7 +560,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
536 | /// <param name="data"></param> | 560 | /// <param name="data"></param> |
537 | protected void LoadInventoryFile(string path, TarArchiveReader.TarEntryType entryType, byte[] data) | 561 | protected void LoadInventoryFile(string path, TarArchiveReader.TarEntryType entryType, byte[] data) |
538 | { | 562 | { |
539 | if (!m_controlFileLoaded) | 563 | if (!ControlFileLoaded) |
540 | throw new Exception( | 564 | throw new Exception( |
541 | string.Format( | 565 | string.Format( |
542 | "The IAR you are trying to load does not list {0} before {1}. Aborting load", | 566 | "The IAR you are trying to load does not list {0} before {1}. Aborting load", |
@@ -583,7 +607,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
583 | /// <param name="data"></param> | 607 | /// <param name="data"></param> |
584 | protected void LoadAssetFile(string path, byte[] data) | 608 | protected void LoadAssetFile(string path, byte[] data) |
585 | { | 609 | { |
586 | if (!m_controlFileLoaded) | 610 | if (!ControlFileLoaded) |
587 | throw new Exception( | 611 | throw new Exception( |
588 | string.Format( | 612 | string.Format( |
589 | "The IAR you are trying to load does not list {0} before {1}. Aborting load", | 613 | "The IAR you are trying to load does not list {0} before {1}. Aborting load", |