refactor: make boolean load indicators on load iars instance fields

0.7.1-dev
Justin Clark-Casey (justincc) 2011-03-12 00:28:23 +00:00
parent 367ed585e0
commit a3c7c04ead
1 changed files with 11 additions and 8 deletions

View File

@ -83,6 +83,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// </summary> /// </summary>
protected Dictionary<UUID, UUID> m_creatorIdForAssetId = new Dictionary<UUID, UUID>(); protected Dictionary<UUID, UUID> m_creatorIdForAssetId = new Dictionary<UUID, UUID>();
protected bool m_controlFileLoaded;
protected bool m_assetsLoaded;
protected bool m_inventoryNodesLoaded;
public InventoryArchiveReadRequest( public InventoryArchiveReadRequest(
Scene scene, UserAccount userInfo, string invPath, string loadPath, bool merge) Scene scene, UserAccount userInfo, string invPath, string loadPath, bool merge)
: this( : this(
@ -144,24 +148,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
byte[] data; byte[] data;
TarArchiveReader.TarEntryType entryType; TarArchiveReader.TarEntryType entryType;
bool controlFileLoaded = false, assetsLoaded = false, inventoryNodesLoaded = false;
while ((data = archive.ReadEntry(out filePath, out entryType)) != null) while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
{ {
if (filePath == ArchiveConstants.CONTROL_FILE_PATH) if (filePath == ArchiveConstants.CONTROL_FILE_PATH)
{ {
LoadControlFile(filePath, data); LoadControlFile(filePath, data);
controlFileLoaded = true; m_controlFileLoaded = true;
} }
else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
{ {
if (!controlFileLoaded) if (!m_controlFileLoaded)
throw new Exception( throw new Exception(
string.Format( string.Format(
"The IAR you are trying to load does not list {0} before {1}. Aborting load", "The IAR you are trying to load does not list {0} before {1}. Aborting load",
ArchiveConstants.CONTROL_FILE_PATH, ArchiveConstants.ASSETS_PATH)); ArchiveConstants.CONTROL_FILE_PATH, ArchiveConstants.ASSETS_PATH));
if (!inventoryNodesLoaded) if (!m_inventoryNodesLoaded)
throw new Exception( throw new Exception(
string.Format( string.Format(
"The IAR you are trying to load does not list all {0} before {1}. Aborting load", "The IAR you are trying to load does not list all {0} before {1}. Aborting load",
@ -177,17 +180,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
"[INVENTORY ARCHIVER]: Loaded {0} assets...", "[INVENTORY ARCHIVER]: Loaded {0} assets...",
successfulAssetRestores); successfulAssetRestores);
assetsLoaded = true; m_assetsLoaded = true;
} }
else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH)) else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH))
{ {
if (!controlFileLoaded) if (!m_controlFileLoaded)
throw new Exception( throw new Exception(
string.Format( string.Format(
"The IAR you are trying to load does not list {0} before {1}. Aborting load", "The IAR you are trying to load does not list {0} before {1}. Aborting load",
ArchiveConstants.CONTROL_FILE_PATH, ArchiveConstants.INVENTORY_PATH)); ArchiveConstants.CONTROL_FILE_PATH, ArchiveConstants.INVENTORY_PATH));
if (assetsLoaded) if (m_assetsLoaded)
throw new Exception( throw new Exception(
string.Format( string.Format(
"The IAR you are trying to load does not list all {0} before {1}. Aborting load", "The IAR you are trying to load does not list all {0} before {1}. Aborting load",
@ -218,7 +221,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
} }
} }
inventoryNodesLoaded = true; m_inventoryNodesLoaded = true;
} }
} }