diff --git a/Config/Config.cs b/Config/Config.cs index 6f35cfc..ad302d7 100644 --- a/Config/Config.cs +++ b/Config/Config.cs @@ -4,6 +4,7 @@ namespace SystemTrayMenu { + using System; using System.Diagnostics; using System.IO; using System.Reflection; @@ -25,16 +26,33 @@ namespace SystemTrayMenu { if (!Properties.Settings.Default.IsUpgraded) { - // configs located at "%localappdata%\\" Properties.Settings.Default.Upgrade(); - Properties.Settings.Default.IsUpgraded = true; Properties.Settings.Default.Save(); FileVersionInfo versionInfo = FileVersionInfo. GetVersionInfo(Assembly.GetEntryAssembly().Location); - Log.Info($"Settings upgraded from " + - $"%localappdata%\\{versionInfo.CompanyName}\\"); + string upgradedFromPath = $"%localappdata%\\{versionInfo.CompanyName}\\"; + try + { + upgradedFromPath = System.IO.Path.GetFullPath(upgradedFromPath); + } + catch (Exception ex) + { + if (ex is ArgumentException || + ex is System.Security.SecurityException || + ex is NotSupportedException || + ex is PathTooLongException) + { + Log.Warn($"Resolve path {upgradedFromPath} failed", ex); + } + else + { + throw; + } + } + + Log.Info($"Settings upgraded from {upgradedFromPath}"); } } diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 6a6ac45..a8b8b65 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -39,5 +39,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.17.12")] -[assembly: AssemblyFileVersion("1.0.17.12")] +[assembly: AssemblyVersion("1.0.17.13")] +[assembly: AssemblyFileVersion("1.0.17.13")] diff --git a/UserInterface/SettingsForm.cs b/UserInterface/SettingsForm.cs index d0dd9e6..878a453 100644 --- a/UserInterface/SettingsForm.cs +++ b/UserInterface/SettingsForm.cs @@ -188,31 +188,6 @@ namespace SystemTrayMenu.UserInterface { } - ///// - ///// Check if OneDrive is blocking hotkeys - ///// - ///// true if onedrive has hotkeys turned on - // private static bool IsOneDriveBlockingHotkey() - // { - // if (!Environment.OSVersion.IsWindows10()) - // { - // return false; - // } - // var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); - // var oneDriveSettingsPath = Path.Combine(localAppData, @"Microsoft\OneDrive\settings\Personal"); - // if (!Directory.Exists(oneDriveSettingsPath)) - // { - // return false; - // } - // var oneDriveSettingsFile = Directory.GetFiles(oneDriveSettingsPath, "*_screenshot.dat").FirstOrDefault(); - // if (!File.Exists(oneDriveSettingsFile)) - // { - // return false; - // } - // var screenshotSetting = File.ReadAllLines(oneDriveSettingsFile).Skip(1).Take(1).First(); - // return "2".Equals(screenshotSetting); - // } - /// /// Displays a dialog for the user to choose how to handle hotkey registration failures: /// retry (allowing to shut down the conflicting application before),