Exemplo n.º 1
0
 public void GetIpList()
 {
     foreach (var ipAddress in _manager.GetIpList("192.168.88.105"))
     {
         var traceLine = $"{ipAddress.InterfaceId} : {ipAddress.Address} : {ipAddress.SubnetMask}";
         Trace.WriteLine(traceLine);
     }
 }
Exemplo n.º 2
0
        public IEnumerable <string> Get(string ip = null)
        {
            Trace.WriteLine("Got list request");
            var result = new List <string>();

            try
            {
                var results = _networkManager.GetIpList()
                              .Select(x => $"{x.InterfaceName} - {x.InterfaceId} : {x.Address} : {x.SubnetMask}");
                result.AddRange(results);
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.GetBaseException().ToString());
                result.Add($"Cannot get ip list: {e.Message}");
            }

            return(result);
        }