示例#1
0
文件: frmMain.cs 项目: asfydien/SiIP
        private void bkWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            // pasang profil

            string[] ipAdresses, subnets, gateways, dnses;

            string[] sArg  = e.Argument.ToString().Split('|');
            int      iNic  = int.Parse(sArg[0]);
            int      iProf = int.Parse(sArg[1]);

            WMIHelper.SetIP(nicNames[iNic].Caption,
                            profiles[iProf].IP,
                            profiles[iProf].Subnet,
                            profiles[iProf].Gateway,
                            profiles[iProf].DNS);

            // ambil profil yang sudah terpasang
            WMIHelper.GetIP(nicNames[iNic].Caption,
                            out ipAdresses, out subnets, out gateways, out dnses);

            // periksa apakah profil sudah terpasang?
            if (ArraysEqual(profiles[iProf].DNS.Split(','), dnses))
            {
                e.Result = 1;
            }
            else
            {
                e.Result = 0;
            }
        }
示例#2
0
文件: frmMain.cs 项目: asfydien/SiIP
        private void button3_Click(object sender, EventArgs e)
        {
            string[] ipAdresses, subnets, gateways, dnses;

            // ambil lagi profil yang sudah terpasang
            WMIHelper.GetIP(nicNames[cboxNetCard.SelectedIndex].Caption,
                            out ipAdresses, out subnets, out gateways, out dnses);

            Console.WriteLine(dnses[0]);
        }
示例#3
0
文件: frmMain.cs 项目: asfydien/SiIP
        void showCurrentConfig(int iNic)
        {
            string[] ipAdresses, subnets, gateways, dnses;

            // ambil lagi profil yang sudah terpasang
            WMIHelper.GetIP(nicNames[cboxNetCard.SelectedIndex].Caption,
                            out ipAdresses, out subnets, out gateways, out dnses);

            tbCurIP.Text      = gabungArrayIP(ipAdresses);
            tbCurSubnet.Text  = gabungArrayIP(subnets);
            tbCurGateway.Text = gabungArrayIP(gateways);
            tbCurDNS.Text     = gabungArrayIP(dnses);
        }