From 01c0af63e91133de6323d5fb2bb3b71f3a031833 Mon Sep 17 00:00:00 2001 From: Vincent Sylvester Date: Mon, 13 Feb 2023 11:30:33 +0100 Subject: [PATCH 1/3] Some dotnet6 sugar --- .../Modules/SearchModule/OpenSearch.cs | 309 ++++++++++-------- 1 file changed, 165 insertions(+), 144 deletions(-) diff --git a/OpenSimSearch/Modules/SearchModule/OpenSearch.cs b/OpenSimSearch/Modules/SearchModule/OpenSearch.cs index 2fba409..584c9c5 100644 --- a/OpenSimSearch/Modules/SearchModule/OpenSearch.cs +++ b/OpenSimSearch/Modules/SearchModule/OpenSearch.cs @@ -37,7 +37,7 @@ public class OpenSearchModule : ISearchModule, ISharedRegionModule // // Module vars // - private List m_Scenes = new List(); + private List m_Scenes = new(); private string m_SearchServer = ""; private bool m_Enabled = true; @@ -46,7 +46,7 @@ public void Initialise(IConfigSource config) { IConfig searchConfig = config.Configs["Search"]; - if (searchConfig == null) + if (searchConfig is null) { m_Enabled = false; return; @@ -149,14 +149,16 @@ private void OnNewClient(IClientAPI client) // private Hashtable GenericXMLRPCRequest(Hashtable ReqParams, string method) { - ArrayList SendParams = new ArrayList(); - SendParams.Add(ReqParams); + ArrayList SendParams = new() + { + ReqParams + }; // Send Request XmlRpcResponse Resp; try { - XmlRpcRequest Req = new XmlRpcRequest(method, SendParams); + XmlRpcRequest Req = new(method, SendParams); Resp = Req.Send(m_SearchServer, 30000); } catch (WebException ex) @@ -164,10 +166,12 @@ private Hashtable GenericXMLRPCRequest(Hashtable ReqParams, string method) m_log.ErrorFormat("[SEARCH]: Unable to connect to Search " + "Server {0}. Exception {1}", m_SearchServer, ex); - Hashtable ErrorHash = new Hashtable(); - ErrorHash["success"] = false; - ErrorHash["errorMessage"] = "Unable to search at this time. "; - ErrorHash["errorURI"] = ""; + Hashtable ErrorHash = new() + { + ["success"] = false, + ["errorMessage"] = "Unable to search at this time. ", + ["errorURI"] = "" + }; return ErrorHash; } @@ -177,10 +181,12 @@ private Hashtable GenericXMLRPCRequest(Hashtable ReqParams, string method) "[SEARCH]: Unable to connect to Search Server {0}. " + "Exception {1}", m_SearchServer, ex); - Hashtable ErrorHash = new Hashtable(); - ErrorHash["success"] = false; - ErrorHash["errorMessage"] = "Unable to search at this time. "; - ErrorHash["errorURI"] = ""; + Hashtable ErrorHash = new() + { + ["success"] = false, + ["errorMessage"] = "Unable to search at this time. ", + ["errorURI"] = "" + }; return ErrorHash; } @@ -190,19 +196,23 @@ private Hashtable GenericXMLRPCRequest(Hashtable ReqParams, string method) "[SEARCH]: Unable to connect to Search Server {0}. " + "Exception {1}", m_SearchServer, ex); - Hashtable ErrorHash = new Hashtable(); - ErrorHash["success"] = false; - ErrorHash["errorMessage"] = "Unable to search at this time. "; - ErrorHash["errorURI"] = ""; + Hashtable ErrorHash = new() + { + ["success"] = false, + ["errorMessage"] = "Unable to search at this time. ", + ["errorURI"] = "" + }; return ErrorHash; } if (Resp.IsFault) { - Hashtable ErrorHash = new Hashtable(); - ErrorHash["success"] = false; - ErrorHash["errorMessage"] = "Unable to search at this time. "; - ErrorHash["errorURI"] = ""; + Hashtable ErrorHash = new() + { + ["success"] = false, + ["errorMessage"] = "Unable to search at this time. ", + ["errorURI"] = "" + }; return ErrorHash; } Hashtable RespData = (Hashtable)Resp.Value; @@ -214,20 +224,20 @@ protected void DirPlacesQuery(IClientAPI remoteClient, UUID queryID, string queryText, int queryFlags, int category, string simName, int queryStart) { - Hashtable ReqHash = new Hashtable(); - ReqHash["text"] = queryText; - ReqHash["flags"] = queryFlags.ToString(); - ReqHash["category"] = category.ToString(); - ReqHash["sim_name"] = simName; - ReqHash["query_start"] = queryStart.ToString(); + Hashtable ReqHash = new() + { + ["text"] = queryText, + ["flags"] = queryFlags.ToString(), + ["category"] = category.ToString(), + ["sim_name"] = simName, + ["query_start"] = queryStart.ToString() + }; - Hashtable result = GenericXMLRPCRequest(ReqHash, - "dir_places_query"); + Hashtable result = GenericXMLRPCRequest(ReqHash, "dir_places_query"); if (!Convert.ToBoolean(result["success"])) { - remoteClient.SendAgentAlertMessage( - result["errorMessage"].ToString(), false); + remoteClient.SendAgentAlertMessage(result["errorMessage"].ToString(), false); return; } @@ -245,12 +255,14 @@ protected void DirPlacesQuery(IClientAPI remoteClient, UUID queryID, { Hashtable d = (Hashtable)o; - data[i] = new DirPlacesReplyData(); - data[i].parcelID = new UUID(d["parcel_id"].ToString()); - data[i].name = d["name"].ToString(); - data[i].forSale = Convert.ToBoolean(d["for_sale"]); - data[i].auction = Convert.ToBoolean(d["auction"]); - data[i].dwell = Convert.ToSingle(d["dwell"]); + data[i] = new DirPlacesReplyData + { + parcelID = new UUID(d["parcel_id"].ToString()), + name = d["name"].ToString(), + forSale = Convert.ToBoolean(d["for_sale"]), + auction = Convert.ToBoolean(d["auction"]), + dwell = Convert.ToSingle(d["dwell"]) + }; if (++i >= count) break; @@ -261,16 +273,16 @@ protected void DirPlacesQuery(IClientAPI remoteClient, UUID queryID, public void DirPopularQuery(IClientAPI remoteClient, UUID queryID, uint queryFlags) { - Hashtable ReqHash = new Hashtable(); - ReqHash["flags"] = queryFlags.ToString(); + Hashtable ReqHash = new() + { + ["flags"] = queryFlags.ToString() + }; - Hashtable result = GenericXMLRPCRequest(ReqHash, - "dir_popular_query"); + Hashtable result = GenericXMLRPCRequest(ReqHash, "dir_popular_query"); if (!Convert.ToBoolean(result["success"])) { - remoteClient.SendAgentAlertMessage( - result["errorMessage"].ToString(), false); + remoteClient.SendAgentAlertMessage(result["errorMessage"].ToString(), false); return; } @@ -288,10 +300,12 @@ public void DirPopularQuery(IClientAPI remoteClient, UUID queryID, uint queryFla { Hashtable d = (Hashtable)o; - data[i] = new DirPopularReplyData(); - data[i].parcelID = new UUID(d["parcel_id"].ToString()); - data[i].name = d["name"].ToString(); - data[i].dwell = Convert.ToSingle(d["dwell"]); + data[i] = new DirPopularReplyData + { + parcelID = new UUID(d["parcel_id"].ToString()), + name = d["name"].ToString(), + dwell = Convert.ToSingle(d["dwell"]) + }; if (++i >= count) break; @@ -304,20 +318,20 @@ public void DirLandQuery(IClientAPI remoteClient, UUID queryID, uint queryFlags, uint searchType, int price, int area, int queryStart) { - Hashtable ReqHash = new Hashtable(); - ReqHash["flags"] = queryFlags.ToString(); - ReqHash["type"] = searchType.ToString(); - ReqHash["price"] = price.ToString(); - ReqHash["area"] = area.ToString(); - ReqHash["query_start"] = queryStart.ToString(); + Hashtable ReqHash = new() + { + ["flags"] = queryFlags.ToString(), + ["type"] = searchType.ToString(), + ["price"] = price.ToString(), + ["area"] = area.ToString(), + ["query_start"] = queryStart.ToString() + }; - Hashtable result = GenericXMLRPCRequest(ReqHash, - "dir_land_query"); + Hashtable result = GenericXMLRPCRequest(ReqHash, "dir_land_query"); if (!Convert.ToBoolean(result["success"])) { - remoteClient.SendAgentAlertMessage( - result["errorMessage"].ToString(), false); + remoteClient.SendAgentAlertMessage(result["errorMessage"].ToString(), false); return; } @@ -348,13 +362,15 @@ public void DirLandQuery(IClientAPI remoteClient, UUID queryID, if (d["name"] == null) continue; - data[i] = new DirLandReplyData(); - data[i].parcelID = new UUID(d["parcel_id"].ToString()); - data[i].name = d["name"].ToString(); - data[i].auction = Convert.ToBoolean(d["auction"]); - data[i].forSale = Convert.ToBoolean(d["for_sale"]); - data[i].salePrice = Convert.ToInt32(d["sale_price"]); - data[i].actualArea = Convert.ToInt32(d["area"]); + data[i] = new DirLandReplyData + { + parcelID = new UUID(d["parcel_id"].ToString()), + name = d["name"].ToString(), + auction = Convert.ToBoolean(d["auction"]), + forSale = Convert.ToBoolean(d["for_sale"]), + salePrice = Convert.ToInt32(d["sale_price"]), + actualArea = Convert.ToInt32(d["area"]) + }; if (++i >= count) break; @@ -377,18 +393,18 @@ public void DirFindQuery(IClientAPI remoteClient, UUID queryID, public void DirEventsQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart) { - Hashtable ReqHash = new Hashtable(); - ReqHash["text"] = queryText; - ReqHash["flags"] = queryFlags.ToString(); - ReqHash["query_start"] = queryStart.ToString(); + Hashtable ReqHash = new() + { + ["text"] = queryText, + ["flags"] = queryFlags.ToString(), + ["query_start"] = queryStart.ToString() + }; - Hashtable result = GenericXMLRPCRequest(ReqHash, - "dir_events_query"); + Hashtable result = GenericXMLRPCRequest(ReqHash, "dir_events_query"); if (!Convert.ToBoolean(result["success"])) { - remoteClient.SendAgentAlertMessage( - result["errorMessage"].ToString(), false); + remoteClient.SendAgentAlertMessage(result["errorMessage"].ToString(), false); return; } @@ -406,13 +422,15 @@ public void DirEventsQuery(IClientAPI remoteClient, UUID queryID, { Hashtable d = (Hashtable)o; - data[i] = new DirEventsReplyData(); - data[i].ownerID = new UUID(d["owner_id"].ToString()); - data[i].name = d["name"].ToString(); - data[i].eventID = Convert.ToUInt32(d["event_id"]); - data[i].date = d["date"].ToString(); - data[i].unixTime = Convert.ToUInt32(d["unix_time"]); - data[i].eventFlags = Convert.ToUInt32(d["event_flags"]); + data[i] = new DirEventsReplyData + { + ownerID = new UUID(d["owner_id"].ToString()), + name = d["name"].ToString(), + eventID = Convert.ToUInt32(d["event_id"]), + date = d["date"].ToString(), + unixTime = Convert.ToUInt32(d["unix_time"]), + eventFlags = Convert.ToUInt32(d["event_flags"]) + }; if (++i >= count) break; @@ -425,19 +443,19 @@ public void DirClassifiedQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, uint category, int queryStart) { - Hashtable ReqHash = new Hashtable(); - ReqHash["text"] = queryText; - ReqHash["flags"] = queryFlags.ToString(); - ReqHash["category"] = category.ToString(); - ReqHash["query_start"] = queryStart.ToString(); + Hashtable ReqHash = new() + { + ["text"] = queryText, + ["flags"] = queryFlags.ToString(), + ["category"] = category.ToString(), + ["query_start"] = queryStart.ToString() + }; - Hashtable result = GenericXMLRPCRequest(ReqHash, - "dir_classified_query"); + Hashtable result = GenericXMLRPCRequest(ReqHash, "dir_classified_query"); if (!Convert.ToBoolean(result["success"])) { - remoteClient.SendAgentAlertMessage( - result["errorMessage"].ToString(), false); + remoteClient.SendAgentAlertMessage(result["errorMessage"].ToString(), false); return; } @@ -455,13 +473,15 @@ public void DirClassifiedQuery(IClientAPI remoteClient, UUID queryID, { Hashtable d = (Hashtable)o; - data[i] = new DirClassifiedReplyData(); - data[i].classifiedID = new UUID(d["classifiedid"].ToString()); - data[i].name = d["name"].ToString(); - data[i].classifiedFlags = Convert.ToByte(d["classifiedflags"]); - data[i].creationDate = Convert.ToUInt32(d["creation_date"]); - data[i].expirationDate = Convert.ToUInt32(d["expiration_date"]); - data[i].price = Convert.ToInt32(d["priceforlisting"]); + data[i] = new DirClassifiedReplyData + { + classifiedID = new UUID(d["classifiedid"].ToString()), + name = d["name"].ToString(), + classifiedFlags = Convert.ToByte(d["classifiedflags"]), + creationDate = Convert.ToUInt32(d["creation_date"]), + expirationDate = Convert.ToUInt32(d["expiration_date"]), + price = Convert.ToInt32(d["priceforlisting"]) + }; if (++i >= count) break; @@ -472,16 +492,16 @@ public void DirClassifiedQuery(IClientAPI remoteClient, UUID queryID, public void EventInfoRequest(IClientAPI remoteClient, uint queryEventID) { - Hashtable ReqHash = new Hashtable(); - ReqHash["eventID"] = queryEventID.ToString(); + Hashtable ReqHash = new() + { + ["eventID"] = queryEventID.ToString() + }; - Hashtable result = GenericXMLRPCRequest(ReqHash, - "event_info_query"); + Hashtable result = GenericXMLRPCRequest(ReqHash, "event_info_query"); if (!Convert.ToBoolean(result["success"])) { - remoteClient.SendAgentAlertMessage( - result["errorMessage"].ToString(), false); + remoteClient.SendAgentAlertMessage(result["errorMessage"].ToString(), false); return; } @@ -498,18 +518,20 @@ public void EventInfoRequest(IClientAPI remoteClient, uint queryEventID) } Hashtable d = (Hashtable)dataArray[0]; - EventData data = new EventData(); - data.eventID = Convert.ToUInt32(d["event_id"]); - data.creator = d["creator"].ToString(); - data.name = d["name"].ToString(); - data.category = d["category"].ToString(); - data.description = d["description"].ToString(); - data.date = d["date"].ToString(); - data.dateUTC = Convert.ToUInt32(d["dateUTC"]); - data.duration = Convert.ToUInt32(d["duration"]); - data.cover = Convert.ToUInt32(d["covercharge"]); - data.amount = Convert.ToUInt32(d["coveramount"]); - data.simName = d["simname"].ToString(); + EventData data = new() + { + eventID = Convert.ToUInt32(d["event_id"]), + creator = d["creator"].ToString(), + name = d["name"].ToString(), + category = d["category"].ToString(), + description = d["description"].ToString(), + date = d["date"].ToString(), + dateUTC = Convert.ToUInt32(d["dateUTC"]), + duration = Convert.ToUInt32(d["duration"]), + cover = Convert.ToUInt32(d["covercharge"]), + amount = Convert.ToUInt32(d["coveramount"]), + simName = d["simname"].ToString() + }; Vector3.TryParse(d["globalposition"].ToString(), out data.globalPos); data.eventFlags = Convert.ToUInt32(d["eventflags"]); @@ -518,16 +540,16 @@ public void EventInfoRequest(IClientAPI remoteClient, uint queryEventID) public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClient) { - Hashtable ReqHash = new Hashtable(); - ReqHash["classifiedID"] = queryClassifiedID.ToString(); + Hashtable ReqHash = new() + { + ["classifiedID"] = queryClassifiedID.ToString() + }; - Hashtable result = GenericXMLRPCRequest(ReqHash, - "classifieds_info_query"); + Hashtable result = GenericXMLRPCRequest(ReqHash, "classifieds_info_query"); if (!Convert.ToBoolean(result["success"])) { - remoteClient.SendAgentAlertMessage( - result["errorMessage"].ToString(), false); + remoteClient.SendAgentAlertMessage(result["errorMessage"].ToString(), false); return; } @@ -547,7 +569,7 @@ public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClien Hashtable d = (Hashtable)dataArray[0]; - Vector3 globalPos = new Vector3(); + Vector3 globalPos = new(); Vector3.TryParse(d["posglobal"].ToString(), out globalPos); remoteClient.SendClassifiedInfoReply( @@ -576,22 +598,21 @@ public void HandleMapItemRequest(IClientAPI remoteClient, uint flags, //defined in OpenMetaverse/GridManager.cs of libopenmetaverse. if (itemtype == (uint)OpenMetaverse.GridItemType.LandForSale) { - Hashtable ReqHash = new Hashtable(); - - //The flags are: SortAsc (1 << 15), PerMeterSort (1 << 17) - ReqHash["flags"] = "163840"; - ReqHash["type"] = "4294967295"; //This is -1 in 32 bits - ReqHash["price"] = "0"; - ReqHash["area"] = "0"; - ReqHash["query_start"] = "0"; + Hashtable ReqHash = new() + { + //The flags are: SortAsc (1 << 15), PerMeterSort (1 << 17) + ["flags"] = "163840", + ["type"] = "4294967295", //This is -1 in 32 bits + ["price"] = "0", + ["area"] = "0", + ["query_start"] = "0" + }; - Hashtable result = GenericXMLRPCRequest(ReqHash, - "dir_land_query"); + Hashtable result = GenericXMLRPCRequest(ReqHash, "dir_land_query"); if (!Convert.ToBoolean(result["success"])) { - remoteClient.SendAgentAlertMessage( - result["errorMessage"].ToString(), false); + remoteClient.SendAgentAlertMessage(result["errorMessage"].ToString(), false); return; } @@ -601,7 +622,7 @@ public void HandleMapItemRequest(IClientAPI remoteClient, uint flags, if (count > 100) count = 101; - List mapitems = new List(); + List mapitems = new(); string ParcelRegionUUID; string[] landingpoint; @@ -612,7 +633,7 @@ public void HandleMapItemRequest(IClientAPI remoteClient, uint flags, if (d["name"] == null) continue; - mapItemReply mapitem = new mapItemReply(); + mapItemReply mapitem = new(); ParcelRegionUUID = d["region_UUID"].ToString(); @@ -646,7 +667,6 @@ public void HandleMapItemRequest(IClientAPI remoteClient, uint flags, itemtype == (uint)OpenMetaverse.GridItemType.MatureEvent || itemtype == (uint)OpenMetaverse.GridItemType.AdultEvent) { - Hashtable ReqHash = new Hashtable(); //Find the maturity level int maturity = (1 << 24); @@ -666,23 +686,24 @@ public void HandleMapItemRequest(IClientAPI remoteClient, uint flags, //When character before | is a u get upcoming/in-progress events //Character before | is number of days before/after current date //Characters after | is the number for a category - ReqHash["text"] = "u|0"; - ReqHash["flags"] = maturity.ToString(); - ReqHash["query_start"] = "0"; + Hashtable ReqHash = new() + { + ["text"] = "u|0", + ["flags"] = maturity.ToString(), + ["query_start"] = "0" + }; - Hashtable result = GenericXMLRPCRequest(ReqHash, - "dir_events_query"); + Hashtable result = GenericXMLRPCRequest(ReqHash, "dir_events_query"); if (!Convert.ToBoolean(result["success"])) { - remoteClient.SendAgentAlertMessage( - result["errorMessage"].ToString(), false); + remoteClient.SendAgentAlertMessage(result["errorMessage"].ToString(), false); return; } ArrayList dataArray = (ArrayList)result["data"]; - List mapitems = new List(); + List mapitems = new(); int event_id; string[] landingpoint; @@ -693,7 +714,7 @@ public void HandleMapItemRequest(IClientAPI remoteClient, uint flags, if (d["name"] == null) continue; - mapItemReply mapitem = new mapItemReply(); + mapItemReply mapitem = new(); //Events use a comma separator in the landing point landingpoint = d["landing_point"].ToString().Split(','); From 9a906089337d512dc6907228a20a77dbc6155dcb Mon Sep 17 00:00:00 2001 From: Vincent Sylvester Date: Mon, 13 Feb 2023 11:47:07 +0100 Subject: [PATCH 2/3] Adjust prebuild and some more sugar --- .../Modules/SearchModule/OpenSearch.cs | 31 ++++++------------- OpenSimSearch/prebuild.xml | 8 ++--- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/OpenSimSearch/Modules/SearchModule/OpenSearch.cs b/OpenSimSearch/Modules/SearchModule/OpenSearch.cs index 584c9c5..14689cc 100644 --- a/OpenSimSearch/Modules/SearchModule/OpenSearch.cs +++ b/OpenSimSearch/Modules/SearchModule/OpenSearch.cs @@ -243,9 +243,7 @@ protected void DirPlacesQuery(IClientAPI remoteClient, UUID queryID, ArrayList dataArray = (ArrayList)result["data"]; - int count = dataArray.Count; - if (count > 100) - count = 101; + int count = (dataArray.Count > 100) ? 101 : dataArray.Count; DirPlacesReplyData[] data = new DirPlacesReplyData[count]; @@ -288,9 +286,7 @@ public void DirPopularQuery(IClientAPI remoteClient, UUID queryID, uint queryFla ArrayList dataArray = (ArrayList)result["data"]; - int count = dataArray.Count; - if (count > 100) - count = 101; + int count = (dataArray.Count > 100) ? 101 : dataArray.Count; DirPopularReplyData[] data = new DirPopularReplyData[count]; @@ -344,12 +340,11 @@ public void DirLandQuery(IClientAPI remoteClient, UUID queryID, { Hashtable d = (Hashtable)o; - if (d["name"] != null) + if (d["name"] is not null) ++count; } - if (count > 100) - count = 101; + count = (count > 100) ? 101 : count; DirLandReplyData[] data = new DirLandReplyData[count]; @@ -359,7 +354,7 @@ public void DirLandQuery(IClientAPI remoteClient, UUID queryID, { Hashtable d = (Hashtable)o; - if (d["name"] == null) + if (d["name"] is null) continue; data[i] = new DirLandReplyData @@ -410,9 +405,7 @@ public void DirEventsQuery(IClientAPI remoteClient, UUID queryID, ArrayList dataArray = (ArrayList)result["data"]; - int count = dataArray.Count; - if (count > 100) - count = 101; + int count = (dataArray.Count > 100) ? 101 : dataArray.Count; DirEventsReplyData[] data = new DirEventsReplyData[count]; @@ -461,9 +454,7 @@ public void DirClassifiedQuery(IClientAPI remoteClient, UUID queryID, ArrayList dataArray = (ArrayList)result["data"]; - int count = dataArray.Count; - if (count > 100) - count = 101; + int count = (dataArray.Count > 100) ? 101 : dataArray.Count; DirClassifiedReplyData[] data = new DirClassifiedReplyData[count]; @@ -618,10 +609,6 @@ public void HandleMapItemRequest(IClientAPI remoteClient, uint flags, ArrayList dataArray = (ArrayList)result["data"]; - int count = dataArray.Count; - if (count > 100) - count = 101; - List mapitems = new(); string ParcelRegionUUID; string[] landingpoint; @@ -630,7 +617,7 @@ public void HandleMapItemRequest(IClientAPI remoteClient, uint flags, { Hashtable d = (Hashtable)o; - if (d["name"] == null) + if (d["name"] is null) continue; mapItemReply mapitem = new(); @@ -711,7 +698,7 @@ public void HandleMapItemRequest(IClientAPI remoteClient, uint flags, { Hashtable d = (Hashtable)o; - if (d["name"] == null) + if (d["name"] is null) continue; mapItemReply mapitem = new(); diff --git a/OpenSimSearch/prebuild.xml b/OpenSimSearch/prebuild.xml index 59945dd..106d72a 100644 --- a/OpenSimSearch/prebuild.xml +++ b/OpenSimSearch/prebuild.xml @@ -1,5 +1,5 @@ - + ../../../bin/ @@ -12,12 +12,12 @@ ../../../bin/ - - + + @@ -26,7 +26,7 @@ - + From 852aaf38c2d3392cacb7b8250e5b7d4a0f64123d Mon Sep 17 00:00:00 2001 From: Vincent Sylvester Date: Mon, 13 Feb 2023 11:54:09 +0100 Subject: [PATCH 3/3] Cosmetics --- OpenSimSearch/Modules/SearchModule/OpenSearch.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/OpenSimSearch/Modules/SearchModule/OpenSearch.cs b/OpenSimSearch/Modules/SearchModule/OpenSearch.cs index 14689cc..5f4247e 100644 --- a/OpenSimSearch/Modules/SearchModule/OpenSearch.cs +++ b/OpenSimSearch/Modules/SearchModule/OpenSearch.cs @@ -123,7 +123,7 @@ public string Name get { return "OpenSimSearch"; } } - public bool IsSharedModule + public static bool IsSharedModule { get { return true; } } @@ -523,7 +523,7 @@ public void EventInfoRequest(IClientAPI remoteClient, uint queryEventID) amount = Convert.ToUInt32(d["coveramount"]), simName = d["simname"].ToString() }; - Vector3.TryParse(d["globalposition"].ToString(), out data.globalPos); + data.globalPos = (Vector3.TryParse(d["globalposition"].ToString(), out data.globalPos)) ? data.globalPos : new(); data.eventFlags = Convert.ToUInt32(d["eventflags"]); remoteClient.SendEventInfoReply(data); @@ -560,8 +560,7 @@ public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClien Hashtable d = (Hashtable)dataArray[0]; - Vector3 globalPos = new(); - Vector3.TryParse(d["posglobal"].ToString(), out globalPos); + Vector3 globalPos = (Vector3.TryParse(d["posglobal"].ToString(), out globalPos)) ? globalPos : new(); remoteClient.SendClassifiedInfoReply( new UUID(d["classifieduuid"].ToString()),