public Sockets(DataTable dtSockets, Main.SockInfo sinfo, NamedPipeClientStream pout)
 {
     int i;
     InitializeComponent();
     pipeOut = pout;
     foreach (DataRow drow in dtSockets.Rows)
     {
         i = dgridSockets.Rows.Add();
         dgridSockets.Rows[i].Cells["socket"].Value = ((int)drow["socket"]).ToString("X4");
         if (drow["proto"].ToString() != String.Empty)
             dgridSockets.Rows[i].Cells["proto"].Value = sinfo.proto((int)drow["proto"]);
         if (drow["fam"].ToString() != String.Empty)
             if (((int)drow["fam"] >= 0) && ((int)drow["fam"] <= sinfo.afamily.Length - 1))
                 dgridSockets.Rows[i].Cells["fam"].Value = sinfo.afamily[(int)drow["fam"]];
         if (drow["type"].ToString() != String.Empty)
             if (((int)drow["type"] >= 0) && ((int)drow["type"] <= sinfo.atype.Length - 1))
                 dgridSockets.Rows[i].Cells["type"].Value = sinfo.atype[(int)drow["type"]];
         if (drow["lastapi"].ToString() != String.Empty)
             dgridSockets.Rows[i].Cells["lastapi"].Value = sinfo.api((int)drow["lastapi"]);
         if (drow["lastmsg"].ToString() != String.Empty)
             dgridSockets.Rows[i].Cells["lastmsg"].Value = sinfo.msg((int) drow["lastmsg"]);
         dgridSockets.Rows[i].Cells["local"].Value = drow["local"].ToString();
         dgridSockets.Rows[i].Cells["remote"].Value = drow["remote"].ToString();
     }
 }
        public Filters(DataTable dt, Main.SockInfo si)
        {
            InitializeComponent();
            dtFilters = dt;
            sinfo = si;
            int i;
            string funs;

            foreach (DataRow dr in dt.Rows)
            {
                i = dgridFilters.Rows.Add();
                funs = "";
                dgridFilters.Rows[i].Cells["name"].Value = dr["id"].ToString();
                dgridFilters.Rows[i].Cells["enabled"].Value = dr["enabled"];
                foreach (byte f in (byte[])dr["MsgFunction"])
                {
                    funs += si.msg(f) + " ";
                }
                foreach (byte f in (byte[])dr["APIFunction"])
                {
                    funs += si.api(f) + " ";
                }
                foreach (byte f in (byte[])dr["DNSFunction"])
                {
                    funs += si.api(f) + " ";
                }
                if (funs != string.Empty)
                {
                    dgridFilters.Rows[i].Cells["function"].Value = funs.TrimEnd();
                }
            }
        }
        public EditFilter(DataRow dr, Main.SockInfo si, DataTable dtFilters, DataGridView dgridFilters, int dgF_l)
        {
            InitializeComponent();
            drFilters = dr;
            sinfo = si;
            // the following parameters, need to update the grid of the Filters form
            dtF = dtFilters;
            dgF = dgridFilters; // the grid
            dgF_line = dgF_l; // the line to update

            UpdateUI(dr);
        }