/// <summary> /// Save the prims in the current scene to an xml file in OpenSimulator's current 'xml2' format /// </summary> /// <param name="filename"></param> public void SaveCurrentSceneToXml2(string filename) { IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface <IRegionSerialiserModule>(); if (serialiser != null) { serialiser.SavePrimsToXml2(CurrentOrFirstScene, filename); } }
protected string RegionPrims(IOSHttpResponse httpResponse, Scene scene, Vector3 min, Vector3 max) { httpResponse.SendChunked = true; httpResponse.ContentType = "text/xml"; IRegionSerialiserModule serialiser = scene.RequestModuleInterface <IRegionSerialiserModule>(); if (serialiser != null) { serialiser.SavePrimsToXml2(scene, new StreamWriter(httpResponse.OutputStream), min, max); } return(""); }
/// <summary> /// Serialize region data to XML2Format /// </summary> /// <param name="cmdparams"></param> protected void SaveXml2(string[] cmdparams) { if (cmdparams.Length > 2) { IRegionSerialiserModule serialiser = GetCurrentOrFirstScene().RequestModuleInterface <IRegionSerialiserModule>(); if (serialiser != null) { serialiser.SavePrimsToXml2(GetCurrentOrFirstScene(), cmdparams[2]); } } else { MainConsole.Instance.Warn("Wrong number of parameters!"); } }
/// <summary> /// Serialize region data to XML2Format /// </summary> /// <param name="module"></param> /// <param name="cmdparams"></param> protected void SaveXml2(string module, string[] cmdparams) { if (cmdparams.Length > 2) { IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface <IRegionSerialiserModule>(); if (serialiser != null) { serialiser.SavePrimsToXml2(CurrentOrFirstScene, cmdparams[2]); } } else { m_log.Warn("Wrong number of parameters!"); } }
public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { string resource = GetParam(path); string region = "DEFAULT"; if (resource != string.Empty) { string[] parts = resource.Split('/'); region = HttpUtility.UrlDecode(parts[1]); } m_log.DebugFormat("[PotamOS]: region is {0} ({1})", region, resource); Scene scene = m_Scenes[0]; if (region != "DEFAULT") { scene = m_Scenes.Find(s => s.RegionInfo.RegionName == region); if (scene == null) { m_log.WarnFormat("[PotamOS]: Requested region {0} not found here. Sending the first region.", region); scene = m_Scenes[0]; } } httpResponse.StatusCode = (int)OSHttpStatusCode.SuccessOk; httpResponse.ContentType = "application/xml"; httpResponse.AddHeader("Content-Encoding", "gzip"); IRegionSerialiserModule serial = scene.RequestModuleInterface <IRegionSerialiserModule>(); byte[] xml = new byte[0]; if (serial != null) { using (MemoryStream mem = new MemoryStream()) { using (GZipStream zip = new GZipStream(mem, CompressionMode.Compress)) using (TextWriter writer = new StreamWriter(zip)) { serial.SavePrimsToXml2(scene, writer, new Vector3(0.01f, 0.01f, 0.01f), new Vector3(1000, 1000, 1000)); } string xmlstr = Encoding.UTF8.GetString(mem.ToArray()); xml = mem.ToArray(); m_log.DebugFormat("[PotamOS]: size of xml scene is {0}", xml.Length); } } return(xml); }