mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 01:35:46 +08:00
== string.Empty is .Lenght == 0
This commit is contained in:
@@ -405,7 +405,7 @@ namespace OpenSim.Framework.Console
|
||||
bool addcr = false;
|
||||
foreach (string s in current.Keys)
|
||||
{
|
||||
if (s == String.Empty)
|
||||
if (s.Length == 0)
|
||||
{
|
||||
CommandInfo ci = (CommandInfo)current[String.Empty];
|
||||
if (ci.fn.Count != 0)
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace OpenSim.Framework.Console
|
||||
public string Prompt(string p, string def)
|
||||
{
|
||||
string ret = ReadLine(String.Format("{0} [{1}]: ", p, def), false, true);
|
||||
if (ret == String.Empty)
|
||||
if (ret.Length == 0)
|
||||
ret = def;
|
||||
|
||||
return ret;
|
||||
@@ -168,7 +168,7 @@ namespace OpenSim.Framework.Console
|
||||
else
|
||||
ret = ReadLine(String.Format("{0} [{1}]: ", p, def), false, echo);
|
||||
|
||||
if (ret == String.Empty && def != null)
|
||||
if (ret.Length == 0 && def != null)
|
||||
{
|
||||
ret = def;
|
||||
}
|
||||
|
||||
@@ -371,7 +371,7 @@ namespace OpenSim.Framework.Console
|
||||
= components.ConvertAll<string>(
|
||||
c =>
|
||||
{
|
||||
if (c == "")
|
||||
if (c.Length == 0)
|
||||
return blankComponentFunc.Invoke(c);
|
||||
else if (c == MaxRawConsoleVectorValue)
|
||||
return float.MaxValue.ToString();
|
||||
|
||||
@@ -402,7 +402,7 @@ namespace OpenSim.Framework.Console
|
||||
reply["content_type"] = "text/plain";
|
||||
|
||||
// Check user name and password
|
||||
if (m_UserName == String.Empty)
|
||||
if (m_UserName.Length == 0)
|
||||
return reply;
|
||||
|
||||
if (post["USER"] == null || post["PASS"] == null)
|
||||
|
||||
@@ -472,7 +472,7 @@ namespace OpenSim.Framework
|
||||
|
||||
m_GridNick = Util.GetConfigVarFromSections<string>(config, "GridNick", namessections, string.Empty);
|
||||
|
||||
if (m_GridName == string.Empty)
|
||||
if (string.IsNullOrEmpty(m_GridName))
|
||||
m_GridName = "Another bad configured grid";
|
||||
|
||||
OSHTTPURI tmpuri;
|
||||
|
||||
@@ -322,7 +322,7 @@ namespace OpenSim.Framework
|
||||
/// <returns>null if the folder is not found</returns>
|
||||
public InventoryFolderImpl FindFolderByPath(string path)
|
||||
{
|
||||
if (path == string.Empty)
|
||||
if (path.Length == 0)
|
||||
return this;
|
||||
|
||||
path = path.Trim();
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace OpenSim.Framework
|
||||
str += "T";
|
||||
if ((perms & (int)PermissionMask.Export) != 0)
|
||||
str += "X";
|
||||
if (str == "")
|
||||
if (str.Length == 0)
|
||||
str = ".";
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ namespace OpenSim.Framework
|
||||
|
||||
public static PhysicsInertiaData FromXml2(string text)
|
||||
{
|
||||
if (text == String.Empty)
|
||||
if (text.Length == 0)
|
||||
return null;
|
||||
|
||||
bool error;
|
||||
|
||||
@@ -444,12 +444,12 @@ namespace OpenSim.Framework
|
||||
MainConsole.Instance.Output("the default is displayed between [ ] brackets.\n");
|
||||
MainConsole.Instance.Output("=====================================\n");
|
||||
|
||||
if (name == String.Empty)
|
||||
if (name.Length == 0)
|
||||
{
|
||||
while (name.Trim() == string.Empty)
|
||||
while (name.Trim().Length == 0)
|
||||
{
|
||||
name = MainConsole.Instance.Prompt("New region name", name);
|
||||
if (name.Trim() == string.Empty)
|
||||
if (name.Trim().Length == 0)
|
||||
{
|
||||
MainConsole.Instance.Output("Cannot interactively create region with no name");
|
||||
}
|
||||
@@ -461,7 +461,7 @@ namespace OpenSim.Framework
|
||||
creatingNew = true;
|
||||
}
|
||||
|
||||
if (name == String.Empty)
|
||||
if (name.Length == 0)
|
||||
name = source.Configs[0].Name;
|
||||
|
||||
if (source.Configs[name] == null)
|
||||
@@ -505,7 +505,7 @@ namespace OpenSim.Framework
|
||||
//
|
||||
allKeys.Remove("Location");
|
||||
string location = config.GetString("Location", String.Empty);
|
||||
if (location == String.Empty)
|
||||
if (location.Length == 0)
|
||||
{
|
||||
location = MainConsole.Instance.Prompt("Region Location", "1000,1000");
|
||||
config.Set("Location", location);
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace OpenSim.Framework.Serialization.External
|
||||
[Obsolete("This method is deprecated. Use RewriteSOP instead.")]
|
||||
public static string RewriteSOP_Old(string xml, string homeURL, IUserAccountService userService, UUID scopeID)
|
||||
{
|
||||
if (xml == string.Empty || homeURL == string.Empty || userService == null)
|
||||
if (xml.Length == 0 || homeURL.Length == 0 || userService == null)
|
||||
return xml;
|
||||
|
||||
XmlDocument doc = new XmlDocument();
|
||||
@@ -213,7 +213,7 @@ namespace OpenSim.Framework.Serialization.External
|
||||
public static string RewriteSOP(string xmlData, string sceneName, string homeURL, IUserAccountService userService, UUID scopeID)
|
||||
{
|
||||
// Console.WriteLine("Input XML [{0}]", xmlData);
|
||||
if (xmlData == string.Empty || homeURL == string.Empty || userService == null)
|
||||
if (xmlData.Length == 0 || homeURL.Length == 0 || userService == null)
|
||||
return xmlData;
|
||||
|
||||
// Deal with bug introduced in Oct. 20 2014 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8)
|
||||
|
||||
@@ -82,9 +82,9 @@ namespace OSHttpServer
|
||||
// Verifies the parameter
|
||||
if (cookie == null)
|
||||
throw new ArgumentNullException("cookie");
|
||||
if (cookie.Name == null || cookie.Name.Trim() == string.Empty)
|
||||
if (cookie.Name == null || cookie.Name.Trim().Length == 0)
|
||||
throw new ArgumentException("Name must be specified.");
|
||||
if (cookie.Value == null || cookie.Value.Trim() == string.Empty)
|
||||
if (cookie.Value == null || cookie.Value.Trim().Length == 0)
|
||||
throw new ArgumentException("Content must be specified.");
|
||||
|
||||
if (_items.ContainsKey(cookie.Name))
|
||||
|
||||
@@ -21,9 +21,9 @@ namespace OSHttpServer
|
||||
// Verifies the parameter
|
||||
if (cookie == null)
|
||||
throw new ArgumentNullException("cookie");
|
||||
if (cookie.Name == null || cookie.Name.Trim() == string.Empty)
|
||||
if (cookie.Name == null || cookie.Name.Trim().Length == 0)
|
||||
throw new ArgumentException("Name must be specified.");
|
||||
if (cookie.Value == null || cookie.Value.Trim() == string.Empty)
|
||||
if (cookie.Value == null || cookie.Value.Trim().Length == 0)
|
||||
throw new ArgumentException("Content must be specified.");
|
||||
|
||||
if (_items.ContainsKey(cookie.Name))
|
||||
|
||||
@@ -724,7 +724,7 @@ namespace OpenSim.Framework.Servers
|
||||
while ((currentCommand = readFile.ReadLine()) != null)
|
||||
{
|
||||
currentCommand = currentCommand.Trim();
|
||||
if (!(currentCommand == ""
|
||||
if (!(currentCommand.Length == 0
|
||||
|| currentCommand.StartsWith(";")
|
||||
|| currentCommand.StartsWith("//")
|
||||
|| currentCommand.StartsWith("#")))
|
||||
|
||||
@@ -2587,7 +2587,7 @@ namespace OpenSim.Framework
|
||||
|
||||
public static string ServerURIasIP(string uri)
|
||||
{
|
||||
if (uri == string.Empty)
|
||||
if (uri.Length == 0)
|
||||
return string.Empty;
|
||||
|
||||
// Get rid of eventual slashes at the end
|
||||
@@ -2869,7 +2869,7 @@ namespace OpenSim.Framework
|
||||
return false;
|
||||
|
||||
string rawEnd = rangeValues[1].Trim();
|
||||
if (rawEnd == "")
|
||||
if (rawEnd.Length == 0)
|
||||
{
|
||||
end = -1;
|
||||
return true;
|
||||
@@ -3554,7 +3554,7 @@ namespace OpenSim.Framework
|
||||
/// <returns></returns>
|
||||
public static IPEndPoint GetClientIPFromXFF(string xff)
|
||||
{
|
||||
if (xff == string.Empty)
|
||||
if (xff.Length == 0)
|
||||
return null;
|
||||
|
||||
string[] parts = xff.Split(new char[] { ',' });
|
||||
|
||||
Reference in New Issue
Block a user