From 7ebdb0193407aeccabb8e9efde87afb14aa65155 Mon Sep 17 00:00:00 2001 From: Markus Hofknecht Date: Mon, 29 Nov 2021 20:22:16 +0100 Subject: [PATCH] [Feature] Show message if target not exists (#257), version 1.1.1.5" --- Properties/AssemblyInfo.cs | 4 ++-- Utilities/Log.cs | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 2840560..bbaad56 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.1.1.4")] -[assembly: AssemblyFileVersion("1.1.1.4")] +[assembly: AssemblyVersion("1.1.1.5")] +[assembly: AssemblyFileVersion("1.1.1.5")] diff --git a/Utilities/Log.cs b/Utilities/Log.cs index f712d78..0ee8c94 100644 --- a/Utilities/Log.cs +++ b/Utilities/Log.cs @@ -6,6 +6,7 @@ namespace SystemTrayMenu.Utilities { using System; using System.Collections.Generic; + using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Reflection; @@ -104,10 +105,11 @@ namespace SystemTrayMenu.Utilities }; p.Start(); } - catch (Exception ex) + catch (Win32Exception ex) { Warn($"fileName:'{fileName}' arguments:'{arguments}'", ex); - if (ex.Message == "The system cannot find the file specified.") + + if (ex.NativeErrorCode == 2 || ex.NativeErrorCode == 1223) { new Thread(ShowProblemWithShortcut).Start(); static void ShowProblemWithShortcut() @@ -120,6 +122,10 @@ namespace SystemTrayMenu.Utilities } } } + catch (Exception ex) + { + Warn($"fileName:'{fileName}' arguments:'{arguments}'", ex); + } } } }