diff options
author | Master ScienceSim | 2010-10-28 09:09:42 -0700 |
---|---|---|
committer | Master ScienceSim | 2010-10-28 09:09:42 -0700 |
commit | f2c1d0e34feba801ff85c35ee049ed6d3067bb0d (patch) | |
tree | ff692ecc0db2b9cdf4cacd5a42234a5bb58ddd34 /OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |
parent | Added background thread to handle delayed send and save of appearance (diff) | |
parent | Formatting cleanup. (diff) | |
download | opensim-SC_OLD-f2c1d0e34feba801ff85c35ee049ed6d3067bb0d.zip opensim-SC_OLD-f2c1d0e34feba801ff85c35ee049ed6d3067bb0d.tar.gz opensim-SC_OLD-f2c1d0e34feba801ff85c35ee049ed6d3067bb0d.tar.bz2 opensim-SC_OLD-f2c1d0e34feba801ff85c35ee049ed6d3067bb0d.tar.xz |
Merge branch 'opensim-master' into dev-appearance
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index c1df827..046b05f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -33,6 +33,7 @@ using System.Reflection; | |||
33 | using System.Threading; | 33 | using System.Threading; |
34 | using System.Text; | 34 | using System.Text; |
35 | using System.Xml; | 35 | using System.Xml; |
36 | using System.Xml.Linq; | ||
36 | using log4net; | 37 | using log4net; |
37 | using OpenMetaverse; | 38 | using OpenMetaverse; |
38 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
@@ -50,6 +51,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
50 | { | 51 | { |
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | 53 | ||
54 | /// <summary> | ||
55 | /// The maximum major version of archive that we can read. Minor versions shouldn't need a max number since version | ||
56 | /// bumps here should be compatible. | ||
57 | /// </summary> | ||
58 | public static int MAX_MAJOR_VERSION = 0; | ||
59 | |||
53 | protected TarArchiveReader archive; | 60 | protected TarArchiveReader archive; |
54 | 61 | ||
55 | private UserAccount m_userInfo; | 62 | private UserAccount m_userInfo; |
@@ -133,7 +140,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
133 | 140 | ||
134 | while ((data = archive.ReadEntry(out filePath, out entryType)) != null) | 141 | while ((data = archive.ReadEntry(out filePath, out entryType)) != null) |
135 | { | 142 | { |
136 | if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) | 143 | if (filePath == ArchiveConstants.CONTROL_FILE_PATH) |
144 | { | ||
145 | LoadControlFile(filePath, data); | ||
146 | } | ||
147 | else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) | ||
137 | { | 148 | { |
138 | if (LoadAsset(filePath, data)) | 149 | if (LoadAsset(filePath, data)) |
139 | successfulAssetRestores++; | 150 | successfulAssetRestores++; |
@@ -461,5 +472,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
461 | return false; | 472 | return false; |
462 | } | 473 | } |
463 | } | 474 | } |
475 | |||
476 | /// <summary> | ||
477 | /// Load control file | ||
478 | /// </summary> | ||
479 | /// <param name="path"></param> | ||
480 | /// <param name="data"></param> | ||
481 | protected void LoadControlFile(string path, byte[] data) | ||
482 | { | ||
483 | XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data)); | ||
484 | XElement archiveElement = doc.Element("archive"); | ||
485 | int majorVersion = int.Parse(archiveElement.Attribute("major_version").Value); | ||
486 | int minorVersion = int.Parse(archiveElement.Attribute("minor_version").Value); | ||
487 | string version = string.Format("{0}.{1}", majorVersion, minorVersion); | ||
488 | |||
489 | if (majorVersion > MAX_MAJOR_VERSION) | ||
490 | { | ||
491 | throw new Exception( | ||
492 | string.Format( | ||
493 | "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", | ||
494 | majorVersion, MAX_MAJOR_VERSION)); | ||
495 | } | ||
496 | |||
497 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version); | ||
498 | } | ||
464 | } | 499 | } |
465 | } \ No newline at end of file | 500 | } \ No newline at end of file |