private void _FormatDebuggerStringAndUpdate(IFEOItem Debugger) { if (Debugger.ManageByThis) { // Auto Update if (Debugger.Debugger != Global.IFEOExecution) { Log.WriteLine("Refresh Debugger(" + Debugger.PEName + ") From (" + Debugger.Debugger + ") To (" + Global.IFEOExecution + ")"); Debugger.RegKey.SetValue("Debugger", Global.IFEOExecution); Debugger.RegKey.SetValue("IFEOManage_Path", Global.IFEORunPath); } Debugger.ManageByThis = true; Debugger.Debugger = (string)Application.Current.FindResource("cfmManagedByThis"); } }
/// <summary> /// Save IFEO Item to Registry /// </summary> /// <param name="Item">The item.</param> /// <returns> /// true /// </returns> public bool Save(IFEOItem Item) { Log.WriteLine("Start Saving Key"); IFEOKey = Registry.LocalMachine.OpenSubKey(Global.IFEORegPath, true); try { Item.RegKey = IFEOKey.CreateSubKey(Item.PEName); Log.WriteLine("Create Sub Key(" + Item.PEName + ") Successfully."); } catch (Exception Ex) { Log.WriteLine("Error when creating Sub Key(" + Item.PEName + "): " + Ex.ToString()); Log.MessageBoxError((string)Application.Current.FindResource("cfmOpenSubKeyError") + "\n" + Item.PEName + "\n\n" + Ex.ToString()); return(false); } try { if (Item.Debugger == "") { Item.RegKey.DeleteValue("Debugger"); } else { Item.RegKey.SetValue("Debugger", Item.Debugger); } } catch (Exception Ex) { Log.WriteLine("Error when creating Debugger: " + Ex.ToString()); Log.MessageBoxError((string)Application.Current.FindResource("cfmCreateDebuggerError") + "\n" + Item.PEName + "\n\n" + Ex.ToString()); return(false); } Item.RegKey.SetValue("IFEOManage_Path", Global.IFEORunPath); Item.RegKey.SetValue("IFEOManage_Remark", Item.Remark); Item.RegKey.SetValue("IFEOManage_Manage", Item.ManageByThis); Item.RegKey.SetValue("IFEOManage_RunMethod", Item.RunMethod); Item.RegKey.Close(); Log.WriteLine("Saved key: " + Item.ToString()); Load(); return(true); }
private void btnSave_Click(object sender, RoutedEventArgs e) { Data.PEPath = Data.PEPath.Trim(); if (string.IsNullOrEmpty(Data.PEPath)) { return; } IFEOItem Item = new IFEOItem { ManageByThis = Data.ManageByThis, Debugger = Data.ManageByThis ? $@""" { Global.IFEOExecution } """ : Data.DebuggerPath, PEName = Data.PEPath, Remark = Data.Remark, RunMethod = Data.RunMethod }; IFEO.Save(Item); InitializeData(); // Refresh it }