public NIC(ManagementObject nic) { this.nic = nic; if ((bool)nic["DHCPEnabled"]) { this.backUp = null; } else { this.backUp = IPInformation.GetInstance(nic); } this.isChanged = false; }
public static IPInformation GetInstance(string ip_subnet) { IPInformation instance; var ipDatas = ip_subnet.Split(IPInformation.Slash); if (ipDatas.Length == 2) { instance = IPInformation.GetInstance(ipDatas[0], ipDatas[1]); } else { instance = null; } return(instance); }
public static IPInformation GetInstance(byte[] ip, int cidr) { IPInformation instance; if (cidr >= 0 && cidr <= 32) { UInt32 mask = 0xFFFFFFFF << (32 - cidr); byte[] subnet = new byte[4]; for (int index = subnet.Length - 1; index >= 0; index--) { subnet[index] = (byte)(mask & 0xFF); mask >>= 8; } instance = IPInformation.GetInstance(ip, subnet); } else { instance = null; } return(instance); }
public static IPInformation GetInstance(byte[] ip, byte[] subnet) { IPInformation instance; if (ip == null || subnet == null) { instance = null; } if (ip.Length == 4 && subnet.Length == 4) { instance = new IPInformation(ip, subnet); } else if (ip.Length == 4 && subnet.Length == 1) { instance = IPInformation.GetInstance(ip, subnet[0]); } else { instance = null; } return(instance); }
public bool SetStaticIPAddress(string ip_subnet) { return(this.SetStaticIPAddress(IPInformation.GetInstance(ip_subnet))); }
public static IPInformation GetInstance(ManagementObject nic) { return(IPInformation.GetInstance(((string[])nic["IPAddress"])[0], ((string[])nic["IPSubnet"])[0])); }
public static IPInformation GetInstance(string ip, int cidr) { return(IPInformation.GetInstance(IPInformation.ToIPBytes(ip), cidr)); }
public static IPInformation GetInstance(string ip, string subnet) { return(IPInformation.GetInstance(IPInformation.ToIPBytes(ip), IPInformation.ToIPBytes(subnet))); }