コード例 #1
0
ファイル: MainForm.cs プロジェクト: hpluijm/NetCalc
        private void nextSubnetButt_Click(object sender, System.EventArgs e)
        {
            if (ip == null || ip.getIp() == null || fill)
            {
                return;
            }
            nextNumOfHosts.BackColor = Color.White;

            try
            {
                int hosts = Int32.Parse(nextNumOfHosts.Text);

                IPTool newIp = ip.getNextSubNet(hosts);
                if (newIp == null)
                {
                    //ToManyHosts
                    noticeLabel.Text = "Info stuff: Number of hosts in this network-class not possible!";
                    return;
                }
                ip             = newIp;
                ipAddress.Text = ip.getIp();
            }
            catch (System.FormatException)
            {
                nextNumOfHosts.BackColor = Color.Red;
                return;
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.StackTrace);
                return;
            }

            fillIPCalc();
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: hpluijm/NetCalc
        private void prefixComboBox_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (ip == null || ip.getIp() == null || fill)
            {
                return;
            }
            if (ip.getNetworkClassPrefix() == -1)
            {
                return;
            }

            int prefix = Int32.Parse((string)prefixComboBox.SelectedItem);

            ip.setNetworkPrefix(prefix);

            fillIPCalc();
        }