Beispiel #1
0
        public static void AddHost(string ip, string name, string desc, bool use, bool addLine)
        {
            List <HostItem> hosts = HostsDal.GetHosts("");
            HostItem        item  = new HostItem(ip, name, desc, use, addLine);

            hosts.Add(item);
            HostsDal.SaveHosts("", hosts);
        }
Beispiel #2
0
        private void BindHosts(string name)
        {
            this.dataGridView1.Rows.Clear();
            List <HostItem> hosts = HostsDal.GetHosts(name);

            if (hosts != null)
            {
                foreach (HostItem item in hosts)
                {
                    this.dataGridView1.Rows.Add(new object[] { item.IP, item.Name, item.Description, item.IsUsing, item.AddLine });
                }
            }
        }
Beispiel #3
0
        public static void LoadHosts()
        {
            List <HostItem> hosts = HostsDal.GetHosts("");

            foreach (HostItem item in hosts)
            {
                if (item.IsUsing)
                {
                    string hostline = string.Format("{0} {1} #{2}", item.IP, item.Name, item.Description);
                    Console.WriteLine(hostline);
                }
                else
                {
                    string hostline = string.Format("#{0} {1} #{2}", item.IP, item.Name, item.Description);
                    Console.WriteLine(hostline);
                }
            }
        }