From de9026a99ec33363ffcbaaddf332d514254269e8 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Wed, 4 Oct 2006 14:41:54 +0000 Subject: [PATCH] Fixed SD2-1045: Opening a solution created in SharpDevelop in VS Express shows security warnings git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1878 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../ProjectOptions/AbstractBuildOptions.cs | 17 ++++++++++++-- .../Src/Project/ConfigurationGuiBinding.cs | 3 +++ .../Src/Project/ConfigurationGuiHelper.cs | 22 ++++++++++++++----- .../Project/Src/Project/MSBuildProject.cs | 4 ---- 4 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/AbstractBuildOptions.cs b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/AbstractBuildOptions.cs index e7f16b47d5..7b7fc44b60 100644 --- a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/AbstractBuildOptions.cs +++ b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/AbstractBuildOptions.cs @@ -24,13 +24,26 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels { protected void InitBaseIntermediateOutputPath() { - helper.BindString("baseIntermediateOutputPathTextBox", "BaseIntermediateOutputPath").CreateLocationButton("baseIntermediateOutputPathTextBox"); + helper.BindString(Get("baseIntermediateOutputPath"), + "BaseIntermediateOutputPath", + delegate { return @"obj\"; } + ).CreateLocationButton("baseIntermediateOutputPathTextBox"); ConnectBrowseFolder("baseIntermediateOutputPathBrowseButton", "baseIntermediateOutputPathTextBox", "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}"); } protected void InitIntermediateOutputPath() { - helper.BindString("intermediateOutputPathTextBox", "IntermediateOutputPath").CreateLocationButton("intermediateOutputPathTextBox"); + ConfigurationGuiBinding binding = helper.BindString( + Get("intermediateOutputPath"), + "IntermediateOutputPath", + delegate { + PropertyStorageLocations l; + return Path.Combine(helper.GetProperty("BaseIntermediateOutputPath", @"obj\", out l), + helper.Configuration); + } + ); + binding.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific; + binding.CreateLocationButton("intermediateOutputPathTextBox"); ConnectBrowseFolder("intermediateOutputPathBrowseButton", "intermediateOutputPathTextBox", "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}"); } diff --git a/src/Main/Base/Project/Src/Project/ConfigurationGuiBinding.cs b/src/Main/Base/Project/Src/Project/ConfigurationGuiBinding.cs index 1a5633cc87..5a672b7924 100644 --- a/src/Main/Base/Project/Src/Project/ConfigurationGuiBinding.cs +++ b/src/Main/Base/Project/Src/Project/ConfigurationGuiBinding.cs @@ -156,6 +156,9 @@ namespace ICSharpCode.SharpDevelop.Project public void Set(T value) { + if (location == PropertyStorageLocations.Unknown) { + location = defaultLocation; + } helper.SetProperty(property, value, location); } diff --git a/src/Main/Base/Project/Src/Project/ConfigurationGuiHelper.cs b/src/Main/Base/Project/Src/Project/ConfigurationGuiHelper.cs index 25d4438d09..c2b1127bc6 100644 --- a/src/Main/Base/Project/Src/Project/ConfigurationGuiHelper.cs +++ b/src/Main/Base/Project/Src/Project/ConfigurationGuiHelper.cs @@ -206,15 +206,22 @@ namespace ICSharpCode.SharpDevelop.Project #endregion #region Bind string to TextBox or ComboBox + static Func GetEmptyString = delegate { return ""; }; + public ConfigurationGuiBinding BindString(string control, string property) { - return BindString(controlDictionary[control], property); + return BindString(controlDictionary[control], property, GetEmptyString); } public ConfigurationGuiBinding BindString(Control control, string property) + { + return BindString(control, property, GetEmptyString); + } + + public ConfigurationGuiBinding BindString(Control control, string property, Func defaultValueProvider) { if (control is TextBoxBase || control is ComboBox) { - SimpleTextBinding binding = new SimpleTextBinding(control); + SimpleTextBinding binding = new SimpleTextBinding(control, defaultValueProvider); AddBinding(property, binding); control.TextChanged += ControlValueChanged; if (control is ComboBox) { @@ -237,20 +244,25 @@ namespace ICSharpCode.SharpDevelop.Project class SimpleTextBinding : ConfigurationGuiBinding { Control control; + Func defaultValueProvider; - public SimpleTextBinding(Control control) + public SimpleTextBinding(Control control, Func defaultValueProvider) { + this.defaultValueProvider = defaultValueProvider; this.control = control; } public override void Load() { - control.Text = Get(""); + control.Text = Get(defaultValueProvider()); } public override bool Save() { - Set(control.Text); + if (control.Text == defaultValueProvider()) + Set(""); + else + Set(control.Text); return true; } } diff --git a/src/Main/Base/Project/Src/Project/MSBuildProject.cs b/src/Main/Base/Project/Src/Project/MSBuildProject.cs index 10fd5b0141..cdd542d9aa 100644 --- a/src/Main/Base/Project/Src/Project/MSBuildProject.cs +++ b/src/Main/Base/Project/Src/Project/MSBuildProject.cs @@ -43,8 +43,6 @@ namespace ICSharpCode.SharpDevelop.Project BaseConfiguration.SetIsGuarded("Platform", true); configurations["Debug|*"] = new PropertyGroup(); - configurations["Debug|*"]["BaseIntermediateOutputPath"] = @"obj\"; - configurations["Debug|*"]["IntermediateOutputPath"] = @"obj\Debug\"; if (information.CreateProjectWithDefaultOutputPath) { configurations["Debug|*"]["OutputPath"] = @"bin\Debug\"; } @@ -54,8 +52,6 @@ namespace ICSharpCode.SharpDevelop.Project configurations["Debug|*"]["DebugType"] = "Full"; configurations["Release|*"] = new PropertyGroup(); - configurations["Release|*"]["BaseIntermediateOutputPath"] = @"obj\"; - configurations["Release|*"]["IntermediateOutputPath"] = @"obj\Release\"; if (information.CreateProjectWithDefaultOutputPath) { configurations["Release|*"]["OutputPath"] = @"bin\Release\"; }