* Various refactorings.
parent
f741a62d54
commit
a0b8c46ef3
|
@ -163,7 +163,7 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
// setup response to client
|
// setup response to client
|
||||||
Hashtable creds = new Hashtable();
|
Hashtable creds = new Hashtable();
|
||||||
creds["channel_uri"] = String.Format("sip:{0}@{1}",
|
creds["channel_uri"] = String.Format("sip:{0}@{1}",
|
||||||
m_scene.RegionInfo.RegionID.ToString(), m_sipDomain);
|
m_scene.RegionInfo.RegionID, m_sipDomain);
|
||||||
|
|
||||||
string regionName = m_scene.RegionInfo.RegionName;
|
string regionName = m_scene.RegionInfo.RegionName;
|
||||||
ScenePresence avatar = m_scene.GetScenePresence(agentID);
|
ScenePresence avatar = m_scene.GetScenePresence(agentID);
|
||||||
|
@ -207,8 +207,6 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
|
|
||||||
return "<llsd>undef</llsd>";
|
return "<llsd>undef</llsd>";
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -282,8 +280,6 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
|
|
||||||
return "<llsd>undef</llsd>";
|
return "<llsd>undef</llsd>";
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,32 @@ namespace OpenSim.Region.Environment.Modules.ExportSerialiser
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public void SaveSerialisedToFile(string fileName, Scene scene)
|
public void SaveSerialisedToFile(string fileName, Scene scene)
|
||||||
|
{
|
||||||
|
string xmlstream = GetObjectXml(scene);
|
||||||
|
|
||||||
|
MemoryStream stream = ReformatXmlString(xmlstream);
|
||||||
|
|
||||||
|
stream.Seek(0, SeekOrigin.Begin);
|
||||||
|
CreateXmlFile(stream, fileName);
|
||||||
|
|
||||||
|
stream.Seek(0, SeekOrigin.Begin);
|
||||||
|
CreateCompressedXmlFile(stream, fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static MemoryStream ReformatXmlString(string xmlstream)
|
||||||
|
{
|
||||||
|
MemoryStream stream = new MemoryStream();
|
||||||
|
XmlTextWriter formatter = new XmlTextWriter(stream, Encoding.UTF8);
|
||||||
|
XmlDocument doc = new XmlDocument();
|
||||||
|
|
||||||
|
doc.LoadXml(xmlstream);
|
||||||
|
formatter.Formatting = Formatting.Indented;
|
||||||
|
doc.WriteContentTo(formatter);
|
||||||
|
formatter.Flush();
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetObjectXml(Scene scene)
|
||||||
{
|
{
|
||||||
string xmlstream = "<scene>";
|
string xmlstream = "<scene>";
|
||||||
|
|
||||||
|
@ -69,29 +95,25 @@ namespace OpenSim.Region.Environment.Modules.ExportSerialiser
|
||||||
xmlstream += xml;
|
xmlstream += xml;
|
||||||
|
|
||||||
xmlstream += "</scene>";
|
xmlstream += "</scene>";
|
||||||
|
return xmlstream;
|
||||||
|
}
|
||||||
|
|
||||||
MemoryStream stream = new MemoryStream();
|
private static void CreateXmlFile(MemoryStream xmlStream, string fileName)
|
||||||
XmlTextWriter formatter = new XmlTextWriter(stream, Encoding.UTF8);
|
{
|
||||||
XmlDocument doc = new XmlDocument();
|
|
||||||
|
|
||||||
doc.LoadXml(xmlstream);
|
|
||||||
formatter.Formatting = Formatting.Indented;
|
|
||||||
doc.WriteContentTo(formatter);
|
|
||||||
formatter.Flush();
|
|
||||||
|
|
||||||
stream.Seek(0, SeekOrigin.Begin);
|
|
||||||
|
|
||||||
FileStream objectsFile = new FileStream(fileName, FileMode.Create);
|
FileStream objectsFile = new FileStream(fileName, FileMode.Create);
|
||||||
|
|
||||||
stream.WriteTo(objectsFile);
|
xmlStream.WriteTo(objectsFile);
|
||||||
objectsFile.Flush();
|
objectsFile.Flush();
|
||||||
objectsFile.Close();
|
objectsFile.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CreateCompressedXmlFile(MemoryStream xmlStream, string fileName)
|
||||||
|
{
|
||||||
#region GZip Compressed Version
|
#region GZip Compressed Version
|
||||||
FileStream objectsFileCompressed = new FileStream(fileName + ".gzs", FileMode.Create);
|
FileStream objectsFileCompressed = new FileStream(fileName + ".gzs", FileMode.Create);
|
||||||
MemoryStream gzipMSStream = new MemoryStream();
|
MemoryStream gzipMSStream = new MemoryStream();
|
||||||
GZipStream gzipStream = new GZipStream(gzipMSStream, CompressionMode.Compress);
|
GZipStream gzipStream = new GZipStream(gzipMSStream, CompressionMode.Compress);
|
||||||
stream.WriteTo(gzipStream);
|
xmlStream.WriteTo(gzipStream);
|
||||||
gzipMSStream.WriteTo(objectsFileCompressed);
|
gzipMSStream.WriteTo(objectsFileCompressed);
|
||||||
objectsFileCompressed.Flush();
|
objectsFileCompressed.Flush();
|
||||||
objectsFileCompressed.Close();
|
objectsFileCompressed.Close();
|
||||||
|
|
Loading…
Reference in New Issue