You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
640 B
C#

using System;
using System.ComponentModel.Composition;
namespace Util
{
public interface INetwork
{
bool IsLocalMachine(string machine);
}
[Export(typeof(INetwork))]
public class Network : INetwork
{
public bool IsLocalMachine(string machine)
{
try
{
var localMachine = System.Net.Dns.GetHostName();
var entry = System.Net.Dns.GetHostEntry(machine);
return entry.HostName.Equals(localMachine);
}
catch (Exception)
{
return false;
}
}
}
}