From 4088b5d16503e2e395b199cee53f6f1d692cb7f0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 22 Dec 2024 23:29:34 +0000 Subject: [PATCH] cosmetics --- OpenSim/ConsoleClient/ConsoleClient.cs | 4 ++-- OpenSim/Data/MySQL/MySQLAuthenticationData.cs | 3 +-- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 6 +++--- .../HttpServer/OSHttpServer/HttpContextFactory.cs | 11 +++++------ .../Inventory/Archiver/InventoryArchiveReadRequest.cs | 2 +- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/OpenSim/ConsoleClient/ConsoleClient.cs b/OpenSim/ConsoleClient/ConsoleClient.cs index 9ab53b891b..283fd1e1cd 100644 --- a/OpenSim/ConsoleClient/ConsoleClient.cs +++ b/OpenSim/ConsoleClient/ConsoleClient.cs @@ -75,7 +75,6 @@ namespace OpenSim.ConsoleClient Requester.MakeRequest("http://"+m_Host+":"+m_Port.ToString()+"/StartSession/", String.Format("USER={0}&PASS={1}", m_User, m_Pass), LoginReply); - string pidFile = serverConfig.GetString("PIDFile", String.Empty); while (m_Server.Running) { @@ -83,7 +82,8 @@ namespace OpenSim.ConsoleClient MainConsole.Instance.Prompt(); } - if (pidFile != String.Empty) + string pidFile = serverConfig.GetString("PIDFile", string.Empty); + if (pidFile.Length > 0) File.Delete(pidFile); Environment.Exit(0); diff --git a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs index fef582e809..7fd3689125 100644 --- a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs +++ b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs @@ -122,8 +122,7 @@ namespace OpenSim.Data.MySQL public bool Store(AuthenticationData data) { - if (data.Data.ContainsKey("UUID")) - data.Data.Remove("UUID"); + data.Data.Remove("UUID"); string[] fields = new List(data.Data.Keys).ToArray(); diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 15c43a606a..999eb6adca 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -372,7 +372,7 @@ namespace OpenSim.Framework.Servers.HttpServer public void RemoveWebSocketHandler(string servicepath) { - m_WebSocketHandlers.TryRemove(servicepath, out WebSocketRequestDelegate dummy); + m_WebSocketHandlers.TryRemove(servicepath, out _); } public List GetStreamHandlerKeys() @@ -526,7 +526,7 @@ namespace OpenSim.Framework.Servers.HttpServer public void RemoveIndexPHPMethodHandler(string key) { - m_indexPHPmethods.TryRemove(key, out SimpleStreamMethod sh); + m_indexPHPmethods.TryRemove(key, out _); } public SimpleStreamMethod TryGetIndexPHPMethodHandler(string key) @@ -543,7 +543,7 @@ namespace OpenSim.Framework.Servers.HttpServer public void RemoveGlobalPMethodHandler(string key) { - m_globalMethods.TryRemove(key, out SimpleStreamMethod sh); + m_globalMethods.TryRemove(key, out _); } public bool TryGetGlobalMethodHandler(string key, out SimpleStreamMethod sh) diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpContextFactory.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpContextFactory.cs index eed59510aa..72d4f4eff3 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpContextFactory.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpContextFactory.cs @@ -61,12 +61,11 @@ namespace OSHttpServer private void OnFreeContext(object sender, DisconnectedEventArgs e) { - var imp = sender as HttpClientContext; - if (imp == null || imp.contextID < 0) - return; - - m_activeContexts.TryRemove(imp.contextID, out HttpClientContext dummy); - imp.Close(); + if (sender is HttpClientContext imp && imp.contextID >= 0) + { + m_activeContexts.TryRemove(imp.contextID, out _); + imp.Close(); + } } diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 47a47cc107..9d77e26543 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -620,7 +620,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver // Trim off the file portion if we aren't already dealing with a directory path if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType) - path = path.Remove(path.LastIndexOf("/") + 1); + path = path.Remove(path.LastIndexOf('/') + 1); InventoryFolderBase foundFolder = ReplicateArchivePathToUserInventory( diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0ae550366a..5bc0417c02 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -724,7 +724,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (linknum == ScriptBaseClass.LINK_THIS) return part; - + if (linknum <= part.ParentGroup.PrimCount) return part.ParentGroup.GetLinkNumPart(linknum);