start parsing iar control file

This change requires a prebuild[.sh|.bat] since a System.Xml.Linq reference is added to prebuild.xml
viewer-2-initial-appearance
Justin Clark-Casey (justincc) 2010-10-22 19:24:42 +01:00
parent a5bb7b8a30
commit 199b61f1b2
3 changed files with 21 additions and 2 deletions

View File

@ -33,6 +33,7 @@ using System.Reflection;
using System.Threading; using System.Threading;
using System.Text; using System.Text;
using System.Xml; using System.Xml;
using System.Xml.Linq;
using log4net; using log4net;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
@ -133,7 +134,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
while ((data = archive.ReadEntry(out filePath, out entryType)) != null) 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)) if (LoadAsset(filePath, data))
successfulAssetRestores++; successfulAssetRestores++;
@ -461,5 +466,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
return false; return false;
} }
} }
/// <summary>
/// Load control file
/// </summary>
/// <param name="path"></param>
/// <param name="data"></param>
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);
}
} }
} }

View File

@ -481,7 +481,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// </summary> /// </summary>
/// <param name="path"></param> /// <param name="path"></param>
/// <param name="data"></param> /// <param name="data"></param>
private void LoadControlFile(string path, byte[] data) protected void LoadControlFile(string path, byte[] data)
{ {
XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable()); XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable());
XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);

View File

@ -1387,6 +1387,7 @@
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Core"/> <Reference name="System.Core"/>
<Reference name="System.Xml"/> <Reference name="System.Xml"/>
<Reference name="System.Xml.Linq"/>
<Reference name="System.Drawing"/> <Reference name="System.Drawing"/>
<Reference name="System.Web"/> <Reference name="System.Web"/>
<Reference name="NDesk.Options" path="../../../bin/"/> <Reference name="NDesk.Options" path="../../../bin/"/>