public IPAddress(ref string[] address1, ref string[] address2, bool isDecimal) { if (isDecimal) { IPConversions IPC = new IPConversions(ref address1, IPType.Decimal); IPC.ConvertAddress(); _address1 = IPC.GetBinaryIp().Split('.', ':', ' '); FirstOctet = address1[0]; IPC = new IPConversions(ref address2, IPType.Decimal); IPC.ConvertAddress(); _address2 = IPC.GetBinaryIp().Split('.', ':', ' '); _subnetMaskAddress = IPC.GetBinaryIp(); } else { IPConversions IPC = new IPConversions(ref address1, IPType.Binary); IPC.ConvertAddress(); FirstOctet = IPC.GetDecimalIp().Split('.', ':', ' ')[0]; _address1 = address1; IPC = new IPConversions(ref address2, IPType.Binary); IPC.ConvertAddress(); _address2 = address2; _subnetMaskAddress = IPC.GetBinaryIp(); } }
partial void IPAddress_Changed(UITextField sender) { if (IPAddress_TextBox.Text != "") { string[] inputSplit = IPAddress_TextBox.Text.Split('.', ' ', ':'); if (inputSplit.Length == 4) { if (ConvertsToDecimal(ref inputSplit)) { IPConversions ip = new IPConversions(ref inputSplit, IPType.Decimal); ip.ConvertAddress(); Results_TextBox.Text = ip.GetBinaryIp(); IPAddress_TextBox.Text = ip.GetDecimalIp(); } else if (ConvertsToBinary(ref inputSplit)) { IPConversions ip = new IPConversions(ref inputSplit, IPType.Binary); ip.ConvertAddress(); Results_TextBox.Text = ip.GetDecimalIp(); IPAddress_TextBox.Text = ip.GetBinaryIp(); } else { Results_TextBox.Text = ""; } } } }
private string getHostRange(int index) { char[] subnet = subnetArray[index, 0].ToCharArray(); subnet[IPAddressSize - 1] = '1'; string[] decimalAddressArray = BroadcastID[index].Split('.', ':', ' '); converter = new IPConversions(ref decimalAddressArray, IPType.Decimal); converter.ConvertAddress(); char[] subnet2 = converter.GetBinaryIp().ToCharArray(); subnet2[IPAddressSize - 1] = '0'; string[] binaryAddressArray = (new string(subnet)).Split('.', ' ', ':'); converter = new IPConversions(ref binaryAddressArray, IPType.Binary); converter.ConvertAddress(); string lowRange = converter.GetDecimalIp(); string[] binaryAddressArray2 = (new string(subnet2)).Split('.', ':', ' '); converter = new IPConversions(ref binaryAddressArray2, IPType.Binary); converter.ConvertAddress(); string highRange = converter.GetDecimalIp(); HostRange[index] = lowRange + " - " + highRange; return(lowRange + " - " + highRange); }