Ejemplo n.º 1
0
        private void buttonRefresh_Click(object sender, EventArgs e)
        {
            BindingList <DHCPClientDisplayItem> bindingList = new BindingList <DHCPClientDisplayItem>();

            try
            {
                DHCPServerConfigurationList configurationList =
                    DHCPServerConfigurationList.Read(Program.GetConfigurationPath());

                foreach (DHCPServerConfiguration configuration in configurationList)
                {
                    try
                    {
                        DHCPClientInformation clientInformation =
                            DHCPClientInformation.Read(
                                Program.GetClientInfoPath(configuration.Name, configuration.Address));

                        foreach (DHCPClient client in clientInformation.Clients)
                        {
                            bindingList.Add(new DHCPClientDisplayItem(configuration.Name, configuration.Address, client, m_MACTaster.Taste(client.HardwareAddress)));
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            catch (Exception)
            {
            }

            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource          = bindingList;
        }
Ejemplo n.º 2
0
 public FormConfigureOverview(string configurationPath)
 {
     InitializeComponent();
     m_ConfigurationPath = configurationPath;
     m_ConfigurationList = DHCPServerConfigurationList.Read(m_ConfigurationPath);
     dataGridView1.AutoGenerateColumns = false;
     dataGridView1.DataSource          = m_ConfigurationList;
     UpdateButtonStatus();
 }
Ejemplo n.º 3
0
        protected override void OnStart(string[] args)
        {
            m_Configuration = DHCPServerConfigurationList.Read(Program.GetConfigurationPath());
            m_Servers       = new List <DHCPServerResurrector>();

            foreach (DHCPServerConfiguration config in m_Configuration)
            {
                m_Servers.Add(new DHCPServerResurrector(config, m_EventLog));
            }
        }
        public static DHCPServerConfigurationList Read(string file)
        {
            DHCPServerConfigurationList result;

            if (File.Exists(file))
            {
                using (Stream s = File.OpenRead(file))
                {
                    result = (DHCPServerConfigurationList)serializer.Deserialize(s);
                }
            }
            else
            {
                result = new DHCPServerConfigurationList();
            }

            return(result);
        }