From 7cab41f4223b7febd3fdd42fa7cfefef25e4a9c9 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 15 Nov 2013 21:45:08 +0000 Subject: [PATCH] refactor: replace verbose checks with String.IsNullOrEmpty where applicable. Thanks to Kira for this patch from http://opensimulator.org/mantis/view.php?id=6845 --- CONTRIBUTORS.txt | 1 + .../Addons/Groups/Hypergrid/GroupsServiceHGConnector.cs | 4 ++-- .../Addons/Groups/Remote/GroupsServiceRemoteConnector.cs | 2 +- .../Capabilities/Handlers/GetTexture/GetTextureHandler.cs | 2 +- OpenSim/Framework/Configuration/XML/XmlConfiguration.cs | 2 +- OpenSim/Framework/InventoryItemBase.cs | 2 +- OpenSim/Framework/Monitoring/Stats/Stat.cs | 6 +++--- .../Serialization/External/UserInventoryItemSerializer.cs | 2 +- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 2 +- OpenSim/Framework/TaskInventoryItem.cs | 2 +- OpenSim/Framework/WebUtil.cs | 2 +- OpenSim/Region/Application/OpenSimBase.cs | 2 +- .../Inventory/Archiver/InventoryArchiveReadRequest.cs | 4 ++-- .../Framework/InventoryAccess/HGAssetMapper.cs | 2 +- .../Framework/UserManagement/UserManagementModule.cs | 4 ++-- .../Scripting/HttpRequest/ScriptsHttpRequests.cs | 6 +++--- .../Scripting/LoadImageURL/LoadImageURLModule.cs | 4 ++-- .../Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs | 2 +- .../ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | 2 +- .../CoreModules/World/Archiver/ArchiveReadRequest.cs | 4 ++-- OpenSim/Region/DataSnapshot/DataSnapshotManager.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- .../Scenes/Serialization/SceneObjectSerializer.cs | 4 ++-- .../Region/OptionalModules/Avatar/Chat/ChannelState.cs | 2 +- .../Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs | 8 ++++---- .../XmlRpcGroups/SimianGroupsServicesConnectorModule.cs | 5 ++--- .../XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | 5 ++--- .../Shared/Api/Implementation/Plugins/SensorRepeat.cs | 4 ++-- OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | 2 +- OpenSim/Services/HypergridService/HGInventoryService.cs | 2 +- 30 files changed, 46 insertions(+), 47 deletions(-) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 9ae7a319f2..ef84315cc7 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -109,6 +109,7 @@ what it is today. * Kayne * Kevin Cozens * kinoc (Daxtron Labs) +* Kira * Kitto Flora * KittyLiu * Kurt Taylor (IBM) diff --git a/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnector.cs b/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnector.cs index 59fec6fa38..653dbac8bd 100644 --- a/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnector.cs +++ b/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnector.cs @@ -101,7 +101,7 @@ namespace OpenSim.Groups Dictionary sendData = new Dictionary(); if (GroupID != UUID.Zero) sendData["GroupID"] = GroupID.ToString(); - if (GroupName != null && GroupName != string.Empty) + if (!string.IsNullOrEmpty(GroupName)) sendData["Name"] = GroupsDataUtils.Sanitize(GroupName); sendData["RequestingAgentID"] = RequestingAgentID; @@ -275,7 +275,7 @@ namespace OpenSim.Groups //m_log.DebugFormat("[XXX]: reply was {0}", reply); - if (reply == string.Empty || reply == null) + if (string.IsNullOrEmpty(reply)) return null; Dictionary replyData = ServerUtils.ParseXmlResponse( diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs index 161ca0c4cc..ed419785e8 100644 --- a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs +++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs @@ -120,7 +120,7 @@ namespace OpenSim.Groups Dictionary sendData = new Dictionary(); if (GroupID != UUID.Zero) sendData["GroupID"] = GroupID.ToString(); - if (GroupName != null && GroupName != string.Empty) + if (!string.IsNullOrEmpty(GroupName)) sendData["Name"] = GroupsDataUtils.Sanitize(GroupName); sendData["RequestingAgentID"] = RequestingAgentID; diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index 789bf2b33d..7b3124af57 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs @@ -85,7 +85,7 @@ namespace OpenSim.Capabilities.Handlers // m_log.DebugFormat("[GETTEXTURE]: Received request for texture id {0}", textureID); string[] formats; - if (format != null && format != string.Empty) + if (!string.IsNullOrEmpty(format)) { formats = new string[1] { format.ToLower() }; } diff --git a/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs b/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs index 43162fc227..3152a7d4d6 100644 --- a/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs +++ b/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs @@ -121,7 +121,7 @@ namespace OpenSim.Framework.Configuration.XML public void Commit() { - if (fileName == null || fileName == String.Empty) + if (string.IsNullOrEmpty(fileName)) return; if (!Directory.Exists(Util.configDir())) diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs index 3d45e76698..558dfd0e4c 100644 --- a/OpenSim/Framework/InventoryItemBase.cs +++ b/OpenSim/Framework/InventoryItemBase.cs @@ -122,7 +122,7 @@ namespace OpenSim.Framework { get { - if (m_creatorData != null && m_creatorData != string.Empty) + if (!string.IsNullOrEmpty(m_creatorData)) return m_creatorId + ';' + m_creatorData; else return m_creatorId; diff --git a/OpenSim/Framework/Monitoring/Stats/Stat.cs b/OpenSim/Framework/Monitoring/Stats/Stat.cs index 2b34493c5f..e095801f2a 100644 --- a/OpenSim/Framework/Monitoring/Stats/Stat.cs +++ b/OpenSim/Framework/Monitoring/Stats/Stat.cs @@ -231,7 +231,7 @@ namespace OpenSim.Framework.Monitoring Container, ShortName, Value, - UnitName == null || UnitName == "" ? "" : string.Format(" {0}", UnitName)); + string.IsNullOrEmpty(UnitName) ? "" : string.Format(" {0}", UnitName)); AppendMeasuresOfInterest(sb); @@ -316,9 +316,9 @@ namespace OpenSim.Framework.Monitoring sb.AppendFormat( ", {0:0.##}{1}/s, {2:0.##}{3}/s", lastChangeOverTime, - UnitName == null || UnitName == "" ? "" : string.Format(" {0}", UnitName), + string.IsNullOrEmpty(UnitName) ? "" : string.Format(" {0}", UnitName), averageChangeOverTime, - UnitName == null || UnitName == "" ? "" : string.Format(" {0}", UnitName)); + string.IsNullOrEmpty(UnitName) ? "" : string.Format(" {0}", UnitName)); } } } diff --git a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs index 88f9581afd..f2a6b8b87a 100644 --- a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs +++ b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs @@ -277,7 +277,7 @@ namespace OpenSim.Framework.Serialization.External writer.WriteStartElement("GroupOwned"); writer.WriteString(inventoryItem.GroupOwned.ToString()); writer.WriteEndElement(); - if (options.ContainsKey("creators") && inventoryItem.CreatorData != null && inventoryItem.CreatorData != string.Empty) + if (options.ContainsKey("creators") && !string.IsNullOrEmpty(inventoryItem.CreatorData)) writer.WriteElementString("CreatorData", inventoryItem.CreatorData); else if (options.ContainsKey("home")) { diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 76b4257f8f..e1ae74ee73 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -785,7 +785,7 @@ namespace OpenSim.Framework.Servers.HttpServer "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}", RequestNumber, Port, - (request.ContentType == null || request.ContentType == "") ? "not set" : request.ContentType, + string.IsNullOrEmpty(request.ContentType) ? "not set" : request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint); diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index a06f8e73ef..307cb75832 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs @@ -124,7 +124,7 @@ namespace OpenSim.Framework { get { - if (_creatorData != null && _creatorData != string.Empty) + if (!string.IsNullOrEmpty(_creatorData)) return _creatorID.ToString() + ';' + _creatorData; else return _creatorID.ToString(); diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 706b33ff4a..bcf6af8849 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -720,7 +720,7 @@ namespace OpenSim.Framework /// public static string[] GetPreferredImageTypes(string accept) { - if (accept == null || accept == string.Empty) + if (string.IsNullOrEmpty(accept)) return new string[0]; string[] types = accept.Split(new char[] { ',' }); diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index b032e7fe97..308638c46e 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -908,7 +908,7 @@ namespace OpenSim regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true); string newName; - if (estateName != null && estateName != "") + if (!string.IsNullOrEmpty(estateName)) newName = estateName; else newName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 31c42d87d0..f7057fef2b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -421,7 +421,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver item.CreatorId = ospResolvedId.ToString(); item.CreatorData = string.Empty; } - else if (item.CreatorData == null || item.CreatorData == String.Empty) + else if (string.IsNullOrEmpty(item.CreatorData)) { item.CreatorId = m_userInfo.PrincipalID.ToString(); // item.CreatorIdAsUuid = new UUID(item.CreatorId); @@ -522,7 +522,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver foreach (SceneObjectGroup sog in sceneObjects) foreach (SceneObjectPart sop in sog.Parts) - if (sop.CreatorData == null || sop.CreatorData == "") + if (string.IsNullOrEmpty(sop.CreatorData)) sop.CreatorID = m_creatorIdForAssetId[assetId]; if (coa != null) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs index 144895ccfc..b7a4d1ac1c 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs @@ -174,7 +174,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess private void AdjustIdentifiers(AssetMetadata meta) { - if (meta.CreatorID != null && meta.CreatorID != string.Empty) + if (!string.IsNullOrEmpty(meta.CreatorID)) { UUID uuid = UUID.Zero; UUID.TryParse(meta.CreatorID, out uuid); diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index d3926ccbd5..3fb51958e9 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -466,7 +466,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement return userdata.ServerURLs[serverType].ToString(); } - if (userdata.HomeURL != null && userdata.HomeURL != string.Empty) + if (!string.IsNullOrEmpty(userdata.HomeURL)) { //m_log.DebugFormat( // "[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from '{1}' for {2}", @@ -552,7 +552,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement if (oldUser != null) { - if (creatorData == null || creatorData == String.Empty) + if (string.IsNullOrEmpty(creatorData)) { //ignore updates without creator data return; diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index 1a62405078..c3a8afdf93 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -460,9 +460,9 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest Request.Headers.Add(HttpCustomHeaders[i], HttpCustomHeaders[i+1]); } - if (proxyurl != null && proxyurl.Length > 0) + if (!string.IsNullOrEmpty(proxyurl)) { - if (proxyexcepts != null && proxyexcepts.Length > 0) + if (!string.IsNullOrEmpty(proxyexcepts)) { string[] elist = proxyexcepts.Split(';'); Request.Proxy = new WebProxy(proxyurl, true, elist); @@ -483,7 +483,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest } // Encode outbound data - if (OutboundBody != null && OutboundBody.Length > 0) + if (!string.IsNullOrEmpty(OutboundBody)) { byte[] data = Util.UTF8.GetBytes(OutboundBody); diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs index 65737fa693..baf9f2f4f2 100644 --- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs @@ -161,9 +161,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL { WebRequest request = HttpWebRequest.Create(url); - if (m_proxyurl != null && m_proxyurl.Length > 0) + if (!string.IsNullOrEmpty(m_proxyurl)) { - if (m_proxyexcepts != null && m_proxyexcepts.Length > 0) + if (!string.IsNullOrEmpty(m_proxyexcepts)) { string[] elist = m_proxyexcepts.Split(';'); request.Proxy = new WebProxy(m_proxyurl, true, elist); diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs index cbffca7016..c6e05b1f6a 100644 --- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs @@ -677,7 +677,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC // if not, use as method name UUID parseUID; string mName = "llRemoteData"; - if ((Channel != null) && (Channel != "")) + if (!string.IsNullOrEmpty(Channel)) if (!UUID.TryParse(Channel, out parseUID)) mName = Channel; else diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 58576d1056..77a3c82efb 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -259,7 +259,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory if (sp == null) { inventoryURL = UserManagementModule.GetUserServerURL(userID, "InventoryServerURI"); - if (inventoryURL != null && inventoryURL != string.Empty) + if (!string.IsNullOrEmpty(inventoryURL)) { inventoryURL = inventoryURL.Trim(new char[] { '/' }); m_InventoryURLs.Add(userID, inventoryURL); diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 32d245f0fe..d451b9e423 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -464,7 +464,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver // or creator data is present. Otherwise, use the estate owner instead. foreach (SceneObjectPart part in sceneObject.Parts) { - if (part.CreatorData == null || part.CreatorData == string.Empty) + if (string.IsNullOrEmpty(part.CreatorData)) { if (!ResolveUserUuid(scene, part.CreatorID)) part.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner; @@ -498,7 +498,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver kvp.Value.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner; } - if (kvp.Value.CreatorData == null || kvp.Value.CreatorData == string.Empty) + if (string.IsNullOrEmpty(kvp.Value.CreatorData)) { if (!ResolveUserUuid(scene, kvp.Value.CreatorID)) kvp.Value.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner; diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs index dd48dd5c2b..0c0a7aafd7 100644 --- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs +++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs @@ -307,7 +307,7 @@ namespace OpenSim.Region.DataSnapshot XmlNode regiondata = requestedSnap.CreateNode(XmlNodeType.Element, "regiondata", ""); try { - if (regionName == null || regionName == "") + if (string.IsNullOrEmpty(regionName)) { XmlNode timerblock = requestedSnap.CreateNode(XmlNodeType.Element, "expire", ""); timerblock.InnerText = m_period.ToString(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 9e6c25de7e..dcbb509b92 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -473,7 +473,7 @@ namespace OpenSim.Region.Framework.Scenes { get { - if (CreatorData != null && CreatorData != string.Empty) + if (!string.IsNullOrEmpty(CreatorData)) return CreatorID.ToString() + ';' + CreatorData; else return CreatorID.ToString(); diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 3ea936cc00..f07dee959a 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1223,7 +1223,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization WriteUUID(writer, "CreatorID", sop.CreatorID, options); - if (sop.CreatorData != null && sop.CreatorData != string.Empty) + if (!string.IsNullOrEmpty(sop.CreatorData)) writer.WriteElementString("CreatorData", sop.CreatorData); else if (options.ContainsKey("home")) { @@ -1396,7 +1396,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization WriteUUID(writer, "CreatorID", item.CreatorID, options); - if (item.CreatorData != null && item.CreatorData != string.Empty) + if (!string.IsNullOrEmpty(item.CreatorData)) writer.WriteElementString("CreatorData", item.CreatorData); else if (options.ContainsKey("home")) { diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs index 5a37fadcc2..b5d9fda3e6 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs @@ -461,7 +461,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat string result = instr; - if (result == null || result.Length == 0) + if (string.IsNullOrEmpty(result)) return result; // Repeatedly scan the string until all possible diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs index cdab116fbe..b4fae9d2ac 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs @@ -822,11 +822,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice { string requrl = String.Format(m_vivoxChannelPath, m_vivoxServer, "create", channelId, m_authToken); - if (parent != null && parent != String.Empty) + if (!string.IsNullOrEmpty(parent)) { requrl = String.Format("{0}&chan_parent={1}", requrl, parent); } - if (description != null && description != String.Empty) + if (!string.IsNullOrEmpty(description)) { requrl = String.Format("{0}&chan_desc={1}", requrl, description); } @@ -862,7 +862,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice // requrl = String.Format("{0}&chan_parent={1}", requrl, parent); // } - if (description != null && description != String.Empty) + if (!string.IsNullOrEmpty(description)) { requrl = String.Format("{0}&chan_desc={1}", requrl, description); } @@ -1047,7 +1047,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice private XmlElement VivoxDeleteChannel(string parent, string channelid) { string requrl = String.Format(m_vivoxChannelDel, m_vivoxServer, "delete", channelid, m_authToken); - if (parent != null && parent != String.Empty) + if (!string.IsNullOrEmpty(parent)) { requrl = String.Format("{0}&chan_parent={1}", requrl, parent); } diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs index 7bae8f74f7..8095b28f5e 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs @@ -212,8 +212,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR]: Initializing {0}", this.Name); m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", string.Empty); - if ((m_groupsServerURI == null) || - (m_groupsServerURI == string.Empty)) + if (string.IsNullOrEmpty(m_groupsServerURI)) { m_log.ErrorFormat("Please specify a valid Simian Server for GroupsServerURI in OpenSim.ini, [Groups]"); m_connectorEnabled = false; @@ -438,7 +437,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups return null; } } - else if ((groupName != null) && (groupName != string.Empty)) + else if (!string.IsNullOrEmpty(groupName)) { if (!SimianGetFirstGenericEntry("Group", groupName, out groupID, out GroupInfoMap)) { diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 71b24aca8c..e28d0c2da3 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -168,8 +168,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups m_log.DebugFormat("[XMLRPC-GROUPS-CONNECTOR]: Initializing {0}", this.Name); m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", string.Empty); - if ((m_groupsServerURI == null) || - (m_groupsServerURI == string.Empty)) + if (string.IsNullOrEmpty(m_groupsServerURI)) { m_log.ErrorFormat("Please specify a valid URL for GroupsServerURI in OpenSim.ini, [Groups]"); m_connectorEnabled = false; @@ -354,7 +353,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { param["GroupID"] = GroupID.ToString(); } - if ((GroupName != null) && (GroupName != string.Empty)) + if (!string.IsNullOrEmpty(GroupName)) { param["Name"] = GroupName.ToString(); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 6e74227782..64dc2e22ec 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -367,7 +367,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins Vector3 ZeroVector = new Vector3(0, 0, 0); - bool nameSearch = (ts.name != null && ts.name != ""); + bool nameSearch = !string.IsNullOrEmpty(ts.name); foreach (EntityBase ent in Entities) { @@ -605,7 +605,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins return sensedEntities; senseEntity(sp); } - else if (ts.name != null && ts.name != "") + else if (!string.IsNullOrEmpty(ts.name)) { ScenePresence sp; // Try lookup by name will return if/when found diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index 87f7189652..a1b8d8558c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs @@ -618,7 +618,7 @@ namespace SecondLife // error log. if (results.Errors.Count > 0) { - if (!retried && (results.Errors[0].FileName == null || results.Errors[0].FileName == String.Empty) && + if (!retried && string.IsNullOrEmpty(results.Errors[0].FileName) && results.Errors[0].Line == 0) { // System.Console.WriteLine("retrying failed compilation"); diff --git a/OpenSim/Services/HypergridService/HGInventoryService.cs b/OpenSim/Services/HypergridService/HGInventoryService.cs index 326e68d65d..3233caf704 100644 --- a/OpenSim/Services/HypergridService/HGInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGInventoryService.cs @@ -298,7 +298,7 @@ namespace OpenSim.Services.HypergridService UserAccount user = m_Cache.GetUser(it.CreatorId); // Adjust the creator data - if (user != null && it != null && (it.CreatorData == null || it.CreatorData == string.Empty)) + if (user != null && it != null && string.IsNullOrEmpty(it.CreatorData)) it.CreatorData = m_HomeURL + ";" + user.FirstName + " " + user.LastName; } return it;