* Hook up archive loading to load in prim xml data
* This now has equivalent functionality to load-xml2 - no asset data is restored yet0.6.0-stable
parent
83f390e421
commit
bc56efd1d2
|
@ -26,7 +26,9 @@
|
|||
*/
|
||||
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using OpenSim.Region.Environment.Modules.World.Serialiser;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
|
||||
|
@ -85,7 +87,8 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
// Reload serialized prims
|
||||
m_log.InfoFormat("[ARCHIVER]: Loading prim data");
|
||||
|
||||
//m_scene.LoadPrimsFromXml2(
|
||||
IRegionSerialiser serialiser = m_scene.RequestModuleInterface<IRegionSerialiser>();
|
||||
serialiser.LoadPrimsFromXml2(m_scene, new StringReader(serializedPrims));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
using libsecondlife;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
|
||||
namespace OpenSim.Region.Environment.Modules.World.Serialiser
|
||||
|
@ -39,8 +40,20 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
|
|||
|
||||
void SavePrimsToXml(Scene scene, string fileName);
|
||||
|
||||
/// <summary>
|
||||
/// Load prims from the xml2 format
|
||||
/// </summary>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="fileName"></param>
|
||||
void LoadPrimsFromXml2(Scene scene, string fileName);
|
||||
|
||||
/// <summary>
|
||||
/// Load prims from the xml2 format
|
||||
/// </summary>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="reader"></param>
|
||||
void LoadPrimsFromXml2(Scene scene, TextReader reader);
|
||||
|
||||
void SavePrimsToXml2(Scene scene, string fileName);
|
||||
|
||||
void LoadGroupFromXml2String(Scene scene, string xmlString);
|
||||
|
|
|
@ -147,25 +147,42 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load prims from the xml2 format
|
||||
/// </summary>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="fileName"></param>
|
||||
public static void LoadPrimsFromXml2(Scene scene, string fileName)
|
||||
{
|
||||
LoadPrimsFromXml2(scene, new XmlTextReader(fileName));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load prims from the xml2 format
|
||||
/// </summary>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="reader"></param>
|
||||
public static void LoadPrimsFromXml2(Scene scene, TextReader reader)
|
||||
{
|
||||
LoadPrimsFromXml2(scene, new XmlTextReader(reader));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load prims from the xml2 format. This method will close the reader
|
||||
/// </summary>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="reader"></param>
|
||||
protected static void LoadPrimsFromXml2(Scene scene, XmlTextReader reader)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
XmlNode rootNode;
|
||||
if (fileName.StartsWith("http:") || File.Exists(fileName))
|
||||
reader.WhitespaceHandling = WhitespaceHandling.None;
|
||||
doc.Load(reader);
|
||||
reader.Close();
|
||||
XmlNode rootNode = doc.FirstChild;
|
||||
|
||||
foreach (XmlNode aPrimNode in rootNode.ChildNodes)
|
||||
{
|
||||
XmlTextReader reader = new XmlTextReader(fileName);
|
||||
reader.WhitespaceHandling = WhitespaceHandling.None;
|
||||
doc.Load(reader);
|
||||
reader.Close();
|
||||
rootNode = doc.FirstChild;
|
||||
foreach (XmlNode aPrimNode in rootNode.ChildNodes)
|
||||
{
|
||||
CreatePrimFromXml(scene, aPrimNode.OuterXml);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Could not open file " + fileName + " for reading");
|
||||
CreatePrimFromXml(scene, aPrimNode.OuterXml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -102,6 +102,11 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
|
|||
SceneXmlLoader.LoadPrimsFromXml2(scene, fileName);
|
||||
}
|
||||
|
||||
public void LoadPrimsFromXml2(Scene scene, TextReader reader)
|
||||
{
|
||||
SceneXmlLoader.LoadPrimsFromXml2(scene, reader);
|
||||
}
|
||||
|
||||
public void SavePrimsToXml2(Scene scene, string fileName)
|
||||
{
|
||||
SceneXmlLoader.SavePrimsToXml2(scene, fileName);
|
||||
|
|
Loading…
Reference in New Issue