コード例 #1
0
        /// <summary>
        /// Discovers nodes by a Computer enumerable.
        /// </summary>
        /// <returns>A List of booleans for each discovered node</returns>
        /// <param name="netmap">The NetworkMap</param>
        /// <param name="comps">The Computer nodes to discover</param>
        /// <param name="flashTime">The flash time length for the discovery</param>
        /// <seealso cref="DiscoverNode"/>
        public static List <bool> DiscoverNodes(this Hacknet.NetworkMap netmap, IEnumerable <Hacknet.Computer> comps, float flashTime = 1f)
        {
            var result = new List <bool>();

            foreach (var c in comps)
            {
                result.Add(netmap.DiscoverNode(c, flashTime));
            }
            return(result);
        }
コード例 #2
0
 /// <summary>
 /// Discovers a Computer node by ip if it exists.
 /// </summary>
 /// <returns><c>true</c>, if node exists and was discovered, <c>false</c> otherwise.</returns>
 /// <param name="netmap">The NetworkMap</param>
 /// <param name="ip">The Computer ip to discover</param>
 /// <param name="flashTime">The flash time length for the discovery</param>
 public static bool DiscoverNodeByIp(this Hacknet.NetworkMap netmap, string ip, float flashTime = 1f) =>
 netmap.DiscoverNode(netmap.GetComputerByIp(ip), flashTime);