mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
refactor: replace verbose checks with String.IsNullOrEmpty where applicable.
Thanks to Kira for this patch from http://opensimulator.org/mantis/view.php?id=6845
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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"))
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user