== 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

@@ -3602,10 +3602,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
PhysicsActor pa = group.RootPart.PhysActor;
//Recoil.
if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero)
if (pa != null && pa.IsPhysical && !((Vector3)vel).IsZero())
{
Vector3 recoil = -vel * groupmass * m_recoilScaleFactor;
if (recoil != Vector3.Zero)
if (!recoil.IsZero())
{
llApplyImpulse(recoil, 0);
}
@@ -5199,7 +5199,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
if (message == string.Empty)
if (message.Length == 0)
{
Error("llTextBox", "Empty message");
}
@@ -8115,7 +8115,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
if (message == string.Empty)
if (message.Length == 0)
{
Error("llDialog", "Empty message");
}
@@ -8127,7 +8127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
string[] buts = new string[length];
for (int i = 0; i < length; i++)
{
if (buttons.Data[i].ToString() == String.Empty)
if (buttons.Data[i].ToString().Length == 0)
{
Error("llDialog", "Button label cannot be blank");
return;
@@ -13800,9 +13800,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScriptSleep(300);
if (str1 == string.Empty)
if (str1.Length == 0)
return string.Empty;
if (str2 == string.Empty)
if (str2.Length == 0)
return str1;
int len = str2.Length;
@@ -13882,9 +13882,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llXorBase64StringsCorrect(string str1, string str2)
{
if (str1 == string.Empty)
if (str1.Length == 0)
return string.Empty;
if (str2 == string.Empty)
if (str2.Length == 0)
return str1;
int len = str2.Length;
@@ -14171,7 +14171,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
// The rest of those would be added to the body in SL.
// Let's not do that.
if (urlParts[i] == string.Empty)
if (urlParts[i].Length == 0)
break;
// See if this could be a valid header
@@ -17392,7 +17392,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
if (state == String.Empty)
if (state.Length == 0)
{
llShout(ScriptBaseClass.DEBUG_CHANNEL, "Invalid animation state " + animState);
return;
@@ -17469,7 +17469,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
if (state == String.Empty)
if (state.Length == 0)
{
return;
}
@@ -17507,7 +17507,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
if (state == String.Empty)
if (state.Length == 0)
{
return String.Empty;
}

View File

@@ -713,7 +713,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
seconds -= 15;
}
if (msg == String.Empty)
if (msg.Length == 0)
restartModule.ScheduleRestart(UUID.Zero, "Region: " + World.RegionInfo.RegionName + " is about to restart.\n\nIf you stay here you will be logged out.\n\n\nTime remaining: {0}.\n", times.ToArray(), true);
else
@@ -782,7 +782,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
CheckThreatLevel(ThreatLevel.VeryHigh, "osSetDynamicTextureURL");
if (dynamicID == String.Empty)
if (dynamicID.Length == 0)
{
IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
UUID createdTexture =
@@ -803,7 +803,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
CheckThreatLevel(ThreatLevel.VeryHigh, "osSetDynamicTextureURLBlend");
if (dynamicID == String.Empty)
if (dynamicID.Length == 0)
{
IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
UUID createdTexture =
@@ -824,7 +824,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
CheckThreatLevel(ThreatLevel.VeryHigh, "osSetDynamicTextureURLBlendFace");
if (dynamicID == String.Empty)
if (dynamicID.Length == 0)
{
IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
UUID createdTexture =
@@ -851,12 +851,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureData");
if (dynamicID == String.Empty)
if (dynamicID.Length == 0)
{
IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
if (textureManager != null)
{
if (extraParams == String.Empty)
if (extraParams.Length == 0)
{
extraParams = "256";
}
@@ -880,12 +880,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureDataBlend");
if (dynamicID == String.Empty)
if (dynamicID.Length == 0)
{
IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
if (textureManager != null)
{
if (extraParams == String.Empty)
if (extraParams.Length == 0)
{
extraParams = "256";
}
@@ -908,12 +908,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
CheckThreatLevel(ThreatLevel.VeryLow , "osSetDynamicTextureDataBlendFace");
if (dynamicID == String.Empty)
if (dynamicID.Length == 0)
{
IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
if (textureManager != null)
{
if (extraParams == String.Empty)
if (extraParams.Length == 0)
{
extraParams = "256";
}
@@ -2711,7 +2711,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
returnValue = userManager.GetUserServerURL(new UUID(uuid), "HomeURI");
}
if (returnValue == "")
if (returnValue.Length == 0)
return World.SceneGridInfo.HomeURLNoEndSlash;
return returnValue;
@@ -4679,7 +4679,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
CheckThreatLevel();
if(impact_sound == "")
if(impact_sound.Length == 0)
{
m_host.CollisionSoundVolume = (float)impact_volume;
m_host.CollisionSound = m_host.invalidCollisionSoundUUID;

View File

@@ -298,7 +298,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
// m_log.DebugFormat("[Compiler]: Compiling assembly {0} for asset {1} in {2}", assembly, asset, m_scriptEngine.World.Name);
if (source == String.Empty)
if (source.Length == 0)
throw new Exception("Cannot find script assembly and no script text present");
enumCompileType language = DefaultCompileLanguage;

View File

@@ -2093,7 +2093,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
// Leading plus sign is allowed, but ignored
v = v.Replace("+", "");
if (v == String.Empty)
if (v.Length == 0)
{
value = 0;
}
@@ -2436,7 +2436,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
v = v.Trim();
if (v == String.Empty || v == null)
if (v.Length == 0 || v == null)
v = "0.0";
else
if (!v.Contains(".") && !v.ToLower().Contains("e"))

View File

@@ -2228,7 +2228,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
{
// m_log.DebugFormat("[XEngine]: Writing state for script item with ID {0}", itemID);
if (xml == String.Empty)
if (xml.Length == 0)
return false;
XmlDocument doc = new XmlDocument();

View File

@@ -1304,7 +1304,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
foreach(string st in stlines)
{
string stline = st.Trim();
if(stline == "")
if(stline.Length == 0)
continue;
// strip 'at' off the front of line

View File

@@ -194,7 +194,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
public string xmrSetParcelMusicURLGroup (string newurl)
{
string groupname = m_ScriptEngine.Config.GetString ("SetParcelMusicURLGroup", "");
if (groupname == "") throw new ApplicationException ("no SetParcelMusicURLGroup config param set");
if (groupname.Length == 0) throw new ApplicationException ("no SetParcelMusicURLGroup config param set");
IGroupsModule igm = World.RequestModuleInterface<IGroupsModule> ();
if (igm == null) throw new ApplicationException ("no GroupsModule loaded");