diff --git a/LibreMetaverse.GUI/ListColumnSorter.cs b/LibreMetaverse.GUI/ListColumnSorter.cs index 51439ba9..818e719e 100644 --- a/LibreMetaverse.GUI/ListColumnSorter.cs +++ b/LibreMetaverse.GUI/ListColumnSorter.cs @@ -24,6 +24,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ +using System; using System.Collections; using System.Windows.Forms; @@ -55,11 +56,9 @@ namespace OpenMetaverse.GUI return valueA < valueB ? 1 : -1; } } - else - { - if (Ascending) return string.Compare(itemA.Text, itemB.Text); - else return -string.Compare(itemA.Text, itemB.Text); - } + + if (Ascending) return string.CompareOrdinal(itemA.Text, itemB.Text); + return -string.CompareOrdinal(itemA.Text, itemB.Text); } } diff --git a/LibreMetaverse/Assets/AssetTypes/AssetCallingCard.cs b/LibreMetaverse/Assets/AssetTypes/AssetCallingCard.cs index 73dd6e89..fefbbb69 100644 --- a/LibreMetaverse/Assets/AssetTypes/AssetCallingCard.cs +++ b/LibreMetaverse/Assets/AssetTypes/AssetCallingCard.cs @@ -83,7 +83,7 @@ namespace OpenMetaverse.Assets String text = Utils.BytesToString(AssetData); if (text.ToLower().Contains("callingcard version 2")) { - AvatarID = new UUID(text.Substring(text.IndexOf("avatar_id") + 10, 36)); + AvatarID = new UUID(text.Substring(text.IndexOf("avatar_id", StringComparison.Ordinal) + 10, 36)); return true; } return false; diff --git a/LibreMetaverse/Assets/AssetTypes/AssetLandmark.cs b/LibreMetaverse/Assets/AssetTypes/AssetLandmark.cs index e81bdf7c..e9aeb19a 100644 --- a/LibreMetaverse/Assets/AssetTypes/AssetLandmark.cs +++ b/LibreMetaverse/Assets/AssetTypes/AssetLandmark.cs @@ -75,9 +75,9 @@ namespace OpenMetaverse.Assets String text = Utils.BytesToString(AssetData); if (text.ToLower().Contains("landmark version 2")) { - RegionID = new UUID(text.Substring(text.IndexOf("region_id") + 10, 36)); + RegionID = new UUID(text.Substring(text.IndexOf("region_id", StringComparison.Ordinal) + 10, 36)); String vecDelim = " "; - String[] vecStrings = text.Substring(text.IndexOf("local_pos") + 10).Split(vecDelim.ToCharArray()); + String[] vecStrings = text.Substring(text.IndexOf("local_pos", StringComparison.Ordinal) + 10).Split(vecDelim.ToCharArray()); if (vecStrings.Length == 3) { Position = new Vector3(float.Parse(vecStrings[0], System.Globalization.CultureInfo.InvariantCulture), float.Parse(vecStrings[1], System.Globalization.CultureInfo.InvariantCulture), float.Parse(vecStrings[2], System.Globalization.CultureInfo.InvariantCulture)); diff --git a/LibreMetaverse/Rendering/LindenMesh.cs b/LibreMetaverse/Rendering/LindenMesh.cs index c199ae1e..a2e5eae0 100644 --- a/LibreMetaverse/Rendering/LindenMesh.cs +++ b/LibreMetaverse/Rendering/LindenMesh.cs @@ -548,12 +548,9 @@ namespace OpenMetaverse.Rendering /// A standard .Net string public static string TrimAt0(string s) { - int pos = s.IndexOf("\0"); + int pos = s.IndexOf("\0", StringComparison.Ordinal); - if (pos >= 0) - return s.Substring(0, pos); - - return s; + return pos >= 0 ? s.Substring(0, pos) : s; } } } diff --git a/Programs/GridProxy/GridProxyLoader.cs b/Programs/GridProxy/GridProxyLoader.cs index 1fca6b9e..ff62758c 100644 --- a/Programs/GridProxy/GridProxyLoader.cs +++ b/Programs/GridProxy/GridProxyLoader.cs @@ -92,7 +92,7 @@ namespace GridProxy logLogin = true; else if (arg.Substring(0, 2) == "--") { - int ipos = arg.IndexOf("="); + int ipos = arg.IndexOf("=", StringComparison.Ordinal); if (ipos != -1) { string sw = arg.Substring(0, ipos); diff --git a/Programs/examples/IRCGateway/IRCClient.cs b/Programs/examples/IRCGateway/IRCClient.cs index 0efadff4..69204d00 100644 --- a/Programs/examples/IRCGateway/IRCClient.cs +++ b/Programs/examples/IRCGateway/IRCClient.cs @@ -140,7 +140,7 @@ public class IRCClient int nameIndex = words[0].IndexOf('!'); string name = nameIndex > 0 ? words[0].Substring(1, nameIndex - 1) : words[0]; string address = words[0].Substring(nameIndex + 1); - OnMessage(words[2], name, address, lines[i].Substring(lines[i].IndexOf(":", 1) + 1)); + OnMessage(words[2], name, address, lines[i].Substring(lines[i].IndexOf(":", 1, StringComparison.Ordinal) + 1)); } } } @@ -148,8 +148,7 @@ public class IRCClient if (!ircClient.Connected) { - if (OnDisconnected != null) - OnDisconnected(); + OnDisconnected?.Invoke(); } else ircClient.Close();