diff --git a/DataClasses/RowData.cs b/DataClasses/RowData.cs index 88d6ffb..bad34ab 100644 --- a/DataClasses/RowData.cs +++ b/DataClasses/RowData.cs @@ -104,7 +104,7 @@ namespace SystemTrayMenu.DataClasses } else if (isDirectory) { - icon = IconReader.GetFolderIcon( + icon = IconReader.GetFolderIconSTA( TargetFilePath, IconReader.FolderType.Closed, false); @@ -256,7 +256,7 @@ namespace SystemTrayMenu.DataClasses resolvedLnkPath = FileLnk.GetResolvedFileName(TargetFilePath); if (FileLnk.IsDirectory(resolvedLnkPath)) { - icon = IconReader.GetFolderIcon(TargetFilePath, IconReader.FolderType.Open, true); + icon = IconReader.GetFolderIconSTA(TargetFilePath, IconReader.FolderType.Open, true); handled = true; isLnkDirectory = true; } diff --git a/Packaging/Images/SplashScreen.scale-100.png b/Packaging/Images/SplashScreen.scale-100.png index 8d31b61..1a0cb71 100644 Binary files a/Packaging/Images/SplashScreen.scale-100.png and b/Packaging/Images/SplashScreen.scale-100.png differ diff --git a/Packaging/Images/SplashScreen.scale-125.png b/Packaging/Images/SplashScreen.scale-125.png index b94b9d5..91b62bb 100644 Binary files a/Packaging/Images/SplashScreen.scale-125.png and b/Packaging/Images/SplashScreen.scale-125.png differ diff --git a/Packaging/Images/SplashScreen.scale-150.png b/Packaging/Images/SplashScreen.scale-150.png index b3d013f..7a5160e 100644 Binary files a/Packaging/Images/SplashScreen.scale-150.png and b/Packaging/Images/SplashScreen.scale-150.png differ diff --git a/Packaging/Images/SplashScreen.scale-200.png b/Packaging/Images/SplashScreen.scale-200.png index 8a22a1b..bdbb9c9 100644 Binary files a/Packaging/Images/SplashScreen.scale-200.png and b/Packaging/Images/SplashScreen.scale-200.png differ diff --git a/Packaging/Images/SplashScreen.scale-400.png b/Packaging/Images/SplashScreen.scale-400.png index b210b28..0cf125e 100644 Binary files a/Packaging/Images/SplashScreen.scale-400.png and b/Packaging/Images/SplashScreen.scale-400.png differ diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 3342b28..f4646cb 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.10.0")] -[assembly: AssemblyFileVersion("1.0.10.0")] +[assembly: AssemblyVersion("1.0.11.0")] +[assembly: AssemblyFileVersion("1.0.11.0")] diff --git a/SystemTrayMenu.csproj b/SystemTrayMenu.csproj index e99ec70..81effb1 100644 --- a/SystemTrayMenu.csproj +++ b/SystemTrayMenu.csproj @@ -160,6 +160,14 @@ SettingsSingleFileGenerator Settings.Designer.cs + + True + + + + True + + @@ -206,9 +214,18 @@ runtime; build; native; contentfiles; analyzers; buildtransitive + + + taskkill /fi "pid gt 0" /im SystemTrayMenu.exe taskkill /f /fi "pid gt 0" /im SystemTrayMenu.exe EXIT 0 + https://github.com/Hofknecht/SystemTrayMenu + icon.png + hofknecht.eu/systemtraymenu/ + LICENSE + + SystemTrayMenu \ No newline at end of file diff --git a/Utilities/File/IconReader.cs b/Utilities/File/IconReader.cs index 6450564..3b86d09 100644 --- a/Utilities/File/IconReader.cs +++ b/Utilities/File/IconReader.cs @@ -11,6 +11,7 @@ namespace SystemTrayMenu.Utilities using System.Drawing.Imaging; using System.IO; using System.Runtime.InteropServices; + using System.Threading.Tasks; // from https://www.codeproject.com/Articles/2532/Obtaining-and-managing-file-and-folder-icons-using // added ImageList_GetIcon, IconCache, AddIconOverlay @@ -58,18 +59,39 @@ namespace SystemTrayMenu.Utilities icon = DictIconCache.GetOrAdd(extension, GetIcon); Icon GetIcon(string keyExtension) { - return GetFileIcon(filePath, linkOverlay, size); + return GetFileIconSTA(filePath, linkOverlay, size); } } else { - icon = GetFileIcon(filePath, linkOverlay, size); + icon = GetFileIconSTA(filePath, linkOverlay, size); } // } return icon; } + + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Reliability", "CA2008:Do not create tasks without passing a TaskScheduler", Justification = "todo")] + public static Icon GetFolderIconSTA( + string directoryPath, + FolderType folderType, + bool linkOverlay, + IconSize size = IconSize.Small) + { + Icon icon = null; + + Task task = Task.Factory.StartNew(() => GetFolderIcon( + directoryPath, + folderType, + linkOverlay, + size)); + icon = task.Result; + + return icon; + } + public static Icon GetFolderIcon( string directoryPath, FolderType folderType, @@ -116,7 +138,6 @@ namespace SystemTrayMenu.Utilities { try { - Icon.FromHandle(shfi.hIcon); icon = (Icon)Icon.FromHandle(shfi.hIcon).Clone(); DllImports.NativeMethods.User32DestroyIcon(shfi.hIcon); } @@ -163,6 +184,17 @@ namespace SystemTrayMenu.Utilities return isExtensionWitSameIcon; } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Reliability", "CA2008:Do not create tasks without passing a TaskScheduler", Justification = "todo")] + private static Icon GetFileIconSTA(string filePath, bool linkOverlay, IconSize size = IconSize.Small) + { + Icon icon = null; + + Task task = Task.Factory.StartNew(() => GetFileIcon(filePath, linkOverlay, size)); + icon = task.Result; + + return icon; + } + private static Icon GetFileIcon(string filePath, bool linkOverlay, IconSize size = IconSize.Small) { Icon icon = null;