GEMTI18

______///////

Minggu, 28 Juni 2015

Membuat Aplikasi Deteksi Device Manager Visual Studio


Aplikasi Deteksi Device Manager
Aplikasi Deteksi Device Manager
Sebuah aplikasi yang menampilkan data hardware atau komponen lain yang berfungsi ketika kita menjalankan salah satu akses pada jaringan yang dipakai. 


Layout/Interface



Rincian Codding

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net.NetworkInformation;
using System.Collections;

namespace pert4_Aplikasi_Deteksi_Device_Manager
{
    public partial class Form1 : Form
    {
        private NetworkInterface[] nicArr;
        public Form1()
        {
            InitializeComponent();
            InitializeNetworkInterface();
        }

        public void InitializeNetworkInterface()
        {
            nicArr = NetworkInterface.GetAllNetworkInterfaces();

            for (int i = 0; i < nicArr.Length; i++)
            {
                comboBox1.Items.Add(nicArr[i].Name);
            }
            comboBox1.SelectedIndex = 0;
        }

        public void networkproc()
        {
            NetworkInterface nic = nicArr[comboBox1.SelectedIndex];//Secara otomatis network interface yang ada akan terdaftar pada ComboBax1
            IPGlobalProperties global_propertise = IPGlobalProperties.GetIPGlobalProperties();
            ArrayList info = new ArrayList();

            info.Add("Interface Information for: " + global_propertise.HostName + global_propertise.DomainName);
            info.Add("NetBIOS node type : " + global_propertise.NodeType);
            info.Add("================================================== ");
            info.Add("Name: " + nic.Name); info.Add("Description : " + nic.Description);
            info.Add("Network Interface Type : " + nic.NetworkInterfaceType);
            info.Add("Physical Address : " + nic.GetPhysicalAddress().ToString());// Info MAC Address yang di pakai
            info.Add("Adapter ID: " + nic.Id.ToString());
            info.Add("Receive Only: " + nic.IsReceiveOnly.ToString());
            info.Add("Status : " + nic.OperationalStatus.ToString());
            info.Add("Speed : " + nic.Speed.ToString());
            IPInterfaceProperties properties = nic.GetIPProperties();
            info.Add("Properties: "); info.Add(" |DNS Addresses : ");

            foreach (IPAddressInformation uniCast in properties.UnicastAddresses)
                info.Add(" -> : " + uniCast.Address.ToString());
            info.Add(" | AnyCast Addresses: ");
            foreach (IPAddressInformation anycast in properties.AnycastAddresses)
                info.Add(" -> : " + anycast.Address.ToString());
            info.Add(" |Support multi-cast : " + nic.SupportsMulticast.ToString());
            info.Add(" |Multicast Addresses: ");
            foreach (IPAddressInformation multicast in properties.MulticastAddresses)
                info.Add(" -> : " + multicast.Address.ToString());
            info.Add(" |Gateway Addresses : ");
            foreach (GatewayIPAddressInformation gateway in properties.GatewayAddresses)
                info.Add(" -> : " + gateway.Address.ToString());

            if (nic.Supports(NetworkInterfaceComponent.IPv4) == true)
            {
                IPv4InterfaceProperties ipv4props = properties.GetIPv4Properties();
                info.Add("+IPV4 Properties : ");
                if (ipv4props != null)
                {
                    info.Add(" |Interface Index : " + ipv4props.Index.ToString());
                    info.Add(" |Automatic Private Addressing Active : " + ipv4props.IsAutomaticPrivateAddressingActive.ToString());
                    info.Add(" |Automatic Private Addressing Enabled : " + ipv4props.IsAutomaticPrivateAddressingEnabled.ToString());
                    info.Add(" |DHCP Enabled : " + ipv4props.IsDhcpEnabled.ToString());
                    info.Add(" |Forwadding Enabled: " + ipv4props.IsForwardingEnabled.ToString());
                    info.Add(" |MTU Size : " + ipv4props.Mtu.ToString());
                    info.Add(" |\\Uses Wins : " + ipv4props.UsesWins.ToString());
                }
                else
                {
                    info.Add(" |Device has no Ipv4 properties : ");
                }
            }
            else
            {
                info.Add(" |+IPv4 is not implemented : ");
            }
            if (nic.Supports(NetworkInterfaceComponent.IPv6) == true)
            {
                IPv6InterfaceProperties ipv6props = properties.GetIPv6Properties();
                info.Add(" +IPV6 Properties : ");
                if (ipv6props != null)
                {
                    info.Add(" +IPV6 Properties : ");
                    info.Add(" |Interface Index : " + ipv6props.Index.ToString());
                    info.Add(" \\MTU Size : " + ipv6props.Mtu.ToString());
                }
                else
                {
                    info.Add(" |Device has no IPV6 properties");
                }
            }
            else
            {
                info.Add(" +IPV6 is not Implemented");
            }
            foreach (string a in info)
            {
                listBox1.Items.Add(a);
            }
        }

        private void bget_Click(object sender, EventArgs e)
        {
            listBox1.Items.Clear();
            networkproc();
        }
    }
}


Hasil Aplikasi Deteksi Device Manager

INGAT!!
Jika Anda kurang puas atau ingin menambahkan ide
Anda dapat mengkostumnya di Form/View code nya

Untuk keterangan lebih lanjut lihat slide
Download Slide
Download Program

0 komentar:

Posting Komentar

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More