public string CreateRegion(OSHttpRequest request, OSHttpResponse response) { RestXmlWriter rxw = new RestXmlWriter(new StringWriter()); rxw.WriteStartElement(String.Empty, "regions", String.Empty); foreach (Scene s in App.SceneManager.Scenes) { rxw.WriteStartElement(String.Empty, "uuid", String.Empty); rxw.WriteString(s.RegionInfo.RegionID.ToString()); rxw.WriteEndElement(); } rxw.WriteEndElement(); return(rxw.ToString()); }
public string GetHandlerRegions(OSHttpResponse httpResponse) { RestXmlWriter rxw = new RestXmlWriter(new StringWriter()); rxw.WriteStartElement(String.Empty, "regions", String.Empty); foreach (Scene s in App.SceneManager.Scenes) { rxw.WriteStartElement(String.Empty, "uuid", String.Empty); rxw.WriteString(s.RegionInfo.RegionID.ToString()); rxw.WriteEndElement(); } rxw.WriteEndElement(); return rxw.ToString(); }
protected string ShortRegionInfo(string key, string value) { RestXmlWriter rxw = new RestXmlWriter(new StringWriter()); if (String.IsNullOrEmpty(value) || String.IsNullOrEmpty(key)) { return(null); } rxw.WriteStartElement(String.Empty, "region", String.Empty); rxw.WriteStartElement(String.Empty, key, String.Empty); rxw.WriteString(value); rxw.WriteEndDocument(); return(rxw.ToString()); }
protected string RegionStats(IOSHttpResponse httpResponse, Scene scene) { int users = scene.GetRootAgentCount(); int objects = scene.Entities.Count - users; RestXmlWriter rxw = new RestXmlWriter(new StringWriter()); rxw.WriteStartElement(String.Empty, "region", String.Empty); rxw.WriteStartElement(String.Empty, "stats", String.Empty); rxw.WriteStartElement(String.Empty, "users", String.Empty); rxw.WriteString(users.ToString()); rxw.WriteEndElement(); rxw.WriteStartElement(String.Empty, "objects", String.Empty); rxw.WriteString(objects.ToString()); rxw.WriteEndElement(); rxw.WriteEndDocument(); return(rxw.ToString()); }
public string GetRegionInfoHandlerRegions(IOSHttpResponse httpResponse) { RestXmlWriter rxw = new RestXmlWriter(new StringWriter()); // regions info rxw.WriteStartElement(String.Empty, "regions", String.Empty); { // regions info: number of regions rxw.WriteStartAttribute(String.Empty, "number", String.Empty); rxw.WriteValue(App.SceneManager.Scenes.Count); rxw.WriteEndAttribute(); // regions info: max number of regions rxw.WriteStartAttribute(String.Empty, "max", String.Empty); if (App.ConfigSource.Source.Configs["RemoteAdmin"] != null) { rxw.WriteValue(App.ConfigSource.Source.Configs["RemoteAdmin"].GetInt("region_limit", -1)); } else { rxw.WriteValue(-1); } rxw.WriteEndAttribute(); // regions info: region foreach (Scene s in App.SceneManager.Scenes) { rxw.WriteStartElement(String.Empty, "region", String.Empty); rxw.WriteStartAttribute(String.Empty, "uuid", String.Empty); rxw.WriteString(s.RegionInfo.RegionID.ToString()); rxw.WriteEndAttribute(); rxw.WriteStartAttribute(String.Empty, "name", String.Empty); rxw.WriteString(s.RegionInfo.RegionName); rxw.WriteEndAttribute(); rxw.WriteStartAttribute(String.Empty, "x", String.Empty); rxw.WriteValue(s.RegionInfo.RegionLocX); rxw.WriteEndAttribute(); rxw.WriteStartAttribute(String.Empty, "y", String.Empty); rxw.WriteValue(s.RegionInfo.RegionLocY); rxw.WriteEndAttribute(); rxw.WriteStartAttribute(String.Empty, "external_hostname", String.Empty); rxw.WriteString(s.RegionInfo.ExternalHostName); rxw.WriteEndAttribute(); rxw.WriteStartAttribute(String.Empty, "ip", String.Empty); rxw.WriteString(s.RegionInfo.InternalEndPoint.ToString()); rxw.WriteEndAttribute(); int users = s.GetRootAgentCount(); rxw.WriteStartAttribute(String.Empty, "avatars", String.Empty); rxw.WriteValue(users); rxw.WriteEndAttribute(); rxw.WriteStartAttribute(String.Empty, "objects", String.Empty); rxw.WriteValue(s.Entities.Count - users); rxw.WriteEndAttribute(); rxw.WriteEndElement(); } } return(rxw.ToString()); }
public string GetRegionInfoHandlerRegions(IOSHttpResponse httpResponse) { RestXmlWriter rxw = new RestXmlWriter(new StringWriter()); // regions info rxw.WriteStartElement(String.Empty, "regions", String.Empty); { // regions info: number of regions rxw.WriteStartAttribute(String.Empty, "number", String.Empty); rxw.WriteValue(App.SceneManager.Scenes.Count); rxw.WriteEndAttribute(); // regions info: max number of regions rxw.WriteStartAttribute(String.Empty, "max", String.Empty); if (App.ConfigSource.Source.Configs["RemoteAdmin"] != null) { rxw.WriteValue(App.ConfigSource.Source.Configs["RemoteAdmin"].GetInt("region_limit", -1)); } else { rxw.WriteValue(-1); } rxw.WriteEndAttribute(); // regions info: region foreach (Scene s in App.SceneManager.Scenes) { rxw.WriteStartElement(String.Empty, "region", String.Empty); rxw.WriteStartAttribute(String.Empty, "uuid", String.Empty); rxw.WriteString(s.RegionInfo.RegionID.ToString()); rxw.WriteEndAttribute(); rxw.WriteStartAttribute(String.Empty, "name", String.Empty); rxw.WriteString(s.RegionInfo.RegionName); rxw.WriteEndAttribute(); rxw.WriteStartAttribute(String.Empty, "x", String.Empty); rxw.WriteValue(s.RegionInfo.RegionLocX); rxw.WriteEndAttribute(); rxw.WriteStartAttribute(String.Empty, "y", String.Empty); rxw.WriteValue(s.RegionInfo.RegionLocY); rxw.WriteEndAttribute(); rxw.WriteStartAttribute(String.Empty, "external_hostname", String.Empty); rxw.WriteString(s.RegionInfo.ExternalHostName); rxw.WriteEndAttribute(); rxw.WriteStartAttribute(String.Empty, "ip", String.Empty); rxw.WriteString(s.RegionInfo.InternalEndPoint.ToString()); rxw.WriteEndAttribute(); int users = s.GetRootAgentCount(); rxw.WriteStartAttribute(String.Empty, "avatars", String.Empty); rxw.WriteValue(users); rxw.WriteEndAttribute(); rxw.WriteStartAttribute(String.Empty, "objects", String.Empty); rxw.WriteValue(s.Entities.Count - users); rxw.WriteEndAttribute(); rxw.WriteEndElement(); } } return rxw.ToString(); }
protected string ShortRegionInfo(string key, string value) { RestXmlWriter rxw = new RestXmlWriter(new StringWriter()); if (String.IsNullOrEmpty(value) || String.IsNullOrEmpty(key)) return null; rxw.WriteStartElement(String.Empty, "region", String.Empty); rxw.WriteStartElement(String.Empty, key, String.Empty); rxw.WriteString(value); rxw.WriteEndDocument(); return rxw.ToString(); }
protected string RegionStats(OSHttpResponse httpResponse, Scene scene) { int users = scene.GetAvatars().Count; int objects = scene.Entities.Count - users; RestXmlWriter rxw = new RestXmlWriter(new StringWriter()); rxw.WriteStartElement(String.Empty, "region", String.Empty); rxw.WriteStartElement(String.Empty, "stats", String.Empty); rxw.WriteStartElement(String.Empty, "users", String.Empty); rxw.WriteString(users.ToString()); rxw.WriteEndElement(); rxw.WriteStartElement(String.Empty, "objects", String.Empty); rxw.WriteString(objects.ToString()); rxw.WriteEndElement(); rxw.WriteEndDocument(); return rxw.ToString(); }