private static void AddHost(string host, string addr) { if (IPAddress.TryParse(host, out _)) { var addr_parts = addr.Split(new[] { ' ', '\t' }, 2, StringSplitOptions.RemoveEmptyEntries); if (addr_parts.Length >= 2) { _ips.insert(new IPAddressCmp(host), new IPAddressCmp(addr_parts[0]), addr_parts[1]); return; } } var parts = host.Split('.'); var node = Root; var include_sub = false; var end = 0; if (parts[0].Length == 0) { end = 1; include_sub = true; } for (var i = parts.Length - 1; i > end; --i) { if (!node.ContainsKey(parts[i])) { node[parts[i]] = new HostNode(); } if (node[parts[i]].SubNode == null) { node[parts[i]].SubNode = new Dictionary <string, HostNode>(); } node = node[parts[i]].SubNode; } node[parts[end]] = new HostNode(include_sub, addr); }