public DirClassifiedReplyData[] FindClassifieds(string queryText, string category, uint queryFlags, int StartQuery) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["QUERYTEXT"] = queryText; sendData["CATEGORY"] = category; sendData["QUERYFLAGS"] = queryFlags; sendData["STARTQUERY"] = StartQuery; sendData["METHOD"] = "findclassifieds"; string reqString = WebUtils.BuildQueryString(sendData); List <DirClassifiedReplyData> Classifieds = new List <DirClassifiedReplyData>(); try { List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI"); Classifieds.AddRange(from m_ServerURI in m_ServerURIs select SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString) into reply where reply != string.Empty from object f in WebUtils.ParseXmlResponse(reply) select(KeyValuePair <string, object>) f into value where value.Value is Dictionary <string, object> select value.Value as Dictionary <string, object> into valuevalue select new DirClassifiedReplyData(valuevalue)); return(Classifieds.ToArray()); } catch (Exception e) { MainConsole.Instance.DebugFormat("[AuroraRemoteDirectoryServiceConnector]: Exception when contacting server: {0}", e); } return(Classifieds.ToArray()); }
public void RemoveTelehub(UUID regionID, ulong regionHandle) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["METHOD"] = "removetelehub"; string reqString = WebUtils.BuildQueryString(sendData); try { List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf(regionHandle.ToString(), "GridServerURI"); foreach (string m_ServerURI in m_ServerURIs) { SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString); } } catch (Exception e) { MainConsole.Instance.DebugFormat("[AuroraRemoteRegionConnector]: Exception when contacting server: {0}", e); } }
public virtual void CacheWearableData(UUID principalID, AvatarWearable cachedWearable) { Dictionary <string, object> sendData = new Dictionary <string, object>(); //sendData["SCOPEID"] = scopeID.ToString(); sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); sendData["METHOD"] = "cachewearabledata"; sendData["WEARABLES"] = OSDParser.SerializeJsonString(cachedWearable.Pack()); string reqString = WebUtils.BuildQueryString(sendData); // MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); try { List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("AvatarServerURI"); foreach (string m_ServerURI in serverURIs) { AsynchronousRestObjectRequester.MakeRequest("POST", m_ServerURI, reqString); } } catch (Exception e) { MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: Exception when contacting avatar server: {0}", e.Message); } }
public void UpdateLSLData(string token, string key, string value) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["token"] = token; sendData["key"] = key; sendData["value"] = value; sendData["METHOD"] = "updatelsldata"; string reqString = WebUtils.BuildQueryString(sendData); try { List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI"); foreach (string m_ServerURI in m_ServerURIs) { AsynchronousRestObjectRequester.MakeRequest("POST", m_ServerURI, reqString); } } catch (Exception e) { MainConsole.Instance.DebugFormat("[AuroraRemoteAssetConnector]: Exception when contacting server: {0}", e); } }
public void DeleteMute(UUID muteID, UUID PrincipalID) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["PRINCIPALID"] = PrincipalID.ToString(); sendData["MUTEID"] = muteID.ToString(); sendData["METHOD"] = "deletemute"; string reqString = WebUtils.BuildQueryString(sendData); try { List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf(PrincipalID.ToString(), "RemoteServerURI"); foreach (string m_ServerURI in m_ServerURIs) { AsynchronousRestObjectRequester.MakeRequest("POST", m_ServerURI + "/auroradata", reqString); } } catch (Exception e) { m_log.DebugFormat("[AuroraRemoteMuteListConnector]: Exception when contacting server: {0}", e.ToString()); } }
public EventData GetEventInfo(uint EventID) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["EVENTID"] = EventID; sendData["METHOD"] = "geteventinfo"; string reqString = WebUtils.BuildQueryString(sendData); try { List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI"); foreach (EventData eventdata in from m_ServerURI in m_ServerURIs select SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString) into reply where reply != string.Empty select WebUtils.ParseXmlResponse(reply) into replyData from object f in replyData select(KeyValuePair <string, object>) f into value where value.Value is Dictionary <string, object> select value.Value as Dictionary <string, object> into valuevalue select new EventData(valuevalue)) { return(eventdata); } } catch (Exception e) { MainConsole.Instance.DebugFormat("[AuroraRemoteDirectoryServiceConnector]: Exception when contacting server: {0}", e); } return(null); }
public uint GetMaxEventID() { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["METHOD"] = "GetMaxEventID"; string reqString = WebUtils.BuildQueryString(sendData); List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI"); foreach (string m_ServerURI in m_ServerURIs) { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if (replyData != null) { Dictionary <string, object> .ValueCollection replyvalues = replyData.Values; uint maxEventID = 0; foreach (object f in replyvalues.Where(f => uint.TryParse(f.ToString(), out maxEventID))) { break; } // Success return(maxEventID); } } } return(0); }
public DirLandReplyData[] FindLandForSale(string searchType, uint price, uint area, int StartQuery, uint Flags) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["SEARCHTYPE"] = searchType; sendData["PRICE"] = price; sendData["AREA"] = area; sendData["STARTQUERY"] = StartQuery; sendData["FLAGS"] = Flags; sendData["METHOD"] = "findlandforsale"; string reqString = WebUtils.BuildQueryString(sendData); List <DirLandReplyData> Land = new List <DirLandReplyData>(); try { List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI"); Land.AddRange(from m_ServerURI in m_ServerURIs select SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString) into reply where reply != string.Empty from object f in WebUtils.ParseXmlResponse(reply) select(KeyValuePair <string, object>) f into value where value.Value is Dictionary <string, object> select value.Value as Dictionary <string, object> into valuevalue select new DirLandReplyData(valuevalue)); return(Land.ToArray()); } catch (Exception e) { MainConsole.Instance.DebugFormat("[AuroraRemoteDirectoryServiceConnector]: Exception when contacting server: {0}", e); } return(Land.ToArray()); }
public DirEventsReplyData[] FindAllEventsInRegion(string regionName, int maturity) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["REGIONNAME"] = regionName; sendData["MATURITY"] = maturity; sendData["METHOD"] = "findeventsinregion"; string reqString = WebUtils.BuildQueryString(sendData); List <DirEventsReplyData> Events = new List <DirEventsReplyData>(); try { List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI"); Events.AddRange(from m_ServerURI in m_ServerURIs select SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString) into reply where reply != string.Empty from object f in WebUtils.ParseXmlResponse(reply) select(KeyValuePair <string, object>) f into value where value.Value is Dictionary <string, object> select value.Value as Dictionary <string, object> into valuevalue select new DirEventsReplyData(valuevalue)); return(Events.ToArray()); } catch (Exception e) { MainConsole.Instance.DebugFormat("[AuroraRemoteDirectoryServiceConnector]: Exception when contacting server: {0}", e); } return(Events.ToArray()); }
public bool IsMuted(UUID PrincipalID, UUID PossibleMuteID) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["PRINCIPALID"] = PrincipalID.ToString(); sendData["MUTEID"] = PossibleMuteID.ToString(); sendData["METHOD"] = "ismuted"; string reqString = WebUtils.BuildQueryString(sendData); try { List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf(PrincipalID.ToString(), "RemoteServerURI"); foreach (string m_ServerURI in m_ServerURIs) { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI + "/auroradata", reqString); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); return(bool.Parse(replyData["Muted"].ToString())); } } } catch (Exception e) { m_log.DebugFormat("[AuroraRemoteMuteListConnector]: Exception when contacting server: {0}", e.ToString()); } return(false); }
protected void InformNeighborOfChatMessage(OSChatMessage message, ChatSourceType type, GridRegion region, RegionInfo thisRegion) { string uri = MakeUri(region, "/region/" + thisRegion.RegionID + "/"); //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); // Fill it in Dictionary <string, object> args = new Dictionary <string, object>(); try { args = Util.OSDToDictionary(thisRegion.PackRegionInfoData()); } catch (Exception e) { m_log.Debug("[REST COMMS]: PackRegionInfoData failed with exception: " + e.Message); return; } args["MESSAGE"] = WebUtils.BuildQueryString(message.ToKVP()); args["TYPE"] = (int)type; args["METHOD"] = "inform_neighbors_of_chat_message"; string queryString = WebUtils.BuildQueryString(args); SynchronousRestFormsRequester.MakeRequest("POST", uri, queryString); }
protected List <GridRegion> DoGoodbyeNeighbourCall(GridRegion region, RegionInfo thisRegion) { List <GridRegion> informedRegions = new List <GridRegion>(); string uri = MakeUri(region, "/region/" + thisRegion.RegionID + "/"); //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); // Fill it in Dictionary <string, object> args = new Dictionary <string, object>(); try { args = PackRegionInfo(thisRegion, region.RegionID); } catch (Exception e) { m_log.Debug("[REST COMMS]: PackRegionInfoData failed with exception: " + e.Message); return(informedRegions); } args["METHOD"] = "inform_neighbors_region_is_down"; string queryString = WebUtils.BuildQueryString(args); string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, queryString); if (reply == "") { return(informedRegions); } Dictionary <string, object> response = WebUtils.ParseXmlResponse(reply); try { if (response == null) { return(informedRegions); } //Didn't inform, return now if (!response.ContainsKey("success") || response["success"].ToString() != "true") { return(informedRegions); } foreach (KeyValuePair <string, object> kvp in response) { if (kvp.Value is Dictionary <string, object> ) { Dictionary <string, object> r = kvp.Value as Dictionary <string, object>; GridRegion nregion = new GridRegion(r); informedRegions.Add(nregion); } } } catch (Exception ex) { m_log.Warn("[NeighborServiceConnector]: Failed to read response from neighbor " + ex.ToString()); } return(informedRegions); }
protected override void Render(HtmlTextWriter writer) { if (HttpContext.Current == null) { writer.Write("[" + this.ID + "]"); return; } string url = WebUtils.GetUrlWithoutQueryString(Context.Request.RawUrl) + "?skin=" + skinFileName + WebUtils.BuildQueryString(WebUtils.GetQueryString(Context.Request.RawUrl), "skin"); if (imageUrl.Length > 0) { writer.Write("<a href='{0}' title='{1}' rel='nofollow'><img alt='{1}' src='{2}' /></a>", Context.Server.HtmlEncode(url), Resource.PrinterFriendlyLink, Page.ResolveUrl(imageUrl)); } else { writer.Write("<a href='{0}' rel='nofollow'>{1}</a>", Context.Server.HtmlEncode(url), Resource.PrinterFriendlyLink); } }
public List <GridRegion> GetSafeRegions(UUID scopeID, int x, int y) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["SCOPEID"] = scopeID.ToString(); sendData["X"] = x.ToString(); sendData["Y"] = y.ToString(); sendData["METHOD"] = "get_safe_regions"; List <GridRegion> rinfos = new List <GridRegion>(); string reply = string.Empty; try { List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("GridServerURI"); foreach (string m_ServerURI in serverURIs) { reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, WebUtils.BuildQueryString(sendData)); //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); } } catch (Exception e) { m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); return(rinfos); } if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if (replyData != null) { Dictionary <string, object> .ValueCollection rinfosList = replyData.Values; foreach (object r in rinfosList) { if (r is Dictionary <string, object> ) { GridRegion rinfo = new GridRegion((Dictionary <string, object>)r); rinfos.Add(rinfo); } } } else { m_log.DebugFormat("[GRID CONNECTOR]: GetSafeRegions {0}, {1}-{2} received null response", scopeID, x, y); } } else { m_log.DebugFormat("[GRID CONNECTOR]: GetSafeRegions received null reply"); } return(rinfos); }
public List <GridRegion> GetRegionsByName(List <UUID> scopeIDs, string name, uint?start, uint?count) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["SCOPEID"] = GetScopeID(scopeIDs); sendData["NAME"] = name; sendData["MAX"] = count == null ? "0" : count.ToString(); sendData["METHOD"] = "get_regions_by_name"; List <GridRegion> rinfos = new List <GridRegion>(); string reply = string.Empty; List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("GridServerURI"); foreach (string uri in serverURIs) { try { reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, WebUtils.BuildQueryString(sendData)); } catch (Exception e) { MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message); return(rinfos); } if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if (replyData != null) { Dictionary <string, object> .ValueCollection rinfosList = replyData.Values; foreach (object r in rinfosList) { if (r is Dictionary <string, object> ) { GridRegion rinfo = new GridRegion(); rinfo.FromKVP((Dictionary <string, object>)r); rinfos.Add(rinfo); } } } else { MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0} received null response", name); } } else { MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: GetRegionsByName received null reply"); } } return(FixGridRegions(rinfos)); }
public FriendInfo[] GetFriends(UUID PrincipalID) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["PRINCIPALID"] = PrincipalID.ToString(); sendData["METHOD"] = "getfriends"; string reqString = WebUtils.BuildQueryString(sendData); List <FriendInfo> finfos = new List <FriendInfo>(); try { List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("FriendsServerURI"); foreach (Dictionary <string, object> replyData in from m_ServerURI in serverURIs select SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString) into reply where reply != string.Empty select WebUtils.ParseXmlResponse(reply)) { if (replyData != null) { if (replyData.ContainsKey("result") && (replyData["result"].ToString().ToLower() == "null")) { continue; } Dictionary <string, object> .ValueCollection finfosList = replyData.Values; //MainConsole.Instance.DebugFormat("[FRIENDS CONNECTOR]: get neighbours returned {0} elements", rinfosList.Count); foreach (object f in finfosList) { if (f is Dictionary <string, object> ) { FriendInfo finfo = new FriendInfo((Dictionary <string, object>)f); finfos.Add(finfo); } else { MainConsole.Instance.DebugFormat( "[FRIENDS CONNECTOR]: GetFriends {0} received invalid response type {1}", PrincipalID, f.GetType()); } } } else { MainConsole.Instance.DebugFormat("[FRIENDS CONNECTOR]: GetFriends {0} received null response", PrincipalID); } } } catch (Exception e) { MainConsole.Instance.DebugFormat("[FRIENDS CONNECTOR]: Exception when contacting friends server: {0}", e.Message); } // Success return(finfos.ToArray()); }
public bool StoreFriend(UUID PrincipalID, string Friend, int flags) { FriendInfo finfo = new FriendInfo { PrincipalID = PrincipalID, Friend = Friend, MyFlags = flags }; Dictionary <string, object> sendData = finfo.ToKeyValuePairs(); sendData["METHOD"] = "storefriend"; string reply = string.Empty; try { List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf(PrincipalID.ToString(), "FriendsServerURI"); foreach (string m_ServerURI in serverURIs) { reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, WebUtils.BuildQueryString(sendData)); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if ((replyData != null) && replyData.ContainsKey("Result") && (replyData["Result"] != null)) { bool success = false; Boolean.TryParse(replyData["Result"].ToString(), out success); if (replyData["Result"].ToString() == "Success") { return(true); } if (success) { return(success); } } else { MainConsole.Instance.DebugFormat("[FRIENDS CONNECTOR]: StoreFriend {0} {1} received null response", PrincipalID, Friend); } } else { MainConsole.Instance.DebugFormat("[FRIENDS CONNECTOR]: StoreFriend received null reply"); } } } catch (Exception e) { MainConsole.Instance.DebugFormat("[FRIENDS CONNECTOR]: Exception when contacting friends server: {0}", e.Message); return(false); } return(false); }
public bool SetAvatar(UUID userID, AvatarData avatar) { Dictionary <string, object> sendData = new Dictionary <string, object>(); //sendData["SCOPEID"] = scopeID.ToString(); sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); sendData["METHOD"] = "setavatar"; sendData["UserID"] = userID.ToString(); Dictionary <string, object> structData = avatar.ToKeyValuePairs(); foreach (KeyValuePair <string, object> kvp in structData) { sendData[kvp.Key] = kvp.Value.ToString(); } string reqString = WebUtils.BuildQueryString(sendData); //m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); try { List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("AvatarServerURI"); foreach (string m_ServerURI in serverURIs) { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if (replyData.ContainsKey("result")) { if (replyData["result"].ToString().ToLower() == "success") { return(true); } } else { m_log.DebugFormat("[AVATAR CONNECTOR]: SetAvatar reply data does not contain result field"); } } else { m_log.DebugFormat("[AVATAR CONNECTOR]: SetAvatar received empty reply"); } } } catch (Exception e) { m_log.DebugFormat("[AVATAR CONNECTOR]: Exception when contacting avatar server: {0}", e.Message); } return(false); }
public LandData GetParcelInfo(UUID InfoUUID) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["INFOUUID"] = InfoUUID.ToString(); sendData["METHOD"] = "getparcelinfo"; string reqString = WebUtils.BuildQueryString(sendData); try { List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI"); foreach (string m_ServerURI in m_ServerURIs) { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if (replyData != null) { Dictionary <string, object> .ValueCollection replyvalues = replyData.Values; LandData land = null; foreach (object f in replyvalues) { if (f is Dictionary <string, object> ) { land = new LandData(); land.FromKVP((Dictionary <string, object>)f); break; } else { m_log.DebugFormat("[AuroraRemoteDirectoryServiceConnector]: GetParcelInfo {0} received invalid response type {1}", InfoUUID, f.GetType()); } } // Success return(land); } else { m_log.DebugFormat("[AuroraRemoteDirectoryServiceConnector]: GetParcelInfo {0} received null response", InfoUUID); } } } } catch (Exception e) { m_log.DebugFormat("[AuroraRemoteDirectoryServiceConnector]: Exception when contacting server: {0}", e.ToString()); } return(null); }
public virtual GridRegion GetRegionByPosition(UUID scopeID, int x, int y) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["SCOPEID"] = scopeID.ToString(); sendData["X"] = x.ToString(); sendData["Y"] = y.ToString(); sendData["METHOD"] = "get_region_by_position"; string reply = string.Empty; GridRegion rinfo = null; try { List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("GridServerURI"); foreach (string m_ServerURI in serverURIs) { reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, WebUtils.BuildQueryString(sendData)); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if ((replyData != null) && (replyData["result"] != null)) { if (replyData["result"] is Dictionary <string, object> ) { rinfo = new GridRegion((Dictionary <string, object>)replyData["result"]); rinfo.GenericMap["URL"] = m_ServerURI; } //else // MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received no region", // scopeID, x, y); } else { MainConsole.Instance.DebugFormat( "[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received null response", scopeID, x, y); } } else { MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition received null reply"); } } } catch (Exception e) { MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); return(null); } return(rinfo); }
public virtual int GetRegionFlags(UUID scopeID, UUID regionID) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["SCOPEID"] = scopeID.ToString(); sendData["REGIONID"] = regionID.ToString(); sendData["METHOD"] = "get_region_flags"; int flags = -1; string reply = string.Empty; try { List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("GridServerURI"); foreach (string m_ServerURI in serverURIs) { reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, WebUtils.BuildQueryString(sendData)); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null)) { Int32.TryParse((string)replyData["result"], out flags); //else // MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: GetRegionFlags {0}, {1} received wrong type {2}", // scopeID, regionID, replyData["result"].GetType()); } else { MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: GetRegionFlags {0}, {1} received null response", scopeID, regionID); } } else { MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: GetRegionFlags received null reply"); } if (flags != -1) { return(flags); } } } catch (Exception e) { MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); return(-1); } return(flags); }
public GridRegion GetRegionByUUID(List <UUID> scopeIDs, UUID regionID) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["SCOPEID"] = GetScopeID(scopeIDs); sendData["REGIONID"] = regionID.ToString(); sendData["METHOD"] = "get_region_by_uuid"; string reply = string.Empty; List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("GridServerURI"); foreach (string uri in serverURIs) { try { reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, WebUtils.BuildQueryString(sendData)); } catch (Exception e) { MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message); return(null); } GridRegion rinfo = null; if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if ((replyData != null) && (replyData["result"] != null)) { if (replyData["result"] is Dictionary <string, object> ) { rinfo = new GridRegion(); rinfo.FromKVP((Dictionary <string, object>)replyData["result"]); return(FixGridRegion(rinfo)); } //else // MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received null response", // scopeID, regionID); } else { MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0} received null response", regionID); } } else { MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID received null reply"); } } return(null); }
public List <EstateSettings> GetEstates(UUID owner) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["SEARCH"] = owner; sendData["METHOD"] = "getestatesowner"; List <EstateSettings> Estates = new List <EstateSettings>(); string reqString = WebUtils.BuildQueryString(sendData); try { List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI"); foreach (string m_ServerURI in m_ServerURIs) { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if (replyData != null) { if (!replyData.ContainsKey("result")) { return(Estates); } foreach (object obj in replyData.Values) { if (obj is Dictionary <string, object> ) { Dictionary <string, object> dictionary = obj as Dictionary <string, object>; foreach (object objobj in dictionary.Values) { EstateSettings es = new EstateSettings(objobj as Dictionary <string, object>); Estates.Add(es); } } } return(Estates); } else { m_log.DebugFormat("[AuroraRemoteEstateConnector]: GetEstates {0} received null response", owner); } } } } catch (Exception e) { m_log.DebugFormat("[AuroraRemoteEstateConnector]: Exception when contacting server: {0}", e.ToString()); } return(null); }
public virtual List <GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["SCOPEID"] = scopeID.ToString(); sendData["NAME"] = name; sendData["MAX"] = maxNumber.ToString(); sendData["METHOD"] = "get_regions_by_name"; List <GridRegion> rinfos = new List <GridRegion>(); string reply = string.Empty; try { List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("GridServerURI"); foreach (string m_ServerURI in serverURIs) { reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, WebUtils.BuildQueryString(sendData)); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if (replyData != null) { Dictionary <string, object> .ValueCollection rinfosList = replyData.Values; foreach (object r in rinfosList) { if (r is Dictionary <string, object> ) { GridRegion rinfo = new GridRegion((Dictionary <string, object>)r); rinfo.GenericMap["URL"] = m_ServerURI; rinfos.Add(rinfo); } } } else { m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received null response", scopeID, name, maxNumber); } } else { m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName received null reply"); } } } catch (Exception e) { m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); return(rinfos); } return(rinfos); }
protected FriendInfo[] GetFriends(Dictionary <string, object> sendData, string PrincipalID) { string reqString = WebUtils.BuildQueryString(sendData); List <string> urls = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("AvatarServerURI"); foreach (string uri in urls) { try { string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if (replyData != null) { if (replyData.ContainsKey("result") && (replyData["result"].ToString().ToLower() == "null")) { return(new FriendInfo[0]); } List <FriendInfo> finfos = new List <FriendInfo>(); Dictionary <string, object> .ValueCollection finfosList = replyData.Values; //MainConsole.Instance.DebugFormat("[FRIENDS SERVICE CONNECTOR]: get neighbours returned {0} elements", rinfosList.Count); foreach (object f in finfosList) { if (f is Dictionary <string, object> ) { FriendInfo finfo = new FriendInfo((Dictionary <string, object>)f); finfos.Add(finfo); } else { MainConsole.Instance.DebugFormat("[FRIENDS SERVICE CONNECTOR]: GetFriends {0} received invalid response type {1}", PrincipalID, f.GetType()); } } // Success return(finfos.ToArray()); } else { MainConsole.Instance.DebugFormat("[FRIENDS SERVICE CONNECTOR]: GetFriends {0} received null response", PrincipalID); } } } catch (Exception e) { MainConsole.Instance.DebugFormat("[FRIENDS SERVICE CONNECTOR]: Exception when contacting friends server at {0}: {1}", uri, e.Message); } } return(new FriendInfo[0]); }
public bool LoadEstateSettings(UUID regionID, out EstateSettings settings) { Dictionary <string, object> sendData = new Dictionary <string, object>(); settings = null; //This DOES have a reason, the RemoteEstateService will not send back // the EstatePass anywhere (for security reasons), // so we need to save it so that we can restore it later. EstateSettings ES = new EstateSettings(); string Password = ES.EstatePass; sendData["REGIONID"] = regionID.ToString(); sendData["METHOD"] = "loadestatesettings"; string reqString = WebUtils.BuildQueryString(sendData); try { List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI"); foreach (string m_ServerURI in m_ServerURIs) { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if (replyData != null && (!replyData.ContainsKey("Result") || replyData["Result"].ToString() != "Failure")) { settings = new EstateSettings(replyData); settings.OnSave += SaveEstateSettings; settings.EstatePass = Password; //Restore it here, see above for explaination return(true); } else if (replyData.ContainsKey("Result") && replyData["Result"].ToString() == "Failure") { return(true); } else { m_log.DebugFormat("[AuroraRemoteEstateConnector]: LoadEstateSettings {0} received null response", regionID); } return(false); } } } catch (Exception e) { m_log.WarnFormat("[AuroraRemoteEstateConnector]: Exception when contacting server: {0}", e.ToString()); } return(false); }
private string RenderPrinter() { string url = WebUtils.GetUrlWithoutQueryString(Context.Request.RawUrl) + "?skin=printerfriendly" + WebUtils.BuildQueryString(WebUtils.GetQueryString(Context.Request.RawUrl), "skin"); return(string.Format("<a href='{0}' target='_blank' title='{1}' rel='nofollow'><span>{2}</span></a>", Context.Server.HtmlEncode(url), NewsResources.NewsPrintLink, NewsResources.NewsPrintLink)); }
public bool RemoveItems(UUID userID, string[] names) { Dictionary <string, object> sendData = new Dictionary <string, object>(); //sendData["SCOPEID"] = scopeID.ToString(); sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); sendData["METHOD"] = "removeitems"; sendData["UserID"] = userID.ToString(); sendData["Names"] = new List <string>(names); string reqString = WebUtils.BuildQueryString(sendData); List <string> urls = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("AvatarServerURI"); foreach (string uri in urls) { // MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); try { string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if (replyData.ContainsKey("result")) { if (replyData["result"].ToString().ToLower() == "success") { return(true); } else { return(false); } } else { MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: RemoveItems reply data does not contain result field"); } } else { MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: RemoveItems received empty reply"); } } catch (Exception e) { MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: Exception when contacting presence server at {0}: {1}", uri, e.Message); } } return(false); }
private void Cal1SelectionChanged(object sender, EventArgs e) { string redirectUrl = SiteRoot + "/EventCalendar/DayView.aspx?mid=" + this.ModuleId.ToString() + "&date=" + Page.Server.UrlEncode(cal1.SelectedDate.ToString("s")) + WebUtils.BuildQueryString("date"); WebUtils.SetupRedirect(this, redirectUrl); }
public List <GridRegion> GetNeighbors(List <UUID> scopeIDs, GridRegion region) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["SCOPEID"] = region.ScopeID.ToString(); sendData["REGIONID"] = region.RegionID.ToString(); sendData["METHOD"] = "get_neighbours"; List <GridRegion> rinfos = new List <GridRegion>(); string reqString = WebUtils.BuildQueryString(sendData); string reply = string.Empty; List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("GridServerURI"); foreach (string uri in serverURIs) { try { reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); } catch (Exception e) { MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message); return(rinfos); } Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if (replyData != null) { Dictionary <string, object> .ValueCollection rinfosList = replyData.Values; //MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: get neighbours returned {0} elements", rinfosList.Count); foreach (object r in rinfosList) { if (r is Dictionary <string, object> ) { GridRegion rinfo = new GridRegion(); rinfo.FromKVP((Dictionary <string, object>)r); rinfos.Add(rinfo); } } } else { MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: GetNeighbours {0}, {1} received null response", region.ScopeID, region.RegionID); } } return(FixGridRegions(rinfos)); }