Beispiel #1
0
    public List <Machine> reScanMachines()
    {
        CurrentContext.Validate();
        var ips = NetworkScanner.GetAllMAchines();

        foreach (int i in ips.Keys)
        {
            var ip = ips[i];
            if (string.IsNullOrEmpty(ip.Name))
            {
                continue;
            }
            var m = MachineFactory.Find(ip.Name.ToUpper());
            if (m != null)
            {
                bool bchange = false;
                if (m.IP != ip.IpAddress)
                {
                    m.IP    = ip.IpAddress;
                    bchange = true;
                }
                if (m.MAC != ip.MacAddress)
                {
                    m.MAC   = ip.MacAddress;
                    bchange = true;
                }
                if (bchange)
                {
                    MachineFactory.Update(m);
                }
            }
        }
        return(getMachines());
    }