public void GetNetworkInformation()
 {
     if (string.IsNullOrEmpty(NetworkInformation.PublicIp))
     {
         NetworkInformation.PublicIp         = NetworkService.GetPublicIp();
         NetworkInformation.NetworkComputers = NetworkService.ConnectedDevices();
         NetworkInformation.MacAddress       = NetworkService.GetMacAddress().ToString();
         NetworkInformation.InternalIp       = NetworkService.GetIpAddress().ToString();
     }
     _builder.WriteMessage(NetworkInformation.ToObject());
 }
Beispiel #2
0
 // ReSharper disable once UnusedMethodReturnValue.Local
 private void SetNetworkInformation()
 {
     try
     {
         if (string.IsNullOrEmpty(NetworkInformation.PublicIp))
         {
             NetworkInformation.PublicIp         = NetworkService.GetPublicIp();
             NetworkInformation.MacAddress       = NetworkService.GetMacAddress().ToString();
             NetworkInformation.InternalIp       = NetworkService.GetIpAddress().ToString();
             NetworkInformation.NetworkComputers = NetworkService.ConnectedDevices();
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         Console.WriteLine(ex.StackTrace);
     }
 }