From f4bf581b96347b8d7f115eca74fa84a644eb729c Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 26 Sep 2009 21:00:51 -0700 Subject: Moved all HG1 operations to HGGridConnector.cs and HypergridServerConnector.cs/HypergridServiceConnector.cs, away from Region.Communications and HGNetworkServersInfo. Fixed small bugs with hyperlinked regions' map positions. --- OpenSim/Framework/Util.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'OpenSim/Framework/Util.cs') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 45b5a10..a28a617 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1203,6 +1203,32 @@ namespace OpenSim.Framework return found.ToArray(); } + public static string ServerURI(string uri) + { + if (uri == string.Empty) + return string.Empty; + + // Get rid of eventual slashes at the end + uri = uri.TrimEnd('/'); + + IPAddress ipaddr1 = null; + string port1 = ""; + try + { + ipaddr1 = Util.GetHostFromURL(uri); + } + catch { } + + try + { + port1 = uri.Split(new char[] { ':' })[2]; + } + catch { } + + // We tried our best to convert the domain names to IP addresses + return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri; + } + #region FireAndForget Threading Pattern public static void FireAndForget(System.Threading.WaitCallback callback) -- cgit v1.1