* minor: make control file loading code consistent

0.6.6-post-fixes
Justin Clarke Casey 2009-06-12 14:18:01 +00:00
parent 15b8641bef
commit 4e526778b7
2 changed files with 12 additions and 18 deletions

View File

@ -135,8 +135,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
else if (!m_merge && filePath.StartsWith(ArchiveConstants.SETTINGS_PATH)) else if (!m_merge && filePath.StartsWith(ArchiveConstants.SETTINGS_PATH))
{ {
LoadRegionSettings(filePath, data); LoadRegionSettings(filePath, data);
} else if (filePath == ArchiveConstants.CONTROL_FILE_PATH) { }
LoadArchiveMetadata(filePath, data); else if (filePath == ArchiveConstants.CONTROL_FILE_PATH)
{
LoadControlFile(filePath, data);
} }
} }
@ -483,14 +485,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
} }
/// <summary> /// <summary>
/// Load oar file metadata /// Load oar control file
/// </summary> /// </summary>
/// <param name="terrainPath"></param> /// <param name="path"></param>
/// <param name="data"></param> /// <param name="data"></param>
/// <returns> private void LoadControlFile(string path, byte[] data)
/// true if terrain was resolved successfully, false otherwise.
/// </returns>
private bool LoadArchiveMetadata(string terrainPath, byte[] data)
{ {
//Create the XmlNamespaceManager. //Create the XmlNamespaceManager.
NameTable nt = new NameTable(); NameTable nt = new NameTable();
@ -499,9 +498,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// Create the XmlParserContext. // Create the XmlParserContext.
XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
XmlTextReader xtr = new XmlTextReader(m_asciiEncoding.GetString(data), XmlTextReader xtr
XmlNodeType.Document, context); = new XmlTextReader(m_asciiEncoding.GetString(data), XmlNodeType.Document, context);
RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings; RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings;
@ -514,15 +512,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{ {
if (xtr.NodeType == XmlNodeType.Element) if (xtr.NodeType == XmlNodeType.Element)
{ {
if (xtr.Name.ToString()=="date") if (xtr.Name.ToString() == "date")
{ {
currentRegionSettings.LoadedCreationDate = xtr.ReadElementContentAsString(); currentRegionSettings.LoadedCreationDate = xtr.ReadElementContentAsString();
} }
else if (xtr.Name.ToString()=="time") else if (xtr.Name.ToString() == "time")
{ {
currentRegionSettings.LoadedCreationTime = xtr.ReadElementContentAsString(); currentRegionSettings.LoadedCreationTime = xtr.ReadElementContentAsString();
} }
else if (xtr.Name.ToString()=="id") else if (xtr.Name.ToString() == "id")
{ {
currentRegionSettings.LoadedCreationID = xtr.ReadElementContentAsString(); currentRegionSettings.LoadedCreationID = xtr.ReadElementContentAsString();
} }
@ -533,8 +531,5 @@ namespace OpenSim.Region.CoreModules.World.Archiver
return true; return true;
} }
} }
} }

View File

@ -93,7 +93,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// Write out control file // Write out control file
m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile()); m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile());
m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");
// Write out region settings // Write out region settings