diff --git a/Programs/examples/TestClient/Commands/Agent/BotsCommand.cs b/Programs/examples/TestClient/Commands/Agent/BotsCommand.cs index f06005aa..e61f8f9b 100644 --- a/Programs/examples/TestClient/Commands/Agent/BotsCommand.cs +++ b/Programs/examples/TestClient/Commands/Agent/BotsCommand.cs @@ -22,10 +22,7 @@ namespace OpenMetaverse.TestClient { lock (m_AgentList) { - if (m_AgentList.ContainsKey(e.SourceID)) - m_AgentList[e.SourceID] = true; - else - m_AgentList.Add(e.SourceID, true); + m_AgentList[e.SourceID] = true; } } @@ -33,10 +30,7 @@ namespace OpenMetaverse.TestClient { lock (m_AgentList) { - if (m_AgentList.ContainsKey(e.SourceID)) - m_AgentList[e.SourceID] = true; - else - m_AgentList.Add(e.SourceID, true); + m_AgentList[e.SourceID] = true; } } @@ -44,10 +38,7 @@ namespace OpenMetaverse.TestClient { lock (m_AgentList) { - if (m_AgentList.ContainsKey(e.SourceID)) - m_AgentList[e.SourceID] = true; - else - m_AgentList.Add(e.SourceID, true); + m_AgentList[e.SourceID] = true; } } diff --git a/Programs/examples/TestClient/Commands/Communication/IMCommand.cs b/Programs/examples/TestClient/Commands/Communication/IMCommand.cs index ee338bfd..1846415c 100644 --- a/Programs/examples/TestClient/Commands/Communication/IMCommand.cs +++ b/Programs/examples/TestClient/Commands/Communication/IMCommand.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Threading; namespace OpenMetaverse.TestClient @@ -56,14 +57,11 @@ namespace OpenMetaverse.TestClient void Avatars_AvatarPickerReply(object sender, AvatarPickerReplyEventArgs e) { - foreach (KeyValuePair kvp in e.Avatars) + foreach (var kvp in e.Avatars.Where(kvp => string.Equals(kvp.Value, ToAvatarName, StringComparison.CurrentCultureIgnoreCase))) { - if (kvp.Value.ToLower() == ToAvatarName.ToLower()) - { - Name2Key[ToAvatarName.ToLower()] = kvp.Key; - NameSearchEvent.Set(); - return; - } + Name2Key[ToAvatarName.ToLower()] = kvp.Key; + NameSearchEvent.Set(); + return; } } } diff --git a/Programs/examples/TestClient/Commands/Groups/JoinGroupCommand.cs b/Programs/examples/TestClient/Commands/Groups/JoinGroupCommand.cs index 99068119..3514eec4 100644 --- a/Programs/examples/TestClient/Commands/Groups/JoinGroupCommand.cs +++ b/Programs/examples/TestClient/Commands/Groups/JoinGroupCommand.cs @@ -111,7 +111,7 @@ namespace OpenMetaverse.TestClient Console.WriteLine(groupRetrieved.GroupName + "\t\t\t(" + Name + " UUID " + groupRetrieved.GroupID + ")"); - if (groupRetrieved.GroupName.ToLower() == groupName.ToLower()) + if (string.Equals(groupRetrieved.GroupName, groupName, StringComparison.CurrentCultureIgnoreCase)) { resolvedGroupID = groupRetrieved.GroupID; resolvedGroupName = groupRetrieved.GroupName;