Пример #1
0
        public racProfile getCurrentProfile()
        {
            racProfile racP = new racProfile("Default", "Default", "", "disabled");

            foreach (racProfile r in _racProfiles)
            {
                if (r.bEnabled == true)
                {
                    racP = r;
                    break;
                }
            }
            return(racP);
        }
Пример #2
0
        public List <racProfile> listRACprofiles()
        {
            _myRacProfiles.Clear();
            List <string> lRet = new List <string>();
            //RegistryKey rKey = Registry.LocalMachine.OpenSubKey(@"Software\wpa_supplicant\configs\Intermec\networks",false);
            const string subKey = @"HKEY_LOCAL_MACHINE\\Software\wpa_supplicant\configs\Intermec\networks";

            //try 0 to 19
            for (int i = 0; i < 20; i++)
            {
                try
                {
                    //string sVal = (string)rKey.GetValue(i.ToString());
                    string sProfileSubKey = (string)Registry.GetValue(subKey, i.ToString(), "");
                    if (sProfileSubKey.Length > 0)
                    {
                        //read the Profile settings subkey
                        string sLabel = (string)Registry.GetValue(subKey + "\\" + sProfileSubKey, "ProfileName", "");
                        string sSSID  = (string)Registry.GetValue(subKey + "\\" + sProfileSubKey, "ssid", "");
                        sSSID = sSSID.Trim(new char[] { '"' });

                        //the registry holds a disbaled value whereas the xml holds an enabled value
                        string sDisabled = (string)Registry.GetValue(subKey + "\\" + sProfileSubKey, "disabled", "");

                        racProfile racProf = new racProfile(sProfileSubKey, sLabel, sSSID, sDisabled);
                        Logger.WriteLine("listRACprofiles found: " + racProf.ToString());
                        _myRacProfiles.Add(racProf);
                    }
                }
                catch (Exception ex)
                {
                    Logger.WriteLine("Exception in listRACprofiles read networks. " + ex.Message);
                }
            }
            //sort rac profiles by profile1 and profile2
            _myRacProfiles.Sort(new MobileConfiguration.myCompareString());

            return(_myRacProfiles);
        }