Ejemplo n.º 1
0
        private void frmStationRegisterMain_Load(object sender, EventArgs e)
        {
            string macAddr = "";

            // 如果配置文件中设置了 MAC 地址,并且指明使用 MAC 地址,则读取该配置的 MAC 地址
            string strCFGFileName = string.Format(@"{0}\IRAP.ini",
                                                  AppDomain.CurrentDomain.BaseDirectory);
            bool usingVirtualAddr = IniFile.ReadBool(
                "Virtual Station",
                "Virtual Station Used",
                false,
                strCFGFileName);

            if (usingVirtualAddr)
            {
                macAddr = IniFile.ReadString(
                    "Virtual Station",
                    "Virtual Station",
                    "",
                    strCFGFileName);
            }

            if (macAddr.Trim() != "")
            {
                cboMadAddress.Properties.Items.Add(macAddr);
            }

            string macAddresses = RDPClientMAC.GetRDPMacAddress();

            string[] arrMacAddress = macAddresses.Split(';');
            for (int i = 0; i < arrMacAddress.Length; i++)
            {
                cboMadAddress.Properties.Items.Add(arrMacAddress[i]);
            }

            if (cboMadAddress.Properties.Items.Count > 0)
            {
                cboMadAddress.SelectedIndex = 0;
            }
        }
Ejemplo n.º 2
0
        public StationUser()
        {
            macAddress = "";

            // 获取当前的 IP 地址
            HostToIP(ref ipAddress);

            // 如果配置文件中设置了 MAC 地址,并且指明使用 MAC 地址,则读取该配置的 MAC 地址
            string strCFGFileName = string.Format(@"{0}\IRAP.ini",
                                                  AppDomain.CurrentDomain.BaseDirectory);
            bool usingVirtualAddr = IniFile.ReadBool(
                "Virtual Station",
                "Virtual Station Used",
                false,
                strCFGFileName);

            if (usingVirtualAddr)
            {
                macAddress = IniFile.ReadString(
                    "Virtual Station",
                    "Virtual Station",
                    "",
                    strCFGFileName);
            }

            if (macAddress.Trim() == "")
            {
                string   macAddresses  = RDPClientMAC.GetRDPMacAddress();
                string[] arrMacAddress = macAddresses.Split(';');
                if (arrMacAddress.Length > 0)
                {
                    macAddress = arrMacAddress[0];
                }
                else
                {
                    macAddress = "FFFFFFFFFFFF";
                }
            }
        }