public void LoadSettings(MsBuildConfiguration[] configs) { originalConfig = Configuration.Debug.LoadFrom(configs); config = originalConfig.Clone(); radioButton1.CheckedChanged += (src, arg) => { if (radioButton1.Checked) config.StartAction = Configuration.StartAction.Project; else config.StartAction = Configuration.StartAction.Program; externalProg.Enabled = !radioButton1.Checked; browseProg.Enabled = !radioButton1.Checked; }; radioButton1.Checked = config.StartAction == Configuration.StartAction.Project; radioButton2.Checked = !radioButton1.Checked; externalProg.Text = config.ExternalProgram; externalProg.TextChanged += (src, arg) => config.ExternalProgram = externalProg.Text; commandLineArgs.Text = config.CommandLineArgs; commandLineArgs.TextChanged += (src, arg) => config.CommandLineArgs = commandLineArgs.Text; workDir.Text = config.WorkingDir; workDir.TextChanged += (src, arg) => config.WorkingDir = workDir.Text; debuggerScript.Text = config.DebuggerScript; debuggerScript.TextChanged += (src, erg) => config.DebuggerScript = debuggerScript.Text; config.Changed += (src, arg) => isDirty(config.HasChangedFrom(originalConfig)); }
private static Debug LoadFromForConfig(MsBuildConfiguration cfg) { var x = new Debug(); x.StartActionQ = StartActionQFromString(cfg.GetConfigurationProperty("StartAction", false)); Utils.FromString(cfg.GetConfigurationProperty("StartProgram", false), out x.externalProgram); Utils.FromString(cfg.GetConfigurationProperty("StartArguments", false), out x.commandLineArgs); Utils.FromString(cfg.GetConfigurationProperty("StartWorkingDirectory", false), out x.workingDir); Utils.FromString(cfg.GetConfigurationProperty("StartDebuggerScript", false), out x.debuggerScript); return(x); }
public void ApplyConfig(MsBuildConfiguration[] configs) { config.SaveTo(configs); originalConfig = config.Clone(); }
public static Debug LoadFrom(MsBuildConfiguration[] configs) { return configs.Select(LoadFromForConfig).Aggregate((prev, cur) => { if(prev.StartActionQ != null && !EqualityComparer<StartAction?>.Default.Equals(prev.StartActionQ, cur.StartActionQ)) prev.StartActionQ = null; if(prev.ExternalProgram != null && !EqualityComparer<System.String>.Default.Equals(prev.ExternalProgram, cur.ExternalProgram)) prev.ExternalProgram = null; if(prev.CommandLineArgs != null && !EqualityComparer<System.String>.Default.Equals(prev.CommandLineArgs, cur.CommandLineArgs)) prev.CommandLineArgs = null; if(prev.WorkingDir != null && !EqualityComparer<System.String>.Default.Equals(prev.WorkingDir, cur.WorkingDir)) prev.WorkingDir = null; if(prev.DebuggerScript != null && !EqualityComparer<System.String>.Default.Equals(prev.DebuggerScript, cur.DebuggerScript)) prev.DebuggerScript = null; return prev; }); }
public void SaveTo(MsBuildConfiguration[] configs) { foreach(var cfg in configs) { if(StartActionQ != null) cfg.SetConfigurationProperty("StartAction", StartActionQToString(StartActionQ)); if(ExternalProgram != null) cfg.SetConfigurationProperty("StartProgram", ExternalProgram.ToString()); if(CommandLineArgs != null) cfg.SetConfigurationProperty("StartArguments", CommandLineArgs.ToString()); if(WorkingDir != null) cfg.SetConfigurationProperty("StartWorkingDirectory", WorkingDir.ToString()); if(DebuggerScript != null) cfg.SetConfigurationProperty("StartDebuggerScript", DebuggerScript.ToString()); } }
private static Debug LoadFromForConfig(MsBuildConfiguration cfg) { var x = new Debug(); x.StartActionQ = StartActionQFromString(cfg.GetConfigurationProperty("StartAction", false)); Utils.FromString(cfg.GetConfigurationProperty("StartProgram", false), out x.externalProgram); Utils.FromString(cfg.GetConfigurationProperty("StartArguments", false), out x.commandLineArgs); Utils.FromString(cfg.GetConfigurationProperty("StartWorkingDirectory", false), out x.workingDir); Utils.FromString(cfg.GetConfigurationProperty("StartDebuggerScript", false), out x.debuggerScript); return x; }