From cd0113ff9c7445e78111be09e8b8079c698b92c2 Mon Sep 17 00:00:00 2001 From: Chris Kaczor Date: Sat, 6 Dec 2014 08:41:36 -0500 Subject: [PATCH] Change assembly used to get version and make sure to not delete old settings on upgrade --- Application/App.xaml.cs | 7 ++++--- Application/Options/AboutOptionsPanel.xaml.cs | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Application/App.xaml.cs b/Application/App.xaml.cs index 8f5dc44..bf8d0ba 100644 --- a/Application/App.xaml.cs +++ b/Application/App.xaml.cs @@ -48,7 +48,7 @@ namespace FeedCenter // Set the data directory based on debug or not AppDomain.CurrentDomain.SetData("DataDirectory", _useDebugPath - ? Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + ? Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) : UserSettingsPath); // Get the generic provider @@ -64,6 +64,7 @@ namespace FeedCenter genericProvider.SetSettingValue = SettingsStore.SetSettingValue; genericProvider.DeleteSettingsForVersion = SettingsStore.DeleteSettingsForVersion; genericProvider.GetVersionList = SettingsStore.GetVersionList; + genericProvider.DeleteOldVersionsOnUpgrade = false; // Initialize the tracer with the current process ID Tracer.Initialize(UserSettingsPath, FeedCenter.Properties.Resources.ApplicationName, Process.GetCurrentProcess().Id.ToString(CultureInfo.InvariantCulture), false); @@ -123,7 +124,7 @@ namespace FeedCenter { // If we're running in debug mode then use a local path for the database and logs if (_useDebugPath) - return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + return Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); // Get the path to the local application data directory var path = Path.Combine( @@ -159,7 +160,7 @@ namespace FeedCenter public static void SetDefaultFeedReader(bool value) { // Get the location of the assembly - var assemblyLocation = Assembly.GetExecutingAssembly().Location; + var assemblyLocation = Assembly.GetEntryAssembly().Location; // Open the registry key (creating if needed) using (var registryKey = Registry.CurrentUser.CreateSubKey("Software\\Classes\\feed", RegistryKeyPermissionCheck.ReadWriteSubTree)) diff --git a/Application/Options/AboutOptionsPanel.xaml.cs b/Application/Options/AboutOptionsPanel.xaml.cs index 0650640..3484e7d 100644 --- a/Application/Options/AboutOptionsPanel.xaml.cs +++ b/Application/Options/AboutOptionsPanel.xaml.cs @@ -19,7 +19,7 @@ namespace FeedCenter.Options string version = UpdateCheck.LocalVersion.ToString(); versionLabel.Text = string.Format(Properties.Resources.Version, version); - companyLabel.Text = ((AssemblyCompanyAttribute) Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false)[0]).Company; + companyLabel.Text = ((AssemblyCompanyAttribute) Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false)[0]).Company; } public override bool ValidatePanel()