private static string RegRead(string KeyName) { return(UseReg((SubKey) => { return (string)SubKey.GetValue(KeyName); })); }
/// <summary> /// Loads IFEO items /// </summary> /// <returns>The state of load</returns> public bool Load() { Log.WriteLine("Load registry"); IFEOKey = Registry.LocalMachine.OpenSubKey(Global.IFEORegPath, true); if (IFEOKey != null) { Items.Clear(); var items = from keyName in IFEOKey.GetSubKeyNames() let SubKey = IFEOKey.OpenSubKey(keyName, true) where SubKey != null where SubKey.GetValueNames().ToList().ConvertAll(d => d.ToLower()).IndexOf("debugger") > -1 select new IFEOItem { ManageByThis = ((string)GetValue(SubKey, "IFEOManage_Manage") == "True"), RegKey = SubKey, IFEOPath = (string)GetValue(SubKey, "IFEOManage_Path"), PEName = SubKey.Name.Split('\\').Last(), Debugger = SubKey.GetValue("Debugger").ToString(), Remark = (string)GetValue(SubKey, "IFEOManage_Remark"), RunMethod = (string)GetValue(SubKey, "IFEOManage_RunMethod") != "" ? (RunMethod)Enum.Parse(GetType(), (string)GetValue(SubKey, "IFEOManage_RunMethod")) : RunMethod.Close, }; foreach (var item in items) { _FormatDebuggerStringAndUpdate(item); Items.Add(item); } } else { Log.WriteLine("Cannot open registry"); Log.MessageBoxError((string)Application.Current.FindResource("cfmCannotOpenRegistry")); return(false); } return(true); }