* 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
|
||||
|
@ -38,9 +39,21 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
|
|||
void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, LLVector3 loadOffset);
|
||||
|
||||
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,26 +147,43 @@ 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)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
XmlNode rootNode;
|
||||
if (fileName.StartsWith("http:") || File.Exists(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();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public static void CreatePrimFromXml(Scene scene, string xmlData)
|
||||
|
|
|
@ -101,6 +101,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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue