diff --git a/DisplayMagician.sln b/DisplayMagician.sln index 5e3eaaf..f703512 100644 --- a/DisplayMagician.sln +++ b/DisplayMagician.sln @@ -18,8 +18,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DisplayMagicianTests", "Dis EndProject Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "DisplayMagicianSetup", "DisplayMagicianSetup\DisplayMagicianSetup.wixproj", "{DFD22D4D-F2E4-4BA4-B32A-7A990A35BA08}" EndProject -Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "DisplayMagicianBootstrapper", "DisplayMagicianBootstrapper\DisplayMagicianBootstrapper.wixproj", "{59F3F084-EC7E-42D4-B0F4-8131B82BDB3B}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|AnyCPU = Debug|AnyCPU @@ -90,25 +88,18 @@ Global {D7AFD3CC-53BF-4991-ABFE-638A3F355310}.Release|x64.Build.0 = Release|Any CPU {D7AFD3CC-53BF-4991-ABFE-638A3F355310}.Release|x86.ActiveCfg = Release|Any CPU {D7AFD3CC-53BF-4991-ABFE-638A3F355310}.Release|x86.Build.0 = Release|Any CPU - {DFD22D4D-F2E4-4BA4-B32A-7A990A35BA08}.Debug|AnyCPU.ActiveCfg = Debug|x86 - {DFD22D4D-F2E4-4BA4-B32A-7A990A35BA08}.Debug|AnyCPU.Build.0 = Debug|x86 + {DFD22D4D-F2E4-4BA4-B32A-7A990A35BA08}.Debug|AnyCPU.ActiveCfg = Debug|x64 + {DFD22D4D-F2E4-4BA4-B32A-7A990A35BA08}.Debug|AnyCPU.Build.0 = Debug|x64 {DFD22D4D-F2E4-4BA4-B32A-7A990A35BA08}.Debug|x64.ActiveCfg = Debug|x64 {DFD22D4D-F2E4-4BA4-B32A-7A990A35BA08}.Debug|x64.Build.0 = Debug|x64 {DFD22D4D-F2E4-4BA4-B32A-7A990A35BA08}.Debug|x86.ActiveCfg = Debug|x86 {DFD22D4D-F2E4-4BA4-B32A-7A990A35BA08}.Debug|x86.Build.0 = Debug|x86 - {DFD22D4D-F2E4-4BA4-B32A-7A990A35BA08}.Release|AnyCPU.ActiveCfg = Release|x86 + {DFD22D4D-F2E4-4BA4-B32A-7A990A35BA08}.Release|AnyCPU.ActiveCfg = Release|x64 + {DFD22D4D-F2E4-4BA4-B32A-7A990A35BA08}.Release|AnyCPU.Build.0 = Release|x64 {DFD22D4D-F2E4-4BA4-B32A-7A990A35BA08}.Release|x64.ActiveCfg = Release|x64 {DFD22D4D-F2E4-4BA4-B32A-7A990A35BA08}.Release|x64.Build.0 = Release|x64 {DFD22D4D-F2E4-4BA4-B32A-7A990A35BA08}.Release|x86.ActiveCfg = Release|x86 {DFD22D4D-F2E4-4BA4-B32A-7A990A35BA08}.Release|x86.Build.0 = Release|x86 - {59F3F084-EC7E-42D4-B0F4-8131B82BDB3B}.Debug|AnyCPU.ActiveCfg = Debug|x86 - {59F3F084-EC7E-42D4-B0F4-8131B82BDB3B}.Debug|x64.ActiveCfg = Debug|x86 - {59F3F084-EC7E-42D4-B0F4-8131B82BDB3B}.Debug|x86.ActiveCfg = Debug|x86 - {59F3F084-EC7E-42D4-B0F4-8131B82BDB3B}.Debug|x86.Build.0 = Debug|x86 - {59F3F084-EC7E-42D4-B0F4-8131B82BDB3B}.Release|AnyCPU.ActiveCfg = Release|x86 - {59F3F084-EC7E-42D4-B0F4-8131B82BDB3B}.Release|x64.ActiveCfg = Release|x86 - {59F3F084-EC7E-42D4-B0F4-8131B82BDB3B}.Release|x86.ActiveCfg = Release|x86 - {59F3F084-EC7E-42D4-B0F4-8131B82BDB3B}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/DisplayMagician/DesktopNotificationActivator.cs b/DisplayMagician/DesktopNotificationActivator.cs index 4caed1c..cdb42f8 100644 --- a/DisplayMagician/DesktopNotificationActivator.cs +++ b/DisplayMagician/DesktopNotificationActivator.cs @@ -20,7 +20,7 @@ namespace DisplayMagician [Guid("56F14154-6339-4B94-8B82-80F78D5BCEAF"), ComVisible(true)] public class DesktopNotificationActivator : NotificationActivator { - public override void OnActivated(string invokedArgs, NotificationUserInput userInput, string appUserModelId) + public override void OnActivated(string arguments, NotificationUserInput userInput, string appUserModelId) { // Invoke the code we're running on the UI Thread to avoid // cross thread exceptions @@ -29,11 +29,11 @@ namespace DisplayMagician // This code is running on the main UI thread! // Parse the query string (using NuGet package QueryString.NET) - QueryString args = QueryString.Parse(invokedArgs); + QueryString args = QueryString.Parse(arguments); foreach (QueryStringParameter myArg in args) { - if (myArg.Name.Equals("action",StringComparison.InvariantCultureIgnoreCase)) + if (myArg.Name.Equals("action",StringComparison.OrdinalIgnoreCase)) { // See what action is being requested switch (args["action"].ToLowerInvariant()) diff --git a/DisplayMagician/DesktopNotificationManagerCompat.cs b/DisplayMagician/DesktopNotificationManagerCompat.cs index 5a1ed04..9aded0f 100644 --- a/DisplayMagician/DesktopNotificationManagerCompat.cs +++ b/DisplayMagician/DesktopNotificationManagerCompat.cs @@ -64,6 +64,7 @@ namespace DesktopNotifications /// under Desktop Bridge. Call this upon application startup, before calling any other APIs. /// /// An AUMID that uniquely identifies your application. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")] public static void RegisterAumidAndComServer(string aumid) where T : NotificationActivator { @@ -127,6 +128,7 @@ namespace DesktopNotifications /// Registers the activator type as a COM server client so that Windows can launch your activator. /// /// Your implementation of NotificationActivator. Must have GUID and ComVisible attributes on class. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")] public static void RegisterActivator() where T : NotificationActivator, new() { @@ -225,6 +227,7 @@ namespace DesktopNotifications } } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "RegisterAumidAndComServer")] private static void EnsureRegistered() { // If not registered AUMID yet @@ -350,6 +353,7 @@ namespace DesktopNotifications /// Gets all notifications sent by this app that are currently still in Action Center. /// /// A collection of toasts. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")] public IReadOnlyList GetHistory() { return _aumid != null ? _history.GetHistory(_aumid) : _history.GetHistory(); diff --git a/DisplayMagician/DisplayMagician.csproj b/DisplayMagician/DisplayMagician.csproj index 6367f51..90e53fb 100644 --- a/DisplayMagician/DisplayMagician.csproj +++ b/DisplayMagician/DisplayMagician.csproj @@ -51,7 +51,8 @@ prompt 4 false - true + false + BasicCorrectnessRules.ruleset Resources\DisplayMagician.ico @@ -97,6 +98,7 @@ + diff --git a/DisplayMagician/DisplayRepresentation.cs b/DisplayMagician/DisplayRepresentation.cs index fba445c..a601141 100644 --- a/DisplayMagician/DisplayRepresentation.cs +++ b/DisplayMagician/DisplayRepresentation.cs @@ -15,7 +15,7 @@ namespace DisplayMagician { Name = display.DeviceName; Path = display.DevicePath; - var index = Path.IndexOf("{", StringComparison.InvariantCultureIgnoreCase); + var index = Path.IndexOf("{", StringComparison.OrdinalIgnoreCase); if (index > 0) { diff --git a/DisplayMagician/GameLibraries/SteamGame.cs b/DisplayMagician/GameLibraries/SteamGame.cs index b0464b6..ae8e35a 100644 --- a/DisplayMagician/GameLibraries/SteamGame.cs +++ b/DisplayMagician/GameLibraries/SteamGame.cs @@ -128,6 +128,7 @@ namespace DisplayMagician.GameLibraries } } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] public bool CopyInto(SteamGame steamGame) { if (!(steamGame is SteamGame)) diff --git a/DisplayMagician/GameLibraries/SteamLibrary.cs b/DisplayMagician/GameLibraries/SteamLibrary.cs index ff51284..42e5e76 100644 --- a/DisplayMagician/GameLibraries/SteamLibrary.cs +++ b/DisplayMagician/GameLibraries/SteamLibrary.cs @@ -190,6 +190,7 @@ namespace DisplayMagician.GameLibraries } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] public static bool ContainsSteamGame(SteamGame steamGame) { if (!(steamGame is SteamGame)) diff --git a/DisplayMagician/GameLibraries/UplayGame.cs b/DisplayMagician/GameLibraries/UplayGame.cs index d601ba5..c8c05c1 100644 --- a/DisplayMagician/GameLibraries/UplayGame.cs +++ b/DisplayMagician/GameLibraries/UplayGame.cs @@ -129,6 +129,7 @@ namespace DisplayMagician.GameLibraries } }*/ + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] public bool CopyTo(UplayGame uplayGame) { if (!(uplayGame is UplayGame)) diff --git a/DisplayMagician/GameLibraries/UplayLibrary.cs b/DisplayMagician/GameLibraries/UplayLibrary.cs index b83d03f..cffdbac 100644 --- a/DisplayMagician/GameLibraries/UplayLibrary.cs +++ b/DisplayMagician/GameLibraries/UplayLibrary.cs @@ -173,6 +173,7 @@ namespace DisplayMagician.GameLibraries } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] public static bool ContainsUplayGame(UplayGame uplayGame) { if (!(uplayGame is UplayGame)) @@ -300,7 +301,7 @@ namespace DisplayMagician.GameLibraries // Go through every record and attempt to parse it foreach (string uplayEntry in uplayConfigFile) { // Skip any Uplay entry records that don't start with 'version:' - if (!uplayEntry.StartsWith("version:",StringComparison.InvariantCultureIgnoreCase)) + if (!uplayEntry.StartsWith("version:",StringComparison.OrdinalIgnoreCase)) continue; //Split the record into entrylines @@ -398,7 +399,7 @@ namespace DisplayMagician.GameLibraries if (gotGameFileName && gotGameId && gotGameIconPath && gotGameName) break; // This line contains the Game Name - if (uplayEntryLines[i].StartsWith(" name:", StringComparison.InvariantCultureIgnoreCase) && !gotGameName) + if (uplayEntryLines[i].StartsWith(" name:", StringComparison.OrdinalIgnoreCase) && !gotGameName) { mc = Regex.Matches(uplayEntryLines[i], @" name\: (.*)"); uplayGameAppInfo.GameName = mc[0].Groups[1].ToString(); @@ -409,7 +410,7 @@ namespace DisplayMagician.GameLibraries } gotGameName = true; } - else if (uplayEntryLines[i].StartsWith(" icon_image:", StringComparison.InvariantCultureIgnoreCase) && !gotGameIconPath) + else if (uplayEntryLines[i].StartsWith(" icon_image:", StringComparison.OrdinalIgnoreCase) && !gotGameIconPath) { mc = Regex.Matches(uplayEntryLines[i], @"icon_image: (.*)"); string iconImageFileName = mc[0].Groups[1].ToString(); diff --git a/DisplayMagician/GlobalSuppressions.cs b/DisplayMagician/GlobalSuppressions.cs new file mode 100644 index 0000000..ecf3413 Binary files /dev/null and b/DisplayMagician/GlobalSuppressions.cs differ diff --git a/DisplayMagician/InterProcess/IPCClient.cs b/DisplayMagician/InterProcess/IPCClient.cs index 3aa65a3..8c66691 100644 --- a/DisplayMagician/InterProcess/IPCClient.cs +++ b/DisplayMagician/InterProcess/IPCClient.cs @@ -8,6 +8,9 @@ namespace DisplayMagician.InterProcess { internal class IPCClient : ClientBase, IService { + + private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); + public IPCClient(Process process) : base( new ServiceEndpoint( @@ -71,9 +74,10 @@ namespace DisplayMagician.InterProcess { if (process.Id != thisProcess.Id) { + IPCClient processChannel = null; try { - var processChannel = new IPCClient(process); + processChannel = new IPCClient(process); if (processChannel.Status == status) { @@ -82,6 +86,8 @@ namespace DisplayMagician.InterProcess } catch (Exception ex) { + processChannel = null; + logger.Error(ex, $"IPCClient/QueryByStatus: Couldn't create an IPC Client"); Console.WriteLine($"IPCClient/QueryByStatus exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}"); // ignored } diff --git a/DisplayMagician/InterProcess/IPCService.cs b/DisplayMagician/InterProcess/IPCService.cs index 0a0dd7d..2b545b5 100644 --- a/DisplayMagician/InterProcess/IPCService.cs +++ b/DisplayMagician/InterProcess/IPCService.cs @@ -10,6 +10,8 @@ namespace DisplayMagician.InterProcess { private static ServiceHost _serviceHost; + private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); + private IPCService() { Status = InstanceStatus.Busy; @@ -53,6 +55,7 @@ namespace DisplayMagician.InterProcess } catch (Exception ex) { + logger.Error(ex, $"IPCService/StartService exception: Couldn't create an IPC Service"); Console.WriteLine($"IPCService/StartService exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}"); try { @@ -60,6 +63,7 @@ namespace DisplayMagician.InterProcess } catch (Exception ex2) { + logger.Error(ex, $"IPCService/StartService exception: Couldn't close an IPC Service after error creating it"); Console.WriteLine($"IPCService/StartService exception 2: {ex2.Message}: {ex2.InnerException}"); // ignored } diff --git a/DisplayMagician/Program.cs b/DisplayMagician/Program.cs index af52eb5..4e49e61 100644 --- a/DisplayMagician/Program.cs +++ b/DisplayMagician/Program.cs @@ -13,10 +13,8 @@ using DisplayMagicianShared; using DisplayMagician.UIForms; using System.Text.RegularExpressions; using System.Drawing; -//using Microsoft.Toolkit.Uwp.Notifications; using DesktopNotifications; - -//using System.Runtime.InteropServices; +using System.Runtime.Serialization; namespace DisplayMagician { @@ -646,19 +644,40 @@ namespace DisplayMagician { public class ApplyTopologyException : Exception { - public ApplyTopologyException(String message) : base(message) + public ApplyTopologyException() + { } + + public ApplyTopologyException(string message) : base(message) + { } + + public ApplyTopologyException(string message, Exception innerException) : base(message, innerException) + { } + public ApplyTopologyException(SerializationInfo info, StreamingContext context) : base(info, context) { } } public class ApplyPathInfoException : Exception { - public ApplyPathInfoException(String message) : base(message) + public ApplyPathInfoException() + { } + + public ApplyPathInfoException(string message) : base(message) + { } + public ApplyPathInfoException(string message, Exception innerException) : base(message, innerException) + { } + public ApplyPathInfoException(SerializationInfo info, StreamingContext context) : base(info, context) { } } public class LoadingInstalledGamesException : Exception { - public LoadingInstalledGamesException(String message) : base(message) + public LoadingInstalledGamesException() + { } + public LoadingInstalledGamesException(string message) : base(message) + { } + public LoadingInstalledGamesException(string message, Exception innerException) : base(message, innerException) + { } + public LoadingInstalledGamesException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } \ No newline at end of file diff --git a/DisplayMagician/Properties/AssemblyInfo.cs b/DisplayMagician/Properties/AssemblyInfo.cs index 0ccc260..b94da0a 100644 --- a/DisplayMagician/Properties/AssemblyInfo.cs +++ b/DisplayMagician/Properties/AssemblyInfo.cs @@ -1,4 +1,5 @@ -using System.Resources; +using System; +using System.Resources; using System.Reflection; using System.Runtime.InteropServices; @@ -39,3 +40,5 @@ using System.Runtime.InteropServices; [assembly: AssemblyVersion("0.2.0.*")] [assembly: AssemblyFileVersion("0.2.0.0")] [assembly: NeutralResourcesLanguage("en")] + +[assembly: CLSCompliant(true)] \ No newline at end of file diff --git a/DisplayMagician/ShortcutItem.cs b/DisplayMagician/ShortcutItem.cs index 5f9d0b4..cae499f 100644 --- a/DisplayMagician/ShortcutItem.cs +++ b/DisplayMagician/ShortcutItem.cs @@ -216,7 +216,7 @@ namespace DisplayMagician // Now we need to find and populate the profileToUse foreach (ProfileItem profileToTest in ProfileRepository.AllProfiles) { - if (profileToTest.UUID.Equals(_profileUuid, StringComparison.InvariantCultureIgnoreCase)) + if (profileToTest.UUID.Equals(_profileUuid, StringComparison.OrdinalIgnoreCase)) { _profileToUse = profileToTest; break; @@ -419,7 +419,7 @@ namespace DisplayMagician // Now we need to find and populate the profileToUse foreach (ProfileItem profileToTest in ProfileRepository.AllProfiles) { - if (profileToTest.UUID.Equals(_profileUuid,StringComparison.InvariantCultureIgnoreCase)) + if (profileToTest.UUID.Equals(_profileUuid,StringComparison.OrdinalIgnoreCase)) { _profileToUse = profileToTest; break; @@ -617,7 +617,7 @@ namespace DisplayMagician // Now we need to find and populate the profileToUse foreach (ProfileItem profileToTest in ProfileRepository.AllProfiles) { - if (profileToTest.UUID.Equals(_profileUuid, StringComparison.InvariantCultureIgnoreCase)) + if (profileToTest.UUID.Equals(_profileUuid, StringComparison.OrdinalIgnoreCase)) { _profileToUse = profileToTest; break; @@ -729,7 +729,7 @@ namespace DisplayMagician // We try to find and set the ProfileTouse foreach (ProfileItem profileToTest in ProfileRepository.AllProfiles) { - if (profileToTest.UUID.Equals(_profileUuid, StringComparison.InvariantCultureIgnoreCase)) + if (profileToTest.UUID.Equals(_profileUuid, StringComparison.OrdinalIgnoreCase)) _profileToUse = profileToTest; } } @@ -1224,7 +1224,7 @@ namespace DisplayMagician // Now we need to find and populate the profileToUse foreach (ProfileItem profileToTest in ProfileRepository.AllProfiles) { - if (profileToTest.UUID.Equals(_profileUuid, StringComparison.InvariantCultureIgnoreCase)) + if (profileToTest.UUID.Equals(_profileUuid, StringComparison.OrdinalIgnoreCase)) { _profileToUse = profileToTest; break; @@ -1431,7 +1431,7 @@ namespace DisplayMagician // Now we need to find and populate the profileToUse foreach (ProfileItem profileToTest in ProfileRepository.AllProfiles) { - if (profileToTest.UUID.Equals(_profileUuid, StringComparison.InvariantCultureIgnoreCase)) + if (profileToTest.UUID.Equals(_profileUuid, StringComparison.OrdinalIgnoreCase)) { _profileToUse = profileToTest; break; @@ -1634,7 +1634,7 @@ namespace DisplayMagician // Now we need to find and populate the profileToUse foreach (ProfileItem profileToTest in ProfileRepository.AllProfiles) { - if (profileToTest.UUID.Equals(_profileUuid, StringComparison.InvariantCultureIgnoreCase)) + if (profileToTest.UUID.Equals(_profileUuid, StringComparison.OrdinalIgnoreCase)) { _profileToUse = profileToTest; break; @@ -1821,6 +1821,7 @@ namespace DisplayMagician } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] public Bitmap ToBitmapOverlay(Bitmap originalBitmap, Bitmap overlayBitmap, int width, int height, PixelFormat format = PixelFormat.Format32bppArgb) { diff --git a/DisplayMagician/ShortcutRepository.cs b/DisplayMagician/ShortcutRepository.cs index f739551..6a4236a 100644 --- a/DisplayMagician/ShortcutRepository.cs +++ b/DisplayMagician/ShortcutRepository.cs @@ -136,7 +136,7 @@ namespace DisplayMagician return false; // Remove the Shortcut Icons from the Cache - List shortcutsToRemove = _allShortcuts.FindAll(item => item.UUID.Equals(shortcut.UUID, StringComparison.InvariantCultureIgnoreCase)); + List shortcutsToRemove = _allShortcuts.FindAll(item => item.UUID.Equals(shortcut.UUID, StringComparison.OrdinalIgnoreCase)); foreach (ShortcutItem shortcutToRemove in shortcutsToRemove) { try @@ -152,7 +152,7 @@ namespace DisplayMagician } // Remove the shortcut from the list. - int numRemoved = _allShortcuts.RemoveAll(item => item.UUID.Equals(shortcut.UUID, StringComparison.InvariantCultureIgnoreCase)); + int numRemoved = _allShortcuts.RemoveAll(item => item.UUID.Equals(shortcut.UUID, StringComparison.OrdinalIgnoreCase)); if (numRemoved == 1) { @@ -178,13 +178,13 @@ namespace DisplayMagician Match match = Regex.Match(shortcutNameOrUuid, uuidV4Regex, RegexOptions.IgnoreCase); if (match.Success) { - shortcutsToRemove = _allShortcuts.FindAll(item => item.UUID.Equals(shortcutNameOrUuid, StringComparison.InvariantCultureIgnoreCase)); - numRemoved = _allShortcuts.RemoveAll(item => item.UUID.Equals(shortcutNameOrUuid, StringComparison.InvariantCultureIgnoreCase)); + shortcutsToRemove = _allShortcuts.FindAll(item => item.UUID.Equals(shortcutNameOrUuid, StringComparison.OrdinalIgnoreCase)); + numRemoved = _allShortcuts.RemoveAll(item => item.UUID.Equals(shortcutNameOrUuid, StringComparison.OrdinalIgnoreCase)); } else { - shortcutsToRemove = _allShortcuts.FindAll(item => item.Name.Equals(shortcutNameOrUuid, StringComparison.InvariantCultureIgnoreCase)); - numRemoved = _allShortcuts.RemoveAll(item => item.Name.Equals(shortcutNameOrUuid, StringComparison.InvariantCultureIgnoreCase)); + shortcutsToRemove = _allShortcuts.FindAll(item => item.Name.Equals(shortcutNameOrUuid, StringComparison.OrdinalIgnoreCase)); + numRemoved = _allShortcuts.RemoveAll(item => item.Name.Equals(shortcutNameOrUuid, StringComparison.OrdinalIgnoreCase)); } // Remove the Shortcut Icons from the Cache foreach (ShortcutItem shortcutToRemove in shortcutsToRemove) @@ -221,7 +221,7 @@ namespace DisplayMagician foreach (ShortcutItem testShortcut in _allShortcuts) { - if (testShortcut.UUID.Equals(shortcut.UUID,StringComparison.InvariantCultureIgnoreCase)) + if (testShortcut.UUID.Equals(shortcut.UUID,StringComparison.OrdinalIgnoreCase)) return true; } @@ -240,7 +240,7 @@ namespace DisplayMagician { foreach (ShortcutItem testShortcut in _allShortcuts) { - if (testShortcut.UUID.Equals(shortcutNameOrUuid, StringComparison.InvariantCultureIgnoreCase)) + if (testShortcut.UUID.Equals(shortcutNameOrUuid, StringComparison.OrdinalIgnoreCase)) return true; } @@ -249,7 +249,7 @@ namespace DisplayMagician { foreach (ShortcutItem testShortcut in _allShortcuts) { - if (testShortcut.Name.Equals(shortcutNameOrUuid, StringComparison.InvariantCultureIgnoreCase)) + if (testShortcut.Name.Equals(shortcutNameOrUuid, StringComparison.OrdinalIgnoreCase)) return true; } @@ -271,7 +271,7 @@ namespace DisplayMagician { foreach (ShortcutItem testShortcut in _allShortcuts) { - if (testShortcut.UUID.Equals(shortcutNameOrUuid, StringComparison.InvariantCultureIgnoreCase)) + if (testShortcut.UUID.Equals(shortcutNameOrUuid, StringComparison.OrdinalIgnoreCase)) return testShortcut; } @@ -280,7 +280,7 @@ namespace DisplayMagician { foreach (ShortcutItem testShortcut in _allShortcuts) { - if (testShortcut.Name.Equals(shortcutNameOrUuid, StringComparison.InvariantCultureIgnoreCase)) + if (testShortcut.Name.Equals(shortcutNameOrUuid, StringComparison.OrdinalIgnoreCase)) return testShortcut; } @@ -297,7 +297,7 @@ namespace DisplayMagician foreach (ShortcutItem testShortcut in ShortcutRepository.AllShortcuts) { - if (testShortcut.ProfileUUID.Equals(newProfile.UUID, StringComparison.InvariantCultureIgnoreCase) && testShortcut.AutoName) + if (testShortcut.ProfileUUID.Equals(newProfile.UUID, StringComparison.OrdinalIgnoreCase) && testShortcut.AutoName) { testShortcut.ProfileToUse = newProfile; testShortcut.AutoSuggestShortcutName(); diff --git a/DisplayMagician/UIForms/DisplayProfileForm.resx b/DisplayMagician/UIForms/DisplayProfileForm.resx index 838c7b0..0f18ad5 100644 --- a/DisplayMagician/UIForms/DisplayProfileForm.resx +++ b/DisplayMagician/UIForms/DisplayProfileForm.resx @@ -157,7 +157,7 @@ - BorderColor = 406d6d6d; UnFocusedColor1 = ffff8080; UnFocusedColor2 = LightCoral; UnFocusedBorderColor = Maroon; HoverColor1 = 80078d7; HoverColor2 = 400078d7; HoverBorderColor = 400078d7; SelectedColor1 = ffff8080; SelectedColor2 = LightCoral; SelectedBorderColor = Maroon; DisabledColor1 = 6d6d6d; DisabledColor2 = 206d6d6d; DisabledBorderColor = 206d6d6d; DisabledForeColor = ff808080; ColumnHeaderBackColor1 = 20f0f0f0; ColumnHeaderBackColor2 = c4f0f0f0; ColumnHeaderHoverColor1 = 100078d7; ColumnHeaderHoverColor2 = 400078d7; ColumnSelectColor = 106d6d6d; ColumnSeparatorColor = 206d6d6d; PaneBackColor = 106d6d6d; PaneSeparatorColor = 806d6d6d; SelectionRectangleColor1 = 800078d7; SelectionRectangleColor2 = 800078d7 + BorderColor = 406d6d6d; UnfocusedColor1 = ffff8080; UnfocusedColor2 = LightCoral; UnfocusedBorderColor = Maroon; HoverColor1 = 80078d7; HoverColor2 = 400078d7; HoverBorderColor = 400078d7; SelectedColor1 = ffff8080; SelectedColor2 = LightCoral; SelectedBorderColor = Maroon; DisabledColor1 = 6d6d6d; DisabledColor2 = 206d6d6d; DisabledBorderColor = 206d6d6d; DisabledForeColor = ff808080; ColumnHeaderBackColor1 = 20f0f0f0; ColumnHeaderBackColor2 = c4f0f0f0; ColumnHeaderHoverColor1 = 100078d7; ColumnHeaderHoverColor2 = 400078d7; ColumnSelectColor = 106d6d6d; ColumnSeparatorColor = 206d6d6d; PaneBackColor = 106d6d6d; PaneSeparatorColor = 806d6d6d; SelectionRectangleColor1 = 800078d7; SelectionRectangleColor2 = 800078d7 248, 17 diff --git a/DisplayMagician/UIForms/MainForm.cs b/DisplayMagician/UIForms/MainForm.cs index 3b82cc8..21c4ad9 100644 --- a/DisplayMagician/UIForms/MainForm.cs +++ b/DisplayMagician/UIForms/MainForm.cs @@ -31,7 +31,9 @@ namespace DisplayMagician.UIForms private bool allowVisible; // ContextMenu's Show command used private bool allowClose; // ContextMenu's Exit command used - public MainForm(Form formToOpen = null, bool FromToast = false) + private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); + + public MainForm(Form formToOpen = null) { InitializeComponent(); btn_setup_display_profiles.Parent = splitContainer1.Panel1; @@ -383,6 +385,7 @@ namespace DisplayMagician.UIForms DialogResult dialogResult; if (args.Mandatory.Value) { + logger.Info($"MainForm/AutoUpdaterOnCheckForUpdateEvent - New version {args.CurrentVersion} available. Current version is {args.InstalledVersion}. Mandatory upgrade."); dialogResult = MessageBox.Show( $@"There is new version {args.CurrentVersion} available. You are using version {args.InstalledVersion}. This is required update. Press Ok to begin updating the application.", @"Update Available", @@ -391,6 +394,7 @@ namespace DisplayMagician.UIForms } else { + logger.Info($"MainForm/AutoUpdaterOnCheckForUpdateEvent - New version {args.CurrentVersion} available. Current version is {args.InstalledVersion}. Optional upgrade."); dialogResult = MessageBox.Show( $@"There is new version {args.CurrentVersion} available. You are using version { @@ -407,34 +411,34 @@ namespace DisplayMagician.UIForms { try { + logger.Info($"MainForm/AutoUpdaterOnCheckForUpdateEvent - Downloading {args.InstalledVersion} update."); if (AutoUpdater.DownloadUpdate(args)) { + logger.Info($"MainForm/AutoUpdaterOnCheckForUpdateEvent - Restarting to apply {args.InstalledVersion} update."); Application.Exit(); } } - catch (Exception exception) + catch (Exception ex) { - MessageBox.Show(exception.Message, exception.GetType().ToString(), MessageBoxButtons.OK, + logger.Warn(ex, $"MainForm/AutoUpdaterOnCheckForUpdateEvent - Exception during update download."); + MessageBox.Show(ex.Message, ex.GetType().ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error); } } } - /*else - { - MessageBox.Show(@"There is no update available please try again later.", @"No update available", - MessageBoxButtons.OK, MessageBoxIcon.Information); - }*/ } else { if (args.Error is WebException) { + logger.Warn(args.Error, $"MainForm/AutoUpdaterOnCheckForUpdateEvent - WebException - There was a problem reaching the update server."); MessageBox.Show( @"There is a problem reaching update server. Please check your internet connection and try again later.", @"Update Check Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { + logger.Warn(args.Error, $"MainForm/AutoUpdaterOnCheckForUpdateEvent - There was a problem performing the update: {args.Error.Message}"); MessageBox.Show(args.Error.Message, args.Error.GetType().ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error); diff --git a/DisplayMagicianSetup/DisplayMagicianSetup.wixproj b/DisplayMagicianSetup/DisplayMagicianSetup.wixproj index 72cc343..61a16d2 100644 --- a/DisplayMagicianSetup/DisplayMagicianSetup.wixproj +++ b/DisplayMagicianSetup/DisplayMagicianSetup.wixproj @@ -11,15 +11,16 @@ DisplayMagicianSetup - bin\$(Configuration)\ + bin\$(Platform)\$(Configuration)\ obj\$(Configuration)\ Debug;DisplayMagicianFilesDir=H:\vscode-projects\DisplayMagician\DisplayMagician\bin\Debug -arch x64 - bin\$(Configuration)\ + bin\$(Platform)\$(Configuration)\ obj\$(Configuration)\ - + -arch x64 + DisplayMagicianFilesDir=H:\vscode-projects\DisplayMagician\DisplayMagician\bin\Debug DisplayMagicianFilesDir=H:\vscode-projects\DisplayMagician\DisplayMagician\bin\Debug; @@ -36,7 +37,7 @@ obj\$(Platform)\$(Configuration)\ False True - DisplayMagicianFilesDir=H:\vscode-projects\DisplayMagician\Debug + DisplayMagicianFilesDir=H:\vscode-projects\DisplayMagician\DisplayMagician\bin\Debug diff --git a/DisplayMagicianSetup/Fragments/DisplayMagicianFilesFragment.wxs b/DisplayMagicianSetup/Fragments/DisplayMagicianFilesFragment.wxs index 7a2d1d1..10ce88f 100644 --- a/DisplayMagicianSetup/Fragments/DisplayMagicianFilesFragment.wxs +++ b/DisplayMagicianSetup/Fragments/DisplayMagicianFilesFragment.wxs @@ -2,196 +2,196 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +