diff --git a/LibreMetaverse/Messages/Messages.cs b/LibreMetaverse/Messages/Messages.cs index 10af4764..de9eca59 100644 --- a/LibreMetaverse/Messages/Messages.cs +++ b/LibreMetaverse/Messages/Messages.cs @@ -44,7 +44,7 @@ namespace OpenMetaverse.Messages public static OSD FromIP(IPAddress address) { - if (address != null && address != IPAddress.Any) + if (address != null && !Equals(address, IPAddress.Any)) return OSD.FromBinary(address.GetAddressBytes()); else return new OSD(); diff --git a/Programs/GridProxy/GridProxy.cs b/Programs/GridProxy/GridProxy.cs index 93d7fc38..cfc69aee 100644 --- a/Programs/GridProxy/GridProxy.cs +++ b/Programs/GridProxy/GridProxy.cs @@ -226,17 +226,15 @@ namespace GridProxy RunSimProxy(); - Thread runLoginProxy = new Thread(new ThreadStart(RunLoginProxy)); - runLoginProxy.IsBackground = true; - runLoginProxy.Name = "Login Proxy"; + Thread runLoginProxy = new Thread(new ThreadStart(RunLoginProxy)) + { + IsBackground = true, Name = "Login Proxy" + }; runLoginProxy.Start(); IPEndPoint endPoint = (IPEndPoint)loginServer.LocalEndPoint; - IPAddress displayAddress; - if (endPoint.Address == IPAddress.Any) - displayAddress = IPAddress.Loopback; - else - displayAddress = endPoint.Address; + var displayAddress = Equals(endPoint.Address, IPAddress.Any) + ? IPAddress.Loopback : endPoint.Address; loginURI = "http://" + displayAddress + ":" + endPoint.Port + "/"; OpenMetaverse.Logger.Log("Proxy ready at " + loginURI, Helpers.LogLevel.Info); @@ -1054,7 +1052,7 @@ namespace GridProxy ushort simPort = (ushort)info["SimPort"].AsInteger(); string capsURL = info["SeedCapability"].AsString(); - GenericCheck(ref simIP, ref simPort, ref capsURL, capReq.Info.Sim == activeCircuit); + GenericCheck(ref simIP, ref simPort, ref capsURL, Equals(capReq.Info.Sim, activeCircuit)); info["SeedCapability"] = OSD.FromString(capsURL); bytes[0] = (byte)(simIP % 256); @@ -1073,7 +1071,7 @@ namespace GridProxy ushort Port = (ushort)info["Port"].AsInteger(); string capsURL = null; - GenericCheck(ref IP, ref Port, ref capsURL, capReq.Info.Sim == activeCircuit); + GenericCheck(ref IP, ref Port, ref capsURL, Equals(capReq.Info.Sim, activeCircuit)); bytes[0] = (byte)(IP % 256); bytes[1] = (byte)((IP >> 8) % 256); @@ -1096,7 +1094,7 @@ namespace GridProxy GenericCheck(ref simIP, ref simPort, ref capsURL, false); body["seed-capability"] = OSD.FromString(capsURL); - string ipport = String.Format("{0}:{1}", new IPAddress(simIP), simPort); + string ipport = $"{new IPAddress(simIP)}:{simPort}"; body["sim-ip-and-port"] = OSD.FromString(ipport); OpenMetaverse.Logger.Log("DEBUG: Modified EstablishAgentCommunication to " + body["sim-ip-and-port"].AsString() + " with seed cap " + capsURL, Helpers.LogLevel.Debug); diff --git a/Programs/examples/TestClient/Commands/Inventory/ChangeDirectoryCommand.cs b/Programs/examples/TestClient/Commands/Inventory/ChangeDirectoryCommand.cs index 2c394427..1362f0ac 100644 --- a/Programs/examples/TestClient/Commands/Inventory/ChangeDirectoryCommand.cs +++ b/Programs/examples/TestClient/Commands/Inventory/ChangeDirectoryCommand.cs @@ -46,7 +46,7 @@ namespace OpenMetaverse.TestClient.Commands.Inventory.Shell { if (string.IsNullOrEmpty(nextName) || nextName == ".") continue; // Ignore '.' and blanks, stay in the current directory. - if (nextName == ".." && currentFolder != Inventory.RootFolder) + if (nextName == ".." && !currentFolder.Equals((InventoryBase) Inventory.RootFolder)) { // If we encounter .., move to the parent folder. currentFolder = Inventory[currentFolder.ParentUUID] as InventoryFolder;