From a030a8ba0f4d1443d2ebf0fe38dcf6351ce51483 Mon Sep 17 00:00:00 2001 From: Deathmax Date: Thu, 23 Jun 2011 22:13:48 +0800 Subject: [PATCH] Whitelist now accepts hostnames as well. --- TShockAPI/FileTools.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/TShockAPI/FileTools.cs b/TShockAPI/FileTools.cs index 90b9468e..b8094bd4 100644 --- a/TShockAPI/FileTools.cs +++ b/TShockAPI/FileTools.cs @@ -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; } } } \ No newline at end of file