private void CalculateIPv4SubnetAction() { IsDetailsVisible = false; string[] subnet = Subnet.Trim().Split('/'); string subnetmask = subnet[1]; // Convert CIDR to subnetmask if (subnetmask.Length < 3) { subnetmask = Subnetmask.GetFromCidr(int.Parse(subnet[1])).Subnetmask; } SubnetInfo subnetInfo = Models.Network.Subnet.CalculateIPv4Subnet(IPAddress.Parse(subnet[0]), IPAddress.Parse(subnetmask)); DetailsNetworkAddress = subnetInfo.NetworkAddress; DetailsBroadcast = subnetInfo.Broadcast; DetailsSubnetmask = subnetInfo.Subnetmask; DetailsCIDR = subnetInfo.CIDR; DetailsIPAddresses = subnetInfo.IPAddresses; DetailsFirstIPAddress = subnetInfo.HostFirstIP; DetailsLastIPAddress = subnetInfo.HostLastIP; DetailsHosts = subnetInfo.Hosts; IsDetailsVisible = true; AddSubnetToHistory(Subnet); }
private void CalculateIPv4SubnetAction() { IsDetailsVisible = false; string[] subnet = Subnet.Trim().Split('/'); string subnetmask = subnet[1]; // Convert CIDR to subnetmask if (subnetmask.Length < 3) { subnetmask = Subnetmask.GetFromCidr(int.Parse(subnet[1])).Subnetmask; } SubnetInfo subnetInfo = Models.Network.Subnet.CalculateIPv4Subnet(IPAddress.Parse(subnet[0]), IPAddress.Parse(subnetmask)); DetailsNetworkAddress = subnetInfo.NetworkAddress; DetailsBroadcast = subnetInfo.Broadcast; DetailsSubnetmask = subnetInfo.Subnetmask; DetailsCIDR = subnetInfo.CIDR; DetailsIPAddresses = subnetInfo.IPAddresses; DetailsFirstIPAddress = subnetInfo.HostFirstIP; DetailsLastIPAddress = subnetInfo.HostLastIP; DetailsHosts = subnetInfo.Hosts; IsDetailsVisible = true; SubnetHistory = new List <string>(HistoryListHelper.Modify(SubnetHistory, Subnet, SettingsManager.Current.Application_HistoryListEntries)); }
private void CalculateIPv4SubnetAction() { string subnetmask = SubnetmaskOrCidr; if (SubnetmaskOrCidr.StartsWith("/")) { subnetmask = Subnetmask.GetFromCidr(int.Parse(SubnetmaskOrCidr.TrimStart('/'))).Subnetmask; } SubnetInfo subnetInfo = Subnet.CalculateIPv4Subnet(IPAddress.Parse(IPv4Address), IPAddress.Parse(subnetmask)); DetailsNetworkAddress = subnetInfo.NetworkAddress; DetailsBroadcast = subnetInfo.Broadcast; DetailsSubnetmask = subnetInfo.Subnetmask; DetailsCIDR = subnetInfo.CIDR; DetailsTotalIPs = subnetInfo.TotalIPs; DetailsHostIPRange = string.Format("{0} - {1}", subnetInfo.HostFirstIP, subnetInfo.HostLastIP); DetailsHostIPs = subnetInfo.HostIPs; IsDetailsVisible = true; }