예제 #1
0
        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();
                }
            }
        }
예제 #2
0
        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();
            }
        }
예제 #3
0
        void UpdateUI(DataRow dr)
        {
            this.txtMsgReplace.TextChanged          -= new System.EventHandler(this.txtMsgReplace_TextChanged);
            this.txtAPIReplace.TextChanged          -= new System.EventHandler(this.txtAPIReplace_TextChanged);
            this.txtDNSReplace.TextChanged          -= new System.EventHandler(this.txtMsgReplace_TextChanged);
            this.cmbMsgActionE.SelectedIndexChanged -= new System.EventHandler(this.cmbMsgActionE_SelectedIndexChanged);
            this.cmbAPIActionE.SelectedIndexChanged -= new System.EventHandler(this.cmbAPIActionE_SelectedIndexChanged);
            this.cmbDNSActionE.SelectedIndexChanged -= new System.EventHandler(this.cmbDNSActionE_SelectedIndexChanged);

            if (dr["id"].ToString() != String.Empty)
            {
                txtName.Text       = dr["id"].ToString();
                chkEnabled.Checked = (bool)dr["enabled"];
                foreach (byte b in (byte[])dr["MsgFunction"])
                {
                    chkMsg.SetItemChecked(chkMsg.FindStringExact(sinfo.msg(b)), true);
                }
                txtMsgCatch.Text = dr["MsgCatch"].ToString();
                switch ((byte)dr["MsgAction"])
                {
                case Glob.ActionReplaceString:
                    rdoMsgActionR.Checked = true;
                    break;

                case Glob.ActionReplaceStringH:
                    rdoMsgActionR.Checked = true;
                    rdoMsgMethodH.Checked = true;
                    break;

                case Glob.ActionError:
                    rdoMsgActionE.Checked = true;
                    break;

                case Glob.ActionErrorH:
                    rdoMsgActionE.Checked = true;
                    rdoMsgMethodH.Checked = true;
                    break;
                }
                txtMsgReplace.Text = dr["MsgReplace"].ToString();
                cmbMsgActionE.Text = sinfo.error((int)dr["MsgError"]);
                foreach (byte b in (byte[])dr["APIFunction"])
                {
                    chkAPI.SetItemChecked(chkAPI.FindStringExact(sinfo.api(b)), true);
                }
                txtAPICatch.Text = dr["APICatch"].ToString();
                switch ((byte)dr["APIAction"])
                {
                case Glob.ActionReplaceString:
                    rdoAPIActionR.Checked = true;
                    break;

                case Glob.ActionReplaceStringH:
                    rdoAPIActionR.Checked = true;
                    rdoAPIMethodH.Checked = true;
                    break;

                case Glob.ActionError:
                    rdoAPIActionE.Checked = true;
                    break;

                case Glob.ActionErrorH:
                    rdoAPIActionE.Checked = true;
                    rdoAPIMethodH.Checked = true;
                    break;
                }
                txtAPIReplace.Text = dr["APIReplace"].ToString();
                cmbAPIActionE.Text = sinfo.error((int)dr["APIError"]);
                foreach (byte b in (byte[])dr["DNSFunction"])
                {
                    chkDNS.SetItemChecked(chkDNS.FindStringExact(sinfo.api(b)), true);
                }
                txtDNSCatch.Text = dr["DNSCatch"].ToString();
                switch ((byte)dr["DNSAction"])
                {
                case Glob.ActionReplaceString:
                    rdoDNSActionR.Checked = true;
                    break;

                case Glob.ActionReplaceStringH:
                    rdoDNSActionR.Checked = true;
                    rdoDNSMethodH.Checked = true;
                    break;

                case Glob.ActionError:
                    rdoDNSActionE.Checked = true;
                    break;

                case Glob.ActionErrorH:
                    rdoDNSActionE.Checked = true;
                    rdoDNSMethodH.Checked = true;
                    break;
                }
                txtDNSReplace.Text = dr["DNSReplace"].ToString();
                cmbDNSActionE.Text = sinfo.error((int)dr["DNSError"]);
            }
            else
            {
                cmbMsgActionE.Text = "NO_ERROR";
                cmbAPIActionE.Text = "NO_ERROR";
                cmbDNSActionE.Text = "NO_ERROR";
            }
            this.txtMsgReplace.TextChanged          += new System.EventHandler(this.txtMsgReplace_TextChanged);
            this.txtAPIReplace.TextChanged          += new System.EventHandler(this.txtAPIReplace_TextChanged);
            this.txtDNSReplace.TextChanged          += new System.EventHandler(this.txtMsgReplace_TextChanged);
            this.cmbMsgActionE.SelectedIndexChanged += new System.EventHandler(this.cmbMsgActionE_SelectedIndexChanged);
            this.cmbAPIActionE.SelectedIndexChanged += new System.EventHandler(this.cmbAPIActionE_SelectedIndexChanged);
            this.cmbDNSActionE.SelectedIndexChanged += new System.EventHandler(this.cmbDNSActionE_SelectedIndexChanged);
        }