public funkProfile getCurrentProfile() { const string subKey = @"HKEY_CURRENT_USER\Software\Intermec\80211Conf\Profiles"; int currentProfileInt = (int)Registry.GetValue(subKey, "ActiveProfile", -1); string currentProfileString = (string)Registry.GetValue(subKey, currentProfileInt.ToString(), ""); foreach (funkProfile r in _funkProfiles) { if (r.sProfileRekKey == currentProfileString) { _currentFunkProfile = r; break; } } return(_currentFunkProfile); }
public List <funkProfile> listFUNKprofiles() { _myFunkProfiles.Clear(); List <string> lRet = new List <string>(); //RegistryKey rKey = Registry.LocalMachine.OpenSubKey(@"Software\wpa_supplicant\configs\Intermec\networks",false); const string subKey = @"HKEY_CURRENT_USER\Software\Intermec\80211Conf\Profiles"; int currentProfileInt = (int)Registry.GetValue(subKey, "ActiveProfile", -1); string currentProfileString = (string)Registry.GetValue(subKey, currentProfileInt.ToString(), ""); //try 0 to 19 for (int i = 0; i < 4; i++) { try { //string sVal = (string)rKey.GetValue(i.ToString()); string sProfileSubKey = (string)Registry.GetValue(subKey, i.ToString(), ""); //this will be the name of the subkey, ie Profile_1 to Profile_4 if (sProfileSubKey.Length > 0) { //read the Profile settings subkey string sLabel = (string)Registry.GetValue(subKey + "\\" + sProfileSubKey, "ProfileLabel", ""); string sSSID = (string)Registry.GetValue(subKey + "\\" + sProfileSubKey, "SSID", ""); string sName = sProfileSubKey; sSSID = sSSID.Trim(new char[] { '"' }); funkProfile funkProf = new funkProfile(sProfileSubKey, sLabel, sName, sSSID); Logger.WriteLine("listFunkprofiles found: " + funkProf.ToString()); _myFunkProfiles.Add(funkProf); if (funkProf.sProfileRekKey == currentProfileString) { _currentFunkProfile = funkProf; Logger.WriteLine("## Current Profile: " + currentProfileString); } } } catch (Exception ex) { Logger.WriteLine("Exception in listFunkProfiles read networks. " + ex.Message); } } //sort rac profiles by profile1 and profile2 _myFunkProfiles.Sort(new MobileConfiguration.myCompareString()); return(_myFunkProfiles); }