Beispiel #1
0
        /// <summary>
        /// 加载网卡信息
        /// </summary>
        public void LoadNetCard()
        {
            eagle_all_netcards nics = new eagle_all_netcards();
            int ret = SDKApi.EagleControl_GetSystemNICs(ref nics);

            for (int i = 1; i <= nics.card_num; i++)
            {
                // LogHelper.WriteLog(string.Format("{0} : {1}\n", i, nics.cards[i - 1].dev_description));
            }
            var settingModel = _container.Resolve <SettingsViewModel>();

            for (int i = 0; i < nics.cards.Count(); i++)
            {
                if (!string.IsNullOrEmpty(nics.cards[i].dev_name))
                {
                    if (i == Settings.Default.NetCardIndex)
                    {
                        settingModel.CurrentNetCard = nics.cards[i].dev_description;
                    }
                    settingModel.NetCardInfos.Add(new Models.NetCardInfo()
                    {
                        dev_name = nics.cards[i].dev_name, dev_description = nics.cards[i].dev_description
                    });
                }
            }
        }
Beispiel #2
0
        private void OnSDKInit()
        {
            //获取存储SDK 版本
            int major = 0, minor = 0;

            //SetConsoleCtrlHandler(CosonleHandler, TRUE);
            SDKApi.EagleData_GetVersion(ref major, ref minor);
            Console.WriteLine(string.Format("SDK Version: {0}.{1}\n", major, minor));
            LogHelper.WriteLog(string.Format("SDK Version: {0}.{1}\n", major, minor));
            //所有在本地计算机上网卡列表

            eagle_all_netcards nics = new eagle_all_netcards();

            int ret = SDKApi.EagleControl_GetSystemNICs(ref nics);

            LogHelper.WriteLog(nics.card_num.ToString());

            for (int i = 1; i <= nics.card_num; i++)
            {
                LogHelper.WriteLog(string.Format("{0} : {1}\n", i, nics.cards[i - 1].dev_description));
            }

            /*
             * get device number
             */
            int device_num = 0;

            ret = SDKApi.EagleControl_ScanAndGetDeviceNum(ref device_num);
            LogHelper.WriteLog(string.Format("get device numbers {0}", device_num));

            /*
             * get device ids
             */
            int[] device_ids = new int[device_num];
            int   ids        = 0;
            //ret = SDKApi.EagleControl_GetDeviceIds(out device_ids, device_num, ref ids);
            //LogHelper.WriteLog("get device ids:\n");
            //for (int i = 0; i < ids; i++)
            //{
            //    LogHelper.WriteLog(string.Format(" ** {0}: device id {1}\n", i + 1, device_ids[i]));
            //}

            /*
             * init data api
             */
            var initdevice = SDKApi.EagleData_Init();

            LogHelper.WriteLog(string.Format("init eagle data {0}", initdevice));
        }
Beispiel #3
0
        /// <summary>
        /// 设置网卡
        /// </summary>
        /// <returns></returns>
        public int SetCurrentNetCard()
        {
            int cardIndex           = Properties.Settings.Default.NetCardIndex;
            eagle_all_netcards nics = new eagle_all_netcards();
            int ret = SDKApi.EagleControl_GetSystemNICs(ref nics);

            if (nics.card_num > 0)
            {
                var infoList = new eagle_netcard_info[10];
                infoList[0] = nics.cards[cardIndex];
                var setnice = new eagle_all_netcards();
                setnice.card_num = 1;
                setnice.cards    = infoList;
                ret = SDKApi.EagleControl_SetControlNICs(ref setnice);
            }
            return(ret);
        }