Merge branch 'master' of github.com:TShock/TShock
This commit is contained in:
commit
7bac787aa5
2 changed files with 7 additions and 12 deletions
|
|
@ -35,5 +35,5 @@ using System.Runtime.InteropServices;
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
||||||
[assembly: AssemblyVersion("2.3.4.0716")]
|
[assembly: AssemblyVersion("2.3.4.0719")]
|
||||||
[assembly: AssemblyFileVersion("2.3.4.0716")]
|
[assembly: AssemblyFileVersion("2.3.4.0719")]
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Net.Sockets;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
@ -479,16 +480,10 @@ namespace TShockAPI
|
||||||
/// <param name="hostname">string ip</param>
|
/// <param name="hostname">string ip</param>
|
||||||
public static string GetIPv4Address(string hostname)
|
public static string GetIPv4Address(string hostname)
|
||||||
{
|
{
|
||||||
string IP4Address = String.Empty;
|
//Get the ipv4 address from GetHostAddresses, if an ip is passed it will return that ip
|
||||||
foreach (IPAddress IPA in Dns.GetHostAddresses(hostname))
|
var ip = Dns.GetHostAddresses(hostname).FirstOrDefault(i => i.AddressFamily == AddressFamily.InterNetwork);
|
||||||
{
|
//if the dns query was successful then return it, otherwise return an empty string
|
||||||
if (IPA.AddressFamily.ToString() == "InterNetwork")
|
return ip != null ? ip.ToString() : "";
|
||||||
{
|
|
||||||
IP4Address = IPA.ToString();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return IP4Address;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue