Пример #1
0
        protected void fillComboBox_NetworkMask()
        {
            if (ip == null || ip.getIp() == null)
            {
                return;
            }

            netMaskComboBox.Items.Clear();

            if (ip.getNetworkClassPrefix() == -1)
            {
                netMaskComboBox.Items.Add("");
                return;
            }

            int startPrefix = ip.getNetworkClassPrefix();

            // first is Networkclass
            netMaskComboBox.Items.Add(ip.getNetworkMaskByPrefix(startPrefix));
            startPrefix++;
            if (!ip.isFirstSubNetBit())
            {
                startPrefix++;
            }

            for (int i = startPrefix; i <= 30; i++)
            {
                netMaskComboBox.Items.Add(ip.getNetworkMaskByPrefix(i));
            }
        }