Exemple #1
0
        private M项目 构造HTTP项目()
        {
            var __项目 = new M项目
            {
                当前通信设备 = new List <M设备映射>(),
                功能码查询  = (e1, e2, e3) => new M功能(),
                称      = "访问网站",
                设备类型列表 = new List <string> {
                    "服务器", "客户端"
                },
                设备通信模板 = new List <M设备映射>
                {
                    new M设备映射 {
                        IP1 = IPAddress.Any, IP2 = IPAddress.Any, TCP = true, 端口1 = 80, 端口2 = 0, 启用 = true, 设备类型1 = "服务器", 设备类型2 = "客户端"
                    },
                    new M设备映射 {
                        IP1 = IPAddress.Any, IP2 = IPAddress.Any, TCP = true, 端口1 = 8080, 端口2 = 0, 启用 = true, 设备类型1 = "服务器", 设备类型2 = "客户端"
                    },
                    new M设备映射 {
                        IP1 = IPAddress.Any, IP2 = IPAddress.Any, TCP = true, 端口1 = 8070, 端口2 = 0, 启用 = true, 设备类型1 = "服务器", 设备类型2 = "客户端"
                    },
                },
                业务类型列表 = new List <string> {
                    ""
                }
            };

            __项目.当前通信设备 = new List <M设备映射>(__项目.设备通信模板);

            __项目.解码器 = ((M解码前报文 e1) =>
            {
                if (__项目.当前通信设备.Count == 0)
                {
                    return(null);
                }
                return(new M解码后报文
                {
                    TCP = e1.TCP,
                    发送方 = e1.发送方IP + ":" + e1.发送方端口号,
                    发送方设备类型 = "",
                    概述 = "",
                    功能码 = "",
                    接收方 = e1.接收方IP + ":" + e1.接收方端口号,
                    接收方设备类型 = "",
                    码流 = e1.码流,
                    时间 = e1.时间,
                    详述 = new List <M信息> {
                        new M信息 {
                            键 = "解码", 值 = Encoding.UTF8.GetString(e1.码流)
                        }
                    },
                    业务 = "",
                });
            });
            return(__项目);
        }
Exemple #2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            this.Text += "  -  " + Assembly.GetExecutingAssembly().GetName().Version.ToString();

            this.out来源_文件.Enabled = false;

            var __网卡列表 = CaptureDeviceList.Instance.ToList();

            this.in网卡.Properties.DisplayFormat.Format = new B显示声卡();
            this.in网卡.Properties.Items.AddRange(__网卡列表);
            var __当前网卡索引 = H程序配置.获取Int32值("当前网卡索引");

            if (__网卡列表.Count > __当前网卡索引)
            {
                this.in网卡.SelectedIndex = __当前网卡索引;
            }
            var __项目列表 = _B项目.获取所有();

            this.in项目.Properties.Items.AddRange(__项目列表);
            var __当前项目索引 = H程序配置.获取Int32值("当前项目索引");

            if (__项目列表.Count > __当前项目索引)
            {
                this.in项目.SelectedIndex = __当前项目索引;
            }

            _当前项目 = 浅复制(__项目列表[__当前项目索引]);
            _设备类型列表.AddRange(_当前项目.设备类型列表);
            //this.in设备类型1.DataSource = _设备类型列表;
            //this.in设备类型2.DataSource = _设备类型列表;
            this.in设备类型11.Items.AddRange(_设备类型列表);
            this.in设备类型22.Items.AddRange(_设备类型列表);

            this._数据源 = new BindingSource {
                DataSource = _当前项目.当前通信设备, AllowNew = true
            };
            //this.out设备.DataSource = _数据源;
            this.out表格控件.DataSource = _数据源;

            this.do分析.Click                += do分析_Click;
            this.do仅录像.Click               += do仅录像_Click;
            this.do加载模板.Click              += do加载模板_Click;
            this.do网卡_详细信息.Click           += do网卡_详细信息_Click;
            this.do文件_导入文件.Click           += do文件_导入文件_Click;
            this.in项目.SelectedIndexChanged += in项目_SelectedIndexChanged;
            this.in来源_文件.CheckedChanged    += in来源_CheckedChanged;
            //this.in来源_网卡.CheckedChanged += in来源_CheckedChanged;

            this.out列表.ValidatingEditor += out列表_ValidatingEditor;
            SplashScreenManager.CloseForm(false);
        }
Exemple #3
0
        void in项目_SelectedIndexChanged(object sender, EventArgs e)
        {
            this._数据源.Clear();
            var __项目 = (M项目)this.in项目.SelectedItem;

            _当前项目 = 浅复制(__项目);
            _设备类型列表.Clear();
            _设备类型列表.AddRange(_当前项目.设备类型列表);
            //this.in设备类型1.DataSource = _设备类型列表;
            //this.in设备类型2.DataSource = _设备类型列表;
            this.in设备类型11.Items.AddRange(_设备类型列表);
            this.in设备类型22.Items.AddRange(_设备类型列表);
            this._数据源.DataSource = _当前项目.当前通信设备;
            this._数据源.ResetBindings(false);
        }
Exemple #4
0
        private M项目 浅复制(M项目 __源)
        {
            var __目的 = new M项目
            {
                当前通信设备 = new List <M设备映射>(__源.当前通信设备),
                功能码查询  = __源.功能码查询,
                解码器    = __源.解码器,
                称      = __源.称,
                设备类型列表 = new List <string>(__源.设备类型列表),
                设备通信模板 = new List <M设备映射>(__源.设备通信模板),
                业务类型列表 = new List <string>(__源.业务类型列表),
                默认内容过滤 = new List <string>(__源.默认内容过滤),
                默认业务过滤 = new List <string>(__源.默认业务过滤)
            };

            return(__目的);
        }
Exemple #5
0
        private M项目 构造空项目()
        {
            var __项目 = new M项目
            {
                当前通信设备 = new List <M设备映射>(),
                功能码查询  = (e1, e2, e3) => null,
                解码器    = ((M解码前报文 e1) => new M解码后报文
                {
                    TCP = e1.TCP,
                    发送方 = e1.发送方IP.ToString() + ":" + e1.发送方端口号,
                    发送方设备类型 = "未指定",
                    概述 = "",
                    功能码 = "",
                    接收方 = e1.接收方IP.ToString() + ":" + e1.接收方端口号,
                    接收方设备类型 = "未指定",
                    码流 = e1.码流,
                    时间 = e1.时间,
                    详述 = null,
                    业务 = "未指定",
                }),
                称      = "空",
                设备类型列表 = new List <string> {
                    "未指定"
                },
                设备通信模板 = new List <M设备映射>
                {
                    new M设备映射 {
                        IP1 = IPAddress.Any, IP2 = IPAddress.Any, TCP = true, 端口1 = 0, 端口2 = 0, 启用 = true, 设备类型1 = "未指定", 设备类型2 = "未指定"
                    },
                    new M设备映射 {
                        IP1 = IPAddress.Any, IP2 = IPAddress.Any, TCP = false, 端口1 = 0, 端口2 = 0, 启用 = true, 设备类型1 = "未指定", 设备类型2 = "未指定"
                    }
                },
                业务类型列表 = new List <string> {
                    "未指定"
                }
            };

            __项目.当前通信设备 = new List <M设备映射>(__项目.设备通信模板);
            return(__项目);
        }