Whitelist now accepts hostnames as well.

This commit is contained in:
Deathmax 2011-06-23 22:13:48 +08:00
parent 5e7130aa88
commit a030a8ba0f

View file

@ -103,7 +103,19 @@ namespace TShockAPI
TextReader tr = new StreamReader(WhitelistPath);
string whitelist = tr.ReadToEnd();
ip = Tools.GetRealIP(ip);
return whitelist.Contains(ip);
bool contains = whitelist.Contains(ip);
if (!contains)
{
foreach (var line in whitelist.Split(Environment.NewLine.ToCharArray()))
{
contains = Tools.GetIPv4Address(line).Equals(ip);
if (contains)
return true;
}
return false;
}
else
return true;
}
}
}