== string.Empty is .Lenght == 0

This commit is contained in:
UbitUmarov
2022-01-13 20:31:52 +00:00
parent 6595e3ae26
commit fbbcc1edd7
149 changed files with 261 additions and 264 deletions

View File

@@ -1673,7 +1673,7 @@ namespace OpenSim.Region.CoreModules.Asset
public string Store(AssetBase asset)
{
if (asset.FullID == UUID.Zero)
if (asset.FullID.IsZero())
{
asset.FullID = UUID.Random();
}

View File

@@ -64,7 +64,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
return;
m_URL = config.GetString("URL", String.Empty);
if (m_URL == String.Empty)
if (m_URL.Length == 0)
return;
m_enabled = true;
@@ -107,7 +107,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
public WearableCacheItem[] Get(UUID id)
{
if (m_URL == String.Empty)
if (m_URL.Length == 0)
return null;
using (RestClient rc = new RestClient(m_URL))
@@ -188,7 +188,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
public void Store(UUID agentId, WearableCacheItem[] data)
{
if (m_URL == String.Empty)
if (m_URL.Length == 0)
return;
int numberWears = 0;

View File

@@ -505,7 +505,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// We need to look for its information in the friends list itself
FriendInfo[] finfos = null;
bool confirming = false;
if (friendUUI == string.Empty)
if (friendUUI.Length == 0)
{
finfos = GetFriendsFromCache(agentID);
foreach (FriendInfo finfo in finfos)

View File

@@ -184,7 +184,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
Util.FireAndForget(delegate
{
bool success = false;
if (foreigner && url == string.Empty) // we don't know about this user
if (foreigner && url.Length == 0) // we don't know about this user
{
string recipientUUI = TryGetRecipientUUI(new UUID(im.fromAgentID), toAgentID);
//m_log.DebugFormat("[HG MESSAGE TRANSFER]: Got UUI {0}", recipientUUI);

View File

@@ -75,7 +75,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
}
m_RestURL = cnf.GetString("OfflineMessageURL", "");
if (m_RestURL == "")
if (m_RestURL.Length == 0)
{
m_log.Error("[OFFLINE MESSAGING] Module was enabled, but no URL is given, disabling");
enabled = false;
@@ -188,7 +188,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
private void RetrieveInstantMessages(IClientAPI client)
{
if (m_RestURL == String.Empty)
if (m_RestURL.Length == 0)
{
return;
}

View File

@@ -176,7 +176,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
List<InventoryFolderBase> foundFolders = new List<InventoryFolderBase>();
if (path == string.Empty)
if (path.Length == 0)
{
foundFolders.Add(startFolder);
return foundFolders;

View File

@@ -430,7 +430,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
"[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}",
inventoryFolder.Name,
inventoryFolder.ID,
m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath);
m_invPath.Length == 0 ? InventoryFolderImpl.PATH_DELIMITER : m_invPath);
//recurse through all dirs getting dirs and files
SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly, options, userAccountService);

View File

@@ -108,7 +108,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
bool ok = true;
bool foreign = GetUserProfileServerURI(avatarID, out serverURI);
if(serverURI == string.Empty)
if(serverURI.Length == 0)
ok = false;
Byte[] membershipType = new Byte[1];
@@ -120,7 +120,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
int val_flags = acc.UserFlags;
flags = (uint)(val_flags & 0xff);
if (acc.UserTitle == "")
if (acc.UserTitle.Length == 0)
membershipType[0] = (byte)((val_flags & 0x0f00) >> 8);
else
membershipType = Utils.StringToBytes(acc.UserTitle);
@@ -1594,7 +1594,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
if (null != account)
{
if (account.UserTitle == "")
if (account.UserTitle.Length == 0)
membershipType[0] = (Byte)((account.UserFlags & 0xf00) >> 8);
else
membershipType = Utils.StringToBytes(account.UserTitle);
@@ -1607,7 +1607,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
{
if (GetUserAccountData(avatarID, out userInfo) == true)
{
if ((string)userInfo["user_title"] == "")
if ((string)userInfo["user_title"].Length == 0)
membershipType[0] = (Byte)(((Byte)userInfo["user_flags"] & 0xf00) >> 8);
else
membershipType = Utils.StringToBytes((string)userInfo["user_title"]);

View File

@@ -141,7 +141,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (m_RestrictAppearanceAbroad)
{
m_AccountName = transferConfig.GetString("AccountForAppearance", string.Empty);
if (m_AccountName == string.Empty)
if (m_AccountName.Length == 0)
m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: RestrictAppearanceAbroad is on, but no account has been given for avatar appearance!");
}
}

View File

@@ -411,7 +411,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
private bool IsLocalInventoryAssetsUser(UUID uuid, out string assetsURL)
{
assetsURL = UserManagementModule.GetUserServerURL(uuid, "AssetServerURI");
if (assetsURL == string.Empty)
if (assetsURL.Length == 0)
{
AgentCircuitData agent = m_Scene.AuthenticateHandler.GetAgentCircuitData(uuid);
if (agent != null)

View File

@@ -255,7 +255,7 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
public void SendEmail(UUID objectID, string address, string subject, string body)
{
//Check if address is empty
if (address == string.Empty)
if (address.Length == 0)
return;
//FIXED:Check the email is correct form in REGEX

View File

@@ -71,7 +71,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid
if (fconfig != null)
{
m_LocalServiceDll = fconfig.GetString("LocalServiceModule", m_LocalServiceDll);
if (m_LocalServiceDll == string.Empty)
if (m_LocalServiceDll.Length == 0)
m_log.WarnFormat("[HGGRID IN CONNECTOR]: Friends LocalServiceModule config missing");
}
}

View File

@@ -118,7 +118,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Profile
string serviceDll = config.GetString("LocalServiceModule", String.Empty);
if (serviceDll == String.Empty)
if (serviceDll.Length == 0)
{
m_log.Error("[LOCAL USERPROFILES SERVICE CONNECTOR]: No LocalServiceModule named in section UserProfilesService");
return;

View File

@@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication
string serviceDll = userConfig.GetString("LocalServiceModule",
String.Empty);
if (serviceDll == String.Empty)
if (serviceDll.Length == 0)
{
m_log.Error("[AUTH CONNECTOR]: No LocalServiceModule named in section AuthenticationService");
return;

View File

@@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar
string serviceDll = userConfig.GetString("LocalServiceModule",
String.Empty);
if (serviceDll == String.Empty)
if (serviceDll.Length == 0)
{
m_log.Error("[AVATAR CONNECTOR]: No LocalServiceModule named in section AvatarService");
return;

View File

@@ -189,7 +189,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
{
string msg = m_LocalGridService.RegisterRegion(scopeID, regionInfo);
if (msg == string.Empty && m_RemoteGridService != null)
if (msg.Length == 0 && m_RemoteGridService != null)
return m_RemoteGridService.RegisterRegion(scopeID, regionInfo);
return msg;

View File

@@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
string serviceDll = userConfig.GetString("LocalServiceModule", String.Empty);
if (serviceDll == String.Empty)
if (serviceDll.Length == 0)
{
m_log.Error("[LOCAL GRID USER SERVICE CONNECTOR]: No LocalServiceModule named in section GridUserService");
return;

View File

@@ -114,7 +114,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string localDll = inventoryConfig.GetString("LocalGridInventoryService",
String.Empty);
if (localDll == String.Empty)
if (localDll.Length == 0)
{
m_log.Error("[HG INVENTORY CONNECTOR]: No LocalGridInventoryService named in section InventoryService");
//return;

View File

@@ -99,7 +99,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string serviceDll = inventoryConfig.GetString("LocalServiceModule", String.Empty);
if (serviceDll == String.Empty)
if (serviceDll.Length == 0)
{
m_log.Error("[LOCAL INVENTORY SERVICES CONNECTOR]: No LocalServiceModule named in section InventoryService");
return;
@@ -184,7 +184,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
// Protect ourselves against the caller subsequently modifying the items list
List<InventoryItemBase> items = new List<InventoryItemBase>(invCol.Items);
WorkManager.RunInThread(delegate
WorkManager.RunInThreadPool(delegate
{
foreach (InventoryItemBase item in items)
if (!string.IsNullOrEmpty(item.CreatorData))

View File

@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
}
string service = config.GetString("LocalServiceModule", string.Empty);
if (service == string.Empty)
if (service.Length == 0)
{
m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: No service dll given in config. Unable to proceed.");
return;

View File

@@ -93,7 +93,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MuteList
string serviceDll = userConfig.GetString("LocalServiceModule",
String.Empty);
if (serviceDll == String.Empty)
if (serviceDll.Length == 0)
{
m_log.Error("[MuteList LOCALCONNECTOR]: No LocalServiceModule named in section MuteListService");
return;

View File

@@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
string serviceDll = inventoryConfig.GetString("LocalServiceModule", String.Empty);
if (serviceDll == String.Empty)
if (serviceDll.Length == 0)
{
m_log.Error("[LOCAL PRESENCE CONNECTOR]: No LocalServiceModule named in section PresenceService");
return;

View File

@@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
string serviceDll = userConfig.GetString("LocalServiceModule", String.Empty);
if (serviceDll == String.Empty)
if (serviceDll.Length == 0)
{
m_log.Error("[LOCAL USER ACCOUNT SERVICE CONNECTOR]: No LocalServiceModule named in section UserService");
return;

View File

@@ -660,7 +660,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
catch (Exception e)
{
m_log.Error(string.Format("[ARCHIVER]: Error closing archive: {0} ", e.Message), e);
if (errorMessage == string.Empty)
if (errorMessage.Length == 0)
errorMessage = e.Message;
}

View File

@@ -1863,7 +1863,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
this.Scene.RegionInfo.RegionSettings;
SceneObjectGroup telehub = null;
if (settings.TelehubObject != UUID.Zero &&
if (!settings.TelehubObject.IsZero() &&
(telehub = Scene.GetSceneObjectGroup(settings.TelehubObject)) != null)
{
List<Vector3> spawnPoints = new List<Vector3>();

View File

@@ -345,7 +345,7 @@ namespace OpenSim.Region.CoreModules.World.Region
protected void CreateMarkerFile()
{
if (m_MarkerPath == String.Empty)
if (m_MarkerPath.Length == 0)
return;
string path = Path.Combine(m_MarkerPath, m_Scene.RegionInfo.RegionID.ToString());

View File

@@ -51,9 +51,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
result = this.parseParameters(args, out data);
// Context-specific validation
if (result == String.Empty)
if (result.Length == 0)
{
if (data.shape == String.Empty)
if (data.shape.Length == 0)
{
data.shape = "rectangle";
data.x0 = 0;
@@ -64,7 +64,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
}
// if it's all good, then do the work
if (result == String.Empty)
if (result.Length == 0)
{
this.applyModification(map, data);
}

View File

@@ -49,9 +49,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
result = this.parseParameters(args, out data);
// Context-specific validation
if (result == String.Empty)
if (result.Length == 0)
{
if (data.shape == String.Empty)
if (data.shape.Length == 0)
{
data.shape = "rectangle";
data.x0 = 0;
@@ -62,7 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
}
// if it's all good, then do the work
if (result == String.Empty)
if (result.Length == 0)
{
this.applyModification(map, data);
}

View File

@@ -49,9 +49,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
result = this.parseParameters(args, out data);
// Context-specific validation
if (result == String.Empty)
if (result.Length == 0)
{
if (data.shape == String.Empty)
if (data.shape.Length == 0)
{
data.shape = "rectangle";
data.x0 = 0;
@@ -62,7 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
}
// if it's all good, then do the work
if (result == String.Empty)
if (result.Length == 0)
{
this.applyModification(map, data);
}

View File

@@ -49,9 +49,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
result = this.parseParameters(args, out data);
// Context-specific validation
if (result == String.Empty)
if (result.Length == 0)
{
if (data.shape == String.Empty)
if (data.shape.Length == 0)
{
data.shape = "rectangle";
data.x0 = 0;
@@ -62,7 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
}
// if it's all good, then do the work
if (result == String.Empty)
if (result.Length == 0)
{
this.applyModification(map, data);
}

View File

@@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
result = this.parseParameters(args, out data);
// Context-specific validation
if (result == String.Empty)
if (result.Length == 0)
{
if (data.bevel == "taper")
{
@@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
result = String.Format("Noise strength must be 0.0 to 1.0: {0}", data.elevation);
}
if (data.shape == String.Empty)
if (data.shape.Length == 0)
{
data.shape = "rectangle";
data.x0 = 0;
@@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
}
// if it's all good, then do the work
if (result == String.Empty)
if (result.Length == 0)
{
this.applyModification(map, data);
}

View File

@@ -49,9 +49,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
result = this.parseParameters(args, out data);
// Context-specific validation
if (result == String.Empty)
if (result.Length == 0)
{
if (data.shape == String.Empty)
if (data.shape.Length == 0)
{
data.shape = "rectangle";
data.x0 = 0;
@@ -62,7 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
}
// if it's all good, then do the work
if (result == String.Empty)
if (result.Length == 0)
{
this.applyModification(map, data);
}

View File

@@ -49,7 +49,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
result = this.parseParameters(args, out data);
// Context-specific validation
if (result == String.Empty)
if (result.Length == 0)
{
if (data.bevel == "taper")
{
@@ -68,7 +68,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
result = String.Format("Smoothing strength must be 0.0 to 1.0: {0}", data.elevation);
}
if (data.shape == String.Empty)
if (data.shape.Length == 0)
{
data.shape = "rectangle";
data.x0 = 0;
@@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
}
// if it's all good, then do the work
if (result == String.Empty)
if (result.Length == 0)
{
this.applyModification(map, data);
}

View File

@@ -66,10 +66,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain
{
result = this.parseFloat(args[3], out data.elevation);
}
if (result == String.Empty)
if (result.Length == 0)
{
int index = 3;
while(++index < args.Length && result == String.Empty)
while(++index < args.Length && result.Length == 0)
{
arg = args[index];
// check for shape
@@ -91,15 +91,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain
else
{
result = this.parseInt(coords[0], out data.x0);
if (result == String.Empty)
if (result.Length == 0)
{
result = this.parseInt(coords[1], out data.y0);
}
if (result == String.Empty)
if (result.Length == 0)
{
result = this.parseInt(coords[2], out data.dx);
}
if (result == String.Empty)
if (result.Length == 0)
{
if (coords.Length == 4)
{
@@ -110,7 +110,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
data.dy = data.dx;
}
}
if (result == String.Empty)
if (result.Length == 0)
{
if ((data.dx <= 0) || (data.dy <= 0))
{

View File

@@ -2026,7 +2026,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
result = operation.ModifyTerrain(m_channel, cmd);
}
if (result == String.Empty)
if (result.Length == 0)
{
result = "Modified terrain";
m_log.DebugFormat("Performed terrain operation {0}", operationType);