From 2a5389cc673a0d9663dcc5b121e0137cba111e12 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 15 Mar 2026 04:45:37 +0000 Subject: [PATCH] cosmetics --- .../Janus/WebRtcJanusService.cs | 4 +- .../WebRtcVoiceRegionModule.cs | 16 ++--- .../HttpServer/WebsocketServerHandler.cs | 2 +- OpenSim/Framework/WebUtil.cs | 2 +- OpenSim/Region/Application/OpenSimBase.cs | 3 +- .../UserManagement/UserManagementModule.cs | 2 +- .../World/Archiver/ArchiveReadRequest.cs | 2 +- .../World/Archiver/AssetsRequest.cs | 2 +- .../World/Terrain/TerrainModule.cs | 6 +- .../Region/PhysicsModules/ubOde/ODEScene.cs | 4 +- .../Region/ScriptEngine/Shared/LSL_Types.cs | 2 +- .../Region/ScriptEngine/YEngine/XMREngine.cs | 2 +- .../Presence/PresenceServerConnector.cs | 1 + .../Presence/PresenceServerPostHandler.cs | 1 - .../Connectors/Estate/EstateDataConnector.cs | 2 +- .../Connectors/Land/LandServicesConnector.cs | 58 ++++++++++--------- .../HypergridService/GatekeeperService.cs | 2 +- 17 files changed, 57 insertions(+), 54 deletions(-) diff --git a/OpenSim/Addons/os-webrtc-janus/Janus/WebRtcJanusService.cs b/OpenSim/Addons/os-webrtc-janus/Janus/WebRtcJanusService.cs index 0291051492..a511a10b65 100644 --- a/OpenSim/Addons/os-webrtc-janus/Janus/WebRtcJanusService.cs +++ b/OpenSim/Addons/os-webrtc-janus/Janus/WebRtcJanusService.cs @@ -432,7 +432,7 @@ namespace osWebRtcVoice { // The client has finished sending candidates resp = await viewerSession.Session.TrickleCompleted(viewerSession).ConfigureAwait(false); - _log.DebugFormat($"{LogHeader} VoiceSignalingRequest: candidate completed"); + _log.Debug($"{LogHeader} VoiceSignalingRequest: candidate completed"); } else { @@ -483,7 +483,7 @@ namespace osWebRtcVoice } if (resp is null) { - _log.ErrorFormat($"{LogHeader} VoiceSignalingRequest: no response so returning error"); + _log.Error($"{LogHeader} VoiceSignalingRequest: no response so returning error"); ret = new OSDMap { { "response", "error" } diff --git a/OpenSim/Addons/os-webrtc-janus/WebRtcVoiceRegionModule/WebRtcVoiceRegionModule.cs b/OpenSim/Addons/os-webrtc-janus/WebRtcVoiceRegionModule/WebRtcVoiceRegionModule.cs index cc8f73bedb..71062c11d0 100644 --- a/OpenSim/Addons/os-webrtc-janus/WebRtcVoiceRegionModule/WebRtcVoiceRegionModule.cs +++ b/OpenSim/Addons/os-webrtc-janus/WebRtcVoiceRegionModule/WebRtcVoiceRegionModule.cs @@ -205,7 +205,7 @@ namespace osWebRtcVoice if(request.HttpMethod != "POST") { - m_log.DebugFormat($"[{logHeader}][ProvisionVoice]: Not a POST request. Agent={agentID}"); + m_log.Debug($"[{logHeader}][ProvisionVoice]: Not a POST request. Agent={agentID}"); response.StatusCode = (int)HttpStatusCode.NotFound; return; } @@ -231,7 +231,7 @@ namespace osWebRtcVoice } } - if (_MessageDetails) m_log.DebugFormat($"{logHeader}[ProvisionVoice]: request: {map}"); + if (_MessageDetails) m_log.Debug($"{logHeader}[ProvisionVoice]: request: {map}"); if (map.TryGetString("channel_type", out string channelType)) { @@ -308,7 +308,7 @@ namespace osWebRtcVoice if(resp is not null) { - if (_MessageDetails) m_log.DebugFormat($"{logHeader}[ProvisionVoice]: response: {resp}"); + if (_MessageDetails) m_log.Debug($"{logHeader}[ProvisionVoice]: response: {resp}"); // TODO: check for errors and package the response @@ -319,7 +319,7 @@ namespace osWebRtcVoice } else { - m_log.DebugFormat($"{logHeader}[ProvisionVoice]: got null response"); + m_log.Debug($"{logHeader}[ProvisionVoice]: got null response"); response.StatusCode = (int)HttpStatusCode.OK; } return; @@ -330,7 +330,7 @@ namespace osWebRtcVoice IWebRtcVoiceService voiceService = scene.RequestModuleInterface(); if (voiceService is null) { - m_log.ErrorFormat($"{logHeader}[VoiceSignalingRequest]: avatar \"{agentID}\": no voice service"); + m_log.Error($"{logHeader}[VoiceSignalingRequest]: avatar \"{agentID}\": no voice service"); response.StatusCode = (int)HttpStatusCode.NotFound; return; } @@ -346,7 +346,7 @@ namespace osWebRtcVoice OSDMap map = BodyToMap(request, "VoiceSignalingRequest"); if (map is null) { - m_log.ErrorFormat($"{logHeader}[VoiceSignalingRequest]: No request data found. Agent={agentID}"); + m_log.Error($"{logHeader}[VoiceSignalingRequest]: No request data found. Agent={agentID}"); response.StatusCode = (int)HttpStatusCode.NoContent; return; } @@ -384,7 +384,7 @@ namespace osWebRtcVoice /// public void ChatSessionRequest(IOSHttpRequest request, IOSHttpResponse response, UUID agentID, Scene scene) { - m_log.DebugFormat("{0}: ChatSessionRequest received for agent {1} in scene {2}", logHeader, agentID, scene.RegionInfo.RegionName); + m_log.Debug($"{logHeader}: ChatSessionRequest received for agent {agentID} in scene {scene.Name}"); if (request.HttpMethod != "POST") { response.StatusCode = (int)HttpStatusCode.NotFound; @@ -444,7 +444,7 @@ namespace osWebRtcVoice IEventQueue queue = scene.RequestModuleInterface(); if (queue is null) { - m_log.ErrorFormat("{0}: no event queue for scene {1}", logHeader, scene.RegionInfo.RegionName); + m_log.Error($"{logHeader}: no event queue for scene {scene.Name}"); response.StatusCode = (int)HttpStatusCode.InternalServerError; } else diff --git a/OpenSim/Framework/Servers/HttpServer/WebsocketServerHandler.cs b/OpenSim/Framework/Servers/HttpServer/WebsocketServerHandler.cs index a02946a9a1..5e589ba73f 100644 --- a/OpenSim/Framework/Servers/HttpServer/WebsocketServerHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/WebsocketServerHandler.cs @@ -355,7 +355,7 @@ namespace OpenSim.Framework.Servers.HttpServer /// Textual reason for the upgrade fail private void FailUpgrade(HttpStatusCode pCode, string pMessage ) { - string handshakeResponse = string.Format(HandshakeDeclineText, (int)pCode, pMessage.Replace("\n", string.Empty).Replace("\r", string.Empty)); + string handshakeResponse = string.Format(HandshakeDeclineText, (int)pCode, pMessage.ReplaceLineEndings(string.Empty)); byte[] bhandshakeResponse = Encoding.UTF8.GetBytes(handshakeResponse); _networkContext.Stream.Write(bhandshakeResponse, 0, bhandshakeResponse.Length); _networkContext.Stream.Flush(); diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index ad66364351..ed5cf8c0cc 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -1138,7 +1138,7 @@ namespace OpenSim.Framework } catch (Exception e) { - m_log.ErrorFormat($"[ASYNC REQUEST]: Request {verb} {requestUrl} callback failed with exception {e.Message}"); + m_log.Error($"[ASYNC REQUEST]: Request {verb} {requestUrl} callback failed with exception {e.Message}"); } }, null); diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 17b9cee2a9..543e5d2ea0 100755 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -617,8 +617,7 @@ namespace OpenSim } MainConsole.Instance.Output("Estate {0} has no owner set.", regionInfo.EstateSettings.EstateName); - List excluded = new List(new char[1]{' '}); - + List excluded = new([' ']); if (estateOwnerFirstName == null || estateOwnerLastName == null) { diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index f61bb12145..ed22f4eae8 100755 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -958,7 +958,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement { if (GetUser(userID, out UserData ud) && ud != null) { - if (ud.LastName.StartsWith("@")) + if (ud.LastName.StartsWith('@')) { string[] parts = ud.FirstName.Split('.'); if (parts.Length >= 2) diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 43fb61598a..a38f411879 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -1239,7 +1239,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver $"The OAR you are trying to load has major version number of {majorVersion} but this version can only load OARs with major version number {MAX_MAJOR_VERSION} and below"); } - m_log.InfoFormat($"[ARCHIVER]: Loading OAR with version {version}"); + m_log.Info($"[ARCHIVER]: Loading OAR with version {version}"); } else if (xtr.Name.ToString() == "datetime") { diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index 028a81a59b..e09015da79 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs @@ -157,7 +157,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver { if(!UUID.TryParse(thiskey, out UUID id) || id.IsZero()) { - m_log.InfoFormat($"[ARCHIVER]: cannot save asset {kvp.Key} because it has Invalid UUID"); + m_log.Info($"[ARCHIVER]: cannot save asset {kvp.Key} because it has Invalid UUID"); m_notFoundAssetUuids.Add(kvp.Key); continue; } diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index b6fc90d238..4bb4eb1cc0 100755 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -381,12 +381,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain } catch (NotImplementedException) { - m_log.ErrorFormat($"{LogHeader}Unable to load heightmap, the {loader.Value} parser does not support file loading. (May be save only)"); + m_log.Error($"{LogHeader}Unable to load heightmap, the {loader.Value} parser does not support file loading. (May be save only)"); throw new TerrainException($"unable to load heightmap: parser {loader.Value} does not support loading"); } catch (FileNotFoundException) { - m_log.ErrorFormat($"{LogHeader}Unable to load heightmap, file not found. (A directory permissions error may also cause this)"); + m_log.Error($"{LogHeader}Unable to load heightmap, file not found. (A directory permissions error may also cause this)"); throw new TerrainException($"unable to load heightmap: file {filename} not found (or permissions do not allow access"); } catch (ArgumentException e) @@ -498,7 +498,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain } catch (NotImplementedException) { - m_log.ErrorFormat($"{LogHeader}Unable to load heightmap, the { loader.Value} parser does not support file loading. (May be save only)"); + m_log.Error($"{LogHeader}Unable to load heightmap, the { loader.Value} parser does not support file loading. (May be save only)"); throw new TerrainException("unable to load heightmap: parser {loader.Value} does not support loading"); } } diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index 3c7487cd94..45db66c720 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs @@ -1584,11 +1584,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde { try { - m_log.WarnFormat($"[PHYSICS]: Operation failed for a actor {item.actor.Name} {item.what}"); + m_log.Warn($"[PHYSICS]: Operation failed for a actor {item.actor.Name} {item.what}"); } catch { - m_log.WarnFormat("[PHYSICS]: Operation failed for a unknown actor"); + m_log.Warn("[PHYSICS]: Operation failed for a unknown actor"); } } donechanges++; diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 7f9c0a475f..31be714d90 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -948,7 +948,7 @@ namespace OpenSim.Region.ScriptEngine.Shared return (float)dov; if (o is LSL_Types.LSLString lso) return Convert.ToSingle(lso.m_string); - throw new InvalidCastException(string.Format($"LSL float expected but {0} given", o is not null ? o.GetType().Name : "null")); + throw new InvalidCastException(string.Format("LSL float expected but {0} given", o is not null ? o.GetType().Name : "null")); } public LSL_Types.LSLString GetLSLStringItem(int itemIndex) diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs b/OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs index a9c4766f2e..28b97d826d 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs @@ -228,7 +228,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine string oscode = Enum.GetName(typeof(SceneScriptEvents), 1UL << i); if(mycode != oscode) { - m_log.ErrorFormat($"[YEngine]: {i} mycode={mycode}, oscode={oscode}"); + m_log.Error($"[YEngine]: {i} mycode={mycode}, oscode={oscode}"); err = true; } } diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerConnector.cs b/OpenSim/Server/Handlers/Presence/PresenceServerConnector.cs index 6d621a65a5..9d199966cb 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerConnector.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerConnector.cs @@ -43,6 +43,7 @@ namespace OpenSim.Server.Handlers.Presence public PresenceServiceConnector(IConfigSource config, IHttpServer server, string configName) : base(config, server, configName) { + IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index e4c99da007..206f8f51de 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -106,7 +106,6 @@ namespace OpenSim.Server.Handlers.Presence } return FailureResult(); - } byte[] LoginAgent(Dictionary request) diff --git a/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs b/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs index bf8b993a37..3615350aa0 100644 --- a/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs +++ b/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs @@ -316,7 +316,7 @@ namespace OpenSim.Services.Connectors } catch (Exception e) { - m_log.DebugFormat($"[ESTATE CONNECTOR]: Exception when contacting estate server at {uri}: {e.Message}"); + m_log.Debug($"[ESTATE CONNECTOR]: Exception when contacting estate server at {uri}: {e.Message}"); } return null; diff --git a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs index 977176f6e8..fdcce04494 100644 --- a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs +++ b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs @@ -102,41 +102,45 @@ namespace OpenSim.Services.Connectors else { hash = (Hashtable)response.Value; - try + if(hash is not null) { - landData = new LandData(); - landData.AABBMax = Vector3.Parse((string)hash["AABBMax"]); - landData.AABBMin = Vector3.Parse((string)hash["AABBMin"]); - landData.Area = Convert.ToInt32(hash["Area"]); - landData.AuctionID = Convert.ToUInt32(hash["AuctionID"]); - landData.Description = (string)hash["Description"]; - landData.Flags = Convert.ToUInt32(hash["Flags"]); - landData.GlobalID = new UUID((string)hash["GlobalID"]); - landData.Name = (string)hash["Name"]; - landData.OwnerID = new UUID((string)hash["OwnerID"]); - landData.SalePrice = Convert.ToInt32(hash["SalePrice"]); - landData.SnapshotID = new UUID((string)hash["SnapshotID"]); - landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]); - if (hash["RegionAccess"] != null) - regionAccess = (byte)Convert.ToInt32((string)hash["RegionAccess"]); - if(hash["Dwell"] != null) - landData.Dwell = Convert.ToSingle((string)hash["Dwell"]); - //m_log.DebugFormat("[LAND CONNECTOR]: Got land data for parcel {0}", landData.Name); - } - catch (Exception e) - { - m_log.ErrorFormat( - "[LAND CONNECTOR]: Got exception while parsing land-data: {0} {1}", - e.Message, e.StackTrace); + try + { + landData = new LandData(); + landData.AABBMax = Vector3.Parse((string)hash["AABBMax"]); + landData.AABBMin = Vector3.Parse((string)hash["AABBMin"]); + landData.Area = Convert.ToInt32(hash["Area"]); + landData.AuctionID = Convert.ToUInt32(hash["AuctionID"]); + landData.Description = (string)hash["Description"]; + landData.Flags = Convert.ToUInt32(hash["Flags"]); + landData.GlobalID = new UUID((string)hash["GlobalID"]); + landData.Name = (string)hash["Name"]; + landData.OwnerID = new UUID((string)hash["OwnerID"]); + landData.SalePrice = Convert.ToInt32(hash["SalePrice"]); + landData.SnapshotID = new UUID((string)hash["SnapshotID"]); + landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]); + if (hash["RegionAccess"] != null) + regionAccess = (byte)Convert.ToInt32((string)hash["RegionAccess"]); + if(hash["Dwell"] != null) + landData.Dwell = Convert.ToSingle((string)hash["Dwell"]); + //m_log.DebugFormat("[LAND CONNECTOR]: Got land data for parcel {0}", landData.Name); + } + catch (Exception e) + { + m_log.Error( + $"[LAND CONNECTOR]: Got exception while parsing land data: {e.Message} {e.StackTrace}"); + } } + else + m_log.Warn($"[LAND CONNECTOR]: Couldn't get land data for parcel region handle {regionHandle}"); } } else - m_log.WarnFormat("[LAND CONNECTOR]: Couldn't find region with handle {0}", regionHandle); + m_log.Warn($"[LAND CONNECTOR]: Couldn't find region with handle {regionHandle}"); } catch (Exception e) { - m_log.ErrorFormat("[LAND CONNECTOR]: Couldn't contact region {0}: {1}", regionHandle, e.Message); + m_log.Error($"[LAND CONNECTOR]: Couldn't contact region {regionHandle}: {e.Message}"); } return landData; diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 8276dd2d8c..48fdbae34e 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -254,7 +254,7 @@ namespace OpenSim.Services.HypergridService region = m_GridService.GetLocalRegionByName(m_ScopeID, regionName); if (region is null) { - m_log.DebugFormat($"[GATEKEEPER SERVICE]: LinkLocalRegion could not find local region {regionName}"); + m_log.Debug($"[GATEKEEPER SERVICE]: LinkLocalRegion could not find local region {regionName}"); reason = "Region not found"; return false; }