From 607c07b4aab2a194102832a1e380cfbabe11d078 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 19:24:42 +0100 Subject: start parsing iar control file This change requires a prebuild[.sh|.bat] since a System.Xml.Linq reference is added to prebuild.xml --- .../Archiver/InventoryArchiveReadRequest.cs | 20 +++++++++++++++++++- .../CoreModules/World/Archiver/ArchiveReadRequest.cs | 2 +- prebuild.xml | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index c1df827..2beea8e 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; using System.Threading; using System.Text; using System.Xml; +using System.Xml.Linq; using log4net; using OpenMetaverse; using OpenSim.Framework; @@ -133,7 +134,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver while ((data = archive.ReadEntry(out filePath, out entryType)) != null) { - if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) + if (filePath == ArchiveConstants.CONTROL_FILE_PATH) + { + LoadControlFile(filePath, data); + } + else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) { if (LoadAsset(filePath, data)) successfulAssetRestores++; @@ -461,5 +466,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver return false; } } + + /// + /// Load control file + /// + /// + /// + protected void LoadControlFile(string path, byte[] data) + { + XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data)); + XElement archiveElement = doc.Element("archive"); + int.Parse(archiveElement.Attribute("major_version").Value); + int.Parse(archiveElement.Attribute("minor_version").Value); + } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 9192f43..087d3df 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -481,7 +481,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// /// /// - private void LoadControlFile(string path, byte[] data) + protected void LoadControlFile(string path, byte[] data) { XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable()); XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); diff --git a/prebuild.xml b/prebuild.xml index b28d226..dd4a576 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1387,6 +1387,7 @@ + -- cgit v1.1