Example #1
0
        private void BtnLoad_Click(object sender, EventArgs e)
        {
            List <string> list111 = NetcardControlTool.GetList();

            MacList = NetCardInfoTool.GetNetworkCardInfo();
            if (Ls.Ok(MacList))
            {
                LbxNetworkList.Items.Clear();
                foreach (var item in MacList)
                {
                    LbxNetworkList.Items.Add(item.Item2);
                }
            }
        }
Example #2
0
        public static void StartNetCapture()
        {
            int span = 0;

            if (!NetCaptureRun)
            {
                NetCaptureRun = true;
                Task.Factory.StartNew(() =>
                {
                    //获取实时数据包
                    #region 设置IP
                    var networkInfo = NetCardInfoTool.GetNetworkCardInfo();
                    if (!ListTool.IsNullOrEmpty(networkInfo))
                    {
                        IP = networkInfo[0].Item3;
                    }
                    #endregion
                    GetNetBag();
                    GetNetProcess();//获取联网进程

                    while (NetCaptureLoop)
                    {
                        //if (span >= 1)
                        //{
                        //    GetNetProcess();//获取联网进程
                        //    span = 0;
                        //}
                        Thread.Sleep(1000);
                        CalcBagFlow();//计算进程流量
                        span++;
                    }
                    NS.IsStart    = false;
                    NetCaptureRun = false;
                });
            }
        }
Example #3
0
 /// <summary>
 /// 网卡信息
 /// 【名称、描述、物理地址(Mac)、Ip地址、网关地址】
 /// </summary>
 /// <returns></returns>
 public static List <Tuple <string, string, string, string, string> > NetworkCardInfo()
 {
     return(NetCardInfoTool.GetNetworkCardInfo());
 }