From 7a94fcf360d59be8eded5a0d6ab178447b4760e2 Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Sun, 1 Sep 2024 08:54:57 +0200 Subject: [PATCH] migrate Pilz.Win32 & optimize Pilz & Pilz.IO --- ...ilz.Drawing.Drawing3D.OpenGLFactory.vbproj | 2 +- Pilz.IO/EmbeddedFilesContainer.cs | 4 - Pilz.IO/EventArgs/DataEventargs.cs | 13 - Pilz.IO/EventArguments/DataEventargs.cs | 6 + Pilz.IO/FileLocker.cs | 5 +- Pilz.IO/ManagedPipes/ManagedPipe.cs | 6 +- Pilz.IO/ManagedPipes/ManagedPipeClient.cs | 8 +- Pilz.IO/ManagedPipes/ManagedPipeServer.cs | 8 +- Pilz.IO/My Project/Application.Designer.cs | 11 - Pilz.IO/My Project/Application.myapp | 10 - Pilz.IO/My Project/Resources.resx | 117 --------- Pilz.IO/Pilz.IO.csproj | 96 +------- Pilz.IO/Properties/AssemblyInfo.cs | 7 - Pilz.IO/Properties/Resources.Designer.cs | 63 ----- Pilz.IO/Properties/Resources.resx | 117 --------- Pilz.UI/Pilz.UI.csproj | 2 +- Pilz.Win32/Internals/IconExtractor.cs | 36 +++ Pilz.Win32/Internals/IconExtractor.vb | 34 --- Pilz.Win32/Internals/IconFactory.cs | 231 ++++++++++++++++++ Pilz.Win32/Internals/IconFactory.vb | 208 ---------------- Pilz.Win32/Mapped/FileTypeIcons.cs | 17 ++ Pilz.Win32/Mapped/FileTypeIcons.vb | 17 -- Pilz.Win32/Mapped/Keyboard.cs | 22 ++ Pilz.Win32/Mapped/Keyboard.vb | 19 -- Pilz.Win32/Mapped/NativeFileInfo.cs | 22 ++ Pilz.Win32/Mapped/NativeFileInfo.vb | 23 -- Pilz.Win32/Mapped/SystemIconSize.cs | 13 + Pilz.Win32/Mapped/SystemIconSize.vb | 12 - Pilz.Win32/My Project/Application.Designer.vb | 13 - Pilz.Win32/My Project/Application.myapp | 10 - Pilz.Win32/My Project/Resources.Designer.vb | 63 ----- Pilz.Win32/My Project/Resources.resx | 117 --------- Pilz.Win32/My Project/Settings.Designer.vb | 73 ------ Pilz.Win32/My Project/Settings.settings | 7 - Pilz.Win32/Native/FileInfoFlags.cs | 20 ++ Pilz.Win32/Native/FileInfoFlags.vb | 20 -- Pilz.Win32/Native/Kernel32.cs | 15 ++ Pilz.Win32/Native/Kernel32.vb | 16 -- Pilz.Win32/Native/POINT.cs | 23 ++ Pilz.Win32/Native/POINT.vb | 21 -- Pilz.Win32/Native/RECT.cs | 98 ++++++++ Pilz.Win32/Native/RECT.vb | 82 ------- Pilz.Win32/Native/SHFILEINFO.cs | 46 ++++ Pilz.Win32/Native/SHFILEINFO.vb | 46 ---- Pilz.Win32/Native/Shell32.cs | 68 ++++++ Pilz.Win32/Native/Shell32.vb | 68 ------ Pilz.Win32/Native/User32.cs | 20 ++ Pilz.Win32/Native/User32.vb | 23 -- Pilz.Win32/Native/WindowFromPointFlags.cs | 11 + Pilz.Win32/Native/WindowFromPointFlags.vb | 11 - .../NativeTools.cs | 9 +- Pilz.Win32/Pilz.Win32.csproj | 15 ++ Pilz.Win32/Pilz.Win32.vbproj | 81 ------ Pilz.sln | 18 +- Pilz/Pilz.csproj | 4 +- 55 files changed, 700 insertions(+), 1427 deletions(-) delete mode 100644 Pilz.IO/EventArgs/DataEventargs.cs create mode 100644 Pilz.IO/EventArguments/DataEventargs.cs delete mode 100644 Pilz.IO/My Project/Application.Designer.cs delete mode 100644 Pilz.IO/My Project/Application.myapp delete mode 100644 Pilz.IO/My Project/Resources.resx delete mode 100644 Pilz.IO/Properties/AssemblyInfo.cs delete mode 100644 Pilz.IO/Properties/Resources.Designer.cs delete mode 100644 Pilz.IO/Properties/Resources.resx create mode 100644 Pilz.Win32/Internals/IconExtractor.cs delete mode 100644 Pilz.Win32/Internals/IconExtractor.vb create mode 100644 Pilz.Win32/Internals/IconFactory.cs delete mode 100644 Pilz.Win32/Internals/IconFactory.vb create mode 100644 Pilz.Win32/Mapped/FileTypeIcons.cs delete mode 100644 Pilz.Win32/Mapped/FileTypeIcons.vb create mode 100644 Pilz.Win32/Mapped/Keyboard.cs delete mode 100644 Pilz.Win32/Mapped/Keyboard.vb create mode 100644 Pilz.Win32/Mapped/NativeFileInfo.cs delete mode 100644 Pilz.Win32/Mapped/NativeFileInfo.vb create mode 100644 Pilz.Win32/Mapped/SystemIconSize.cs delete mode 100644 Pilz.Win32/Mapped/SystemIconSize.vb delete mode 100644 Pilz.Win32/My Project/Application.Designer.vb delete mode 100644 Pilz.Win32/My Project/Application.myapp delete mode 100644 Pilz.Win32/My Project/Resources.Designer.vb delete mode 100644 Pilz.Win32/My Project/Resources.resx delete mode 100644 Pilz.Win32/My Project/Settings.Designer.vb delete mode 100644 Pilz.Win32/My Project/Settings.settings create mode 100644 Pilz.Win32/Native/FileInfoFlags.cs delete mode 100644 Pilz.Win32/Native/FileInfoFlags.vb create mode 100644 Pilz.Win32/Native/Kernel32.cs delete mode 100644 Pilz.Win32/Native/Kernel32.vb create mode 100644 Pilz.Win32/Native/POINT.cs delete mode 100644 Pilz.Win32/Native/POINT.vb create mode 100644 Pilz.Win32/Native/RECT.cs delete mode 100644 Pilz.Win32/Native/RECT.vb create mode 100644 Pilz.Win32/Native/SHFILEINFO.cs delete mode 100644 Pilz.Win32/Native/SHFILEINFO.vb create mode 100644 Pilz.Win32/Native/Shell32.cs delete mode 100644 Pilz.Win32/Native/Shell32.vb create mode 100644 Pilz.Win32/Native/User32.cs delete mode 100644 Pilz.Win32/Native/User32.vb create mode 100644 Pilz.Win32/Native/WindowFromPointFlags.cs delete mode 100644 Pilz.Win32/Native/WindowFromPointFlags.vb rename Pilz.IO/Extensions.cs => Pilz.Win32/NativeTools.cs (72%) create mode 100644 Pilz.Win32/Pilz.Win32.csproj delete mode 100644 Pilz.Win32/Pilz.Win32.vbproj diff --git a/Pilz.Drawing.Drawing3D.OpenGLRenderer/Pilz.Drawing.Drawing3D.OpenGLFactory.vbproj b/Pilz.Drawing.Drawing3D.OpenGLRenderer/Pilz.Drawing.Drawing3D.OpenGLFactory.vbproj index f0319fa..3e6dcdf 100644 --- a/Pilz.Drawing.Drawing3D.OpenGLRenderer/Pilz.Drawing.Drawing3D.OpenGLFactory.vbproj +++ b/Pilz.Drawing.Drawing3D.OpenGLRenderer/Pilz.Drawing.Drawing3D.OpenGLFactory.vbproj @@ -93,7 +93,7 @@ - + diff --git a/Pilz.IO/EmbeddedFilesContainer.cs b/Pilz.IO/EmbeddedFilesContainer.cs index 424680e..f87fe53 100644 --- a/Pilz.IO/EmbeddedFilesContainer.cs +++ b/Pilz.IO/EmbeddedFilesContainer.cs @@ -1,9 +1,5 @@ using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.IO; using System.IO.Compression; -using System.Threading.Tasks; namespace Pilz.IO; diff --git a/Pilz.IO/EventArgs/DataEventargs.cs b/Pilz.IO/EventArgs/DataEventargs.cs deleted file mode 100644 index e920d0b..0000000 --- a/Pilz.IO/EventArgs/DataEventargs.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace Pilz.IO; - -public class DataEventArgs : EventArgs -{ - public readonly byte[] Data; - - public DataEventArgs(byte[] bytes) : base() - { - Data = bytes; - } -} \ No newline at end of file diff --git a/Pilz.IO/EventArguments/DataEventargs.cs b/Pilz.IO/EventArguments/DataEventargs.cs new file mode 100644 index 0000000..fe9d205 --- /dev/null +++ b/Pilz.IO/EventArguments/DataEventargs.cs @@ -0,0 +1,6 @@ +namespace Pilz.IO.EventArguments; + +public class DataEventArgs(byte[] data) : EventArgs() +{ + public byte[] Data { get; } = data; +} \ No newline at end of file diff --git a/Pilz.IO/FileLocker.cs b/Pilz.IO/FileLocker.cs index 7255af9..bf39464 100644 --- a/Pilz.IO/FileLocker.cs +++ b/Pilz.IO/FileLocker.cs @@ -1,7 +1,4 @@ -using System; -using System.IO; - -namespace Pilz.IO; +namespace Pilz.IO; public partial class FileLocker : IDisposable { diff --git a/Pilz.IO/ManagedPipes/ManagedPipe.cs b/Pilz.IO/ManagedPipes/ManagedPipe.cs index 709b4e3..72babd1 100644 --- a/Pilz.IO/ManagedPipes/ManagedPipe.cs +++ b/Pilz.IO/ManagedPipes/ManagedPipe.cs @@ -1,8 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; +using Pilz.IO.EventArguments; -namespace Pilz.IO; +namespace Pilz.IO.ManagedPipes; /// /// stellt den Erben "Server" und "Client" 2 verschiedene diff --git a/Pilz.IO/ManagedPipes/ManagedPipeClient.cs b/Pilz.IO/ManagedPipes/ManagedPipeClient.cs index b771d56..16f58e2 100644 --- a/Pilz.IO/ManagedPipes/ManagedPipeClient.cs +++ b/Pilz.IO/ManagedPipes/ManagedPipeClient.cs @@ -1,9 +1,7 @@ -using global::System.IO.Pipes; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; +using Pilz.IO.EventArguments; +using System.IO.Pipes; -namespace Pilz.IO; +namespace Pilz.IO.ManagedPipes; public class ManagedPipeClient : ManagedPipe { diff --git a/Pilz.IO/ManagedPipes/ManagedPipeServer.cs b/Pilz.IO/ManagedPipes/ManagedPipeServer.cs index 69dac16..5f90005 100644 --- a/Pilz.IO/ManagedPipes/ManagedPipeServer.cs +++ b/Pilz.IO/ManagedPipes/ManagedPipeServer.cs @@ -1,9 +1,7 @@ -using global::System.IO.Pipes; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; +using Pilz.IO.EventArguments; +using System.IO.Pipes; -namespace Pilz.IO; +namespace Pilz.IO.ManagedPipes; public class ManagedPipeServer : ManagedPipe { diff --git a/Pilz.IO/My Project/Application.Designer.cs b/Pilz.IO/My Project/Application.Designer.cs deleted file mode 100644 index 2be760e..0000000 --- a/Pilz.IO/My Project/Application.Designer.cs +++ /dev/null @@ -1,11 +0,0 @@ -// ------------------------------------------------------------------------------ -// -// Dieser Code wurde von einem Tool generiert. -// Laufzeitversion:4.0.30319.42000 -// -// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -// der Code erneut generiert wird. -// -// ------------------------------------------------------------------------------ - - diff --git a/Pilz.IO/My Project/Application.myapp b/Pilz.IO/My Project/Application.myapp deleted file mode 100644 index 758895d..0000000 --- a/Pilz.IO/My Project/Application.myapp +++ /dev/null @@ -1,10 +0,0 @@ - - - false - false - 0 - true - 0 - 1 - true - diff --git a/Pilz.IO/My Project/Resources.resx b/Pilz.IO/My Project/Resources.resx deleted file mode 100644 index af7dbeb..0000000 --- a/Pilz.IO/My Project/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Pilz.IO/Pilz.IO.csproj b/Pilz.IO/Pilz.IO.csproj index ea2e440..f4191f9 100644 --- a/Pilz.IO/Pilz.IO.csproj +++ b/Pilz.IO/Pilz.IO.csproj @@ -1,96 +1,24 @@  + - Windows - net6.0-windows;net8.0-windows - $(DefaultItemExcludes);$(ProjectDir)**\*.vb - latest - NamedPipeManaging - Dr. Schneider Kunststoffwerke GmbH - NamedPipeManaging - Copyright © Pascal Schedel 2017 - 2018 - Pilz.IO.xml - true - - - true - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,CS1591 - - - false - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,CS1591 - - - On - - - Binary - - - Off - - - On - - - true - bin\$(Platform)\$(Configuration)\ - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - MinimumRecommendedRules.ruleset - true - - - bin\$(Platform)\$(Configuration)\ - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - MinimumRecommendedRules.ruleset - - - 2.0.0 + net8.0 + 2.1.0 + enable + annotations + - - + + + + + - - - - - - - - - - - - - True - Application.myapp - - - True - True - Resources.resx - - - - - ResXFileCodeGenerator - Resources.Designer.cs - Pilz.IO.My.Resources - Designer - - - - - MyApplicationCodeGenerator - Application.Designer.cs - - - - + \ No newline at end of file diff --git a/Pilz.IO/Properties/AssemblyInfo.cs b/Pilz.IO/Properties/AssemblyInfo.cs deleted file mode 100644 index b2fe7e9..0000000 --- a/Pilz.IO/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,7 +0,0 @@ -using global::System; -using global::System.Runtime.InteropServices; -[assembly: ComVisible(false)] - -// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird. -[assembly: Guid("42b8af67-22bf-4d8f-8a95-84fcaecffec6")] - diff --git a/Pilz.IO/Properties/Resources.Designer.cs b/Pilz.IO/Properties/Resources.Designer.cs deleted file mode 100644 index 7923526..0000000 --- a/Pilz.IO/Properties/Resources.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Dieser Code wurde von einem Tool generiert. -// Laufzeitversion:4.0.30319.42000 -// -// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -// der Code erneut generiert wird. -// -//------------------------------------------------------------------------------ - -namespace Pilz.IO.My.Resources { - using System; - - - /// - /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. - /// - // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert - // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. - // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen - // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Pilz.IO.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle - /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/Pilz.IO/Properties/Resources.resx b/Pilz.IO/Properties/Resources.resx deleted file mode 100644 index af7dbeb..0000000 --- a/Pilz.IO/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Pilz.UI/Pilz.UI.csproj b/Pilz.UI/Pilz.UI.csproj index a262879..13b349a 100644 --- a/Pilz.UI/Pilz.UI.csproj +++ b/Pilz.UI/Pilz.UI.csproj @@ -47,6 +47,6 @@ - + \ No newline at end of file diff --git a/Pilz.Win32/Internals/IconExtractor.cs b/Pilz.Win32/Internals/IconExtractor.cs new file mode 100644 index 0000000..8bead39 --- /dev/null +++ b/Pilz.Win32/Internals/IconExtractor.cs @@ -0,0 +1,36 @@ +using Pilz.Win32.Mapped; +using Pilz.Win32.Native; +using System.Runtime.InteropServices; + +namespace Pilz.Win32.Internals; + + +public class IconExtractor +{ + + /// + /// Extrahiert das Icon aus einer Datei oder aus einem Ordner. + /// + /// Hier übergeben Sie den Pfad der Datei von dem das Icon extrahiert werden soll. + /// Bei übergabe von true wird ein kleines und bei false ein großes Icon zurück gegeben. + public static Icon ExtractIcon(string FilePath, SystemIconSize size) + { + Icon icon; + var shinfo = new SHFILEINFO(); + var small = size == SystemIconSize.Small; + + Shell32.SHGetFileInfo(FilePath, 0U, ref shinfo, (uint)Math.Round(Math.Truncate((decimal)Marshal.SizeOf(shinfo))), SHFILEINFO.SHGFI_ICON | (small ? SHFILEINFO.SHGFI_SMALLICON : SHFILEINFO.SHGFI_LARGEICON)); + + try + { + icon = Icon.FromHandle(shinfo.hIcon); + } + catch (Exception ex) + { + icon = null; + } + + return icon; + } + +} \ No newline at end of file diff --git a/Pilz.Win32/Internals/IconExtractor.vb b/Pilz.Win32/Internals/IconExtractor.vb deleted file mode 100644 index 2f37e5b..0000000 --- a/Pilz.Win32/Internals/IconExtractor.vb +++ /dev/null @@ -1,34 +0,0 @@ -Imports System.Drawing -Imports System.Runtime.InteropServices - -Imports Pilz.Win32.Mapped -Imports Pilz.Win32.Native - -Namespace Internals - - Public Class IconExtractor - - ''' - ''' Extrahiert das Icon aus einer Datei oder aus einem Ordner. - ''' - ''' Hier übergeben Sie den Pfad der Datei von dem das Icon extrahiert werden soll. - ''' Bei übergabe von true wird ein kleines und bei false ein großes Icon zurück gegeben. - Public Shared Function ExtractIcon(FilePath As String, size As SystemIconSize) As Icon - Dim icon As Icon - Dim shinfo As New SHFILEINFO - Dim small As Boolean = size = SystemIconSize.Small - - Shell32.SHGetFileInfo(FilePath, 0, shinfo, Math.Truncate(Marshal.SizeOf(shinfo)), SHFILEINFO.SHGFI_ICON Or If(small, SHFILEINFO.SHGFI_SMALLICON, SHFILEINFO.SHGFI_LARGEICON)) - - Try - icon = Icon.FromHandle(shinfo.hIcon) - Catch ex As Exception - icon = Nothing - End Try - - Return icon - End Function - - End Class - -End Namespace diff --git a/Pilz.Win32/Internals/IconFactory.cs b/Pilz.Win32/Internals/IconFactory.cs new file mode 100644 index 0000000..e5aab9a --- /dev/null +++ b/Pilz.Win32/Internals/IconFactory.cs @@ -0,0 +1,231 @@ +using Microsoft.Win32; +using Pilz.Win32.Mapped; +using Pilz.Win32.Native; +using System.Reflection; +using System.Runtime.InteropServices; +using static Pilz.Win32.Native.Shell32; + +namespace Pilz.Win32.Internals; + +public class IconFactory +{ + + #region Custom exceptions class + + public class IconNotFoundException : Exception + { + public IconNotFoundException(string fileName, int index) : base(string.Format("Icon with Id = {0} wasn't found in file {1}", index, fileName)) + { + } + } + + public class UnableToExtractIconsException : Exception + { + public UnableToExtractIconsException(string fileName, int firstIconIndex, int iconCount) : base(string.Format("Tryed to extract {2} icons starting from the one with id {1} from the \"{0}\" file but failed", fileName, firstIconIndex, iconCount)) + { + } + } + + #endregion + + + /// + /// Get the number of icons in the specified file. + /// + /// Full path of the file to look for. + /// + private static int GetIconsCountInFile(string fileName) + { + return ExtractIconEx(fileName, -1, null, null, 0); + } + + #region ExtractIcon-like functions + + public static void ExtractEx(string fileName, List largeIcons, List smallIcons, int firstIconIndex, int iconCount) + { + // + // Memory allocations + // + + var smallIconsPtrs = (nint[])null; + var largeIconsPtrs = (nint[])null; + + if (smallIcons is not null) + smallIconsPtrs = new nint[iconCount]; + if (largeIcons is not null) + largeIconsPtrs = new nint[iconCount]; + + // + // Call to native Win32 API + // + + var apiResult = ExtractIconEx(fileName, firstIconIndex, largeIconsPtrs, smallIconsPtrs, iconCount); + if (apiResult != iconCount) + throw new UnableToExtractIconsException(fileName, firstIconIndex, iconCount); + + // + // Fill lists + // + + if (smallIcons is not null) + { + smallIcons.Clear(); + foreach (var actualIconPtr in smallIconsPtrs) + smallIcons.Add(Icon.FromHandle(actualIconPtr)); + } + if (largeIcons is not null) + { + largeIcons.Clear(); + foreach (var actualIconPtr in largeIconsPtrs) + largeIcons.Add(Icon.FromHandle(actualIconPtr)); + } + } + + public static List ExtractEx(string fileName, SystemIconSize size, int firstIconIndex, int iconCount) + { + var iconList = new List(); + + switch (size) + { + case SystemIconSize.Large: + { + ExtractEx(fileName, iconList, null, firstIconIndex, iconCount); + break; + } + case SystemIconSize.Small: + { + ExtractEx(fileName, null, iconList, firstIconIndex, iconCount); + break; + } + + default: + { + throw new ArgumentOutOfRangeException("size"); + } + } + + return iconList; + } + + public static void Extract(string fileName, List largeIcons, List smallIcons) + { + var iconCount = GetIconsCountInFile(fileName); + ExtractEx(fileName, largeIcons, smallIcons, 0, iconCount); + } + + public static List Extract(string fileName, SystemIconSize size) + { + var iconCount = GetIconsCountInFile(fileName); + return ExtractEx(fileName, size, 0, iconCount); + } + + public static Icon ExtractOne(string fileName, int index, SystemIconSize size) + { + try + { + var iconList = ExtractEx(fileName, size, index, 1); + return iconList[0]; + } + catch (UnableToExtractIconsException __unusedUnableToExtractIconsException1__) + { + throw new IconNotFoundException(fileName, index); + } + } + + public static void ExtractOne(string fileName, int index, out Icon largeIcon, out Icon smallIcon) + { + var smallIconList = new List(); + var largeIconList = new List(); + try + { + ExtractEx(fileName, largeIconList, smallIconList, index, 1); + largeIcon = largeIconList[0]; + smallIcon = smallIconList[0]; + } + catch (UnableToExtractIconsException __unusedUnableToExtractIconsException1__) + { + throw new IconNotFoundException(fileName, index); + } + } + + #endregion + + // this will look throw the registry + // to find if the Extension have an icon. + public static Icon IconFromExtension(string extension, SystemIconSize size) + { + // Add the '.' to the extension if needed + if (extension[0] != '.') + extension = '.' + extension; + + // opens the registry for the wanted key. + var Root = Registry.ClassesRoot; + var ExtensionKey = Root.OpenSubKey(extension); + ExtensionKey.GetValueNames(); + var ApplicationKey = Root.OpenSubKey(ExtensionKey.GetValue("").ToString()); + + // gets the name of the file that have the icon. + var IconLocation = ApplicationKey.OpenSubKey("DefaultIcon").GetValue("").ToString(); + var IconPath = IconLocation.Split(','); + + if (Equals(IconPath[1], null)) + IconPath[1] = "0"; + var Large = new nint[1]; + var Small = new nint[1]; + + // extracts the icon from the file. + ExtractIconEx(IconPath[0], Convert.ToInt16(IconPath[1]), Large, Small, 1); + return size == SystemIconSize.Large ? Icon.FromHandle(Large[0]) : Icon.FromHandle(Small[0]); + } + + public static Icon IconFromExtensionShell(string extension, SystemIconSize size) + { + // add '.' if nessesry + if (extension[0] != '.') + extension = '.' + extension; + + // temp struct for getting file shell info + var fileInfo = new SHFILEINFO(); + + Shell32.SHGetFileInfo(extension, 0U, ref fileInfo, (uint)Marshal.SizeOf(fileInfo), (uint)(FileInfoFlags.SHGFI_ICON | FileInfoFlags.SHGFI_USEFILEATTRIBUTES | (FileInfoFlags)size)); + + return Icon.FromHandle(fileInfo.hIcon); + } + + public static Icon IconFromResource(string resourceName) + { + var @assembly = Assembly.GetCallingAssembly(); + + return new Icon(assembly.GetManifestResourceStream(resourceName)); + } + + /// + /// Parse strings in registry who contains the name of the icon and + /// the index of the icon an return both parts. + /// + /// The full string in the form "path,index" as found in registry. + /// The "path" part of the string. + /// The "index" part of the string. + public static void ExtractInformationsFromRegistryString(string regString, out string fileName, out int index) + { + if (Equals(regString, null)) + throw new ArgumentNullException("regString"); + if (regString.Length == 0) + throw new ArgumentException("The string should not be empty.", "regString"); + + index = 0; + var strArr = regString.Replace("\"", "").Split(','); + fileName = strArr[0].Trim(); + if (strArr.Length > 1) + int.TryParse(strArr[1].Trim(), out index); + } + + public static Icon ExtractFromRegistryString(string regString, SystemIconSize size) + { + string fileName; + int index; + ExtractInformationsFromRegistryString(regString, out fileName, out index); + return ExtractOne(fileName, index, size); + } + +} \ No newline at end of file diff --git a/Pilz.Win32/Internals/IconFactory.vb b/Pilz.Win32/Internals/IconFactory.vb deleted file mode 100644 index 6892ae2..0000000 --- a/Pilz.Win32/Internals/IconFactory.vb +++ /dev/null @@ -1,208 +0,0 @@ -Imports System.Drawing -Imports System.Reflection -Imports System.Runtime.InteropServices - -Imports Microsoft.Win32 - -Imports Pilz.Win32.Mapped -Imports Pilz.Win32.Native -Imports Pilz.Win32.Native.Shell32 - -Namespace Internals - Public Class IconFactory - -#Region "Custom exceptions class" - - Public Class IconNotFoundException - Inherits Exception - Public Sub New(ByVal fileName As String, ByVal index As Integer) - MyBase.New(String.Format("Icon with Id = {0} wasn't found in file {1}", index, fileName)) - End Sub - End Class - - Public Class UnableToExtractIconsException - Inherits Exception - Public Sub New(ByVal fileName As String, ByVal firstIconIndex As Integer, ByVal iconCount As Integer) - MyBase.New(String.Format("Tryed to extract {2} icons starting from the one with id {1} from the ""{0}"" file but failed", fileName, firstIconIndex, iconCount)) - End Sub - End Class - -#End Region - - - ''' - ''' Get the number of icons in the specified file. - ''' - ''' Full path of the file to look for. - ''' - Private Shared Function GetIconsCountInFile(fileName As String) As Integer - Return ExtractIconEx(fileName, -1, Nothing, Nothing, 0) - End Function - -#Region "ExtractIcon-like functions" - - Public Shared Sub ExtractEx(ByVal fileName As String, ByVal largeIcons As List(Of Icon), ByVal smallIcons As List(Of Icon), ByVal firstIconIndex As Integer, ByVal iconCount As Integer) - ' - ' Memory allocations - ' - - Dim smallIconsPtrs As IntPtr() = Nothing - Dim largeIconsPtrs As IntPtr() = Nothing - - If smallIcons IsNot Nothing Then - smallIconsPtrs = New IntPtr(iconCount - 1) {} - End If - If largeIcons IsNot Nothing Then - largeIconsPtrs = New IntPtr(iconCount - 1) {} - End If - - ' - ' Call to native Win32 API - ' - - Dim apiResult = ExtractIconEx(fileName, firstIconIndex, largeIconsPtrs, smallIconsPtrs, iconCount) - If apiResult <> iconCount Then - Throw New UnableToExtractIconsException(fileName, firstIconIndex, iconCount) - End If - - ' - ' Fill lists - ' - - If smallIcons IsNot Nothing Then - smallIcons.Clear() - For Each actualIconPtr In smallIconsPtrs - smallIcons.Add(Icon.FromHandle(actualIconPtr)) - Next - End If - If largeIcons IsNot Nothing Then - largeIcons.Clear() - For Each actualIconPtr In largeIconsPtrs - largeIcons.Add(Icon.FromHandle(actualIconPtr)) - Next - End If - End Sub - - Public Shared Function ExtractEx(ByVal fileName As String, ByVal size As SystemIconSize, ByVal firstIconIndex As Integer, ByVal iconCount As Integer) As List(Of Icon) - Dim iconList As New List(Of Icon)() - - Select Case size - Case SystemIconSize.Large - ExtractEx(fileName, iconList, Nothing, firstIconIndex, iconCount) - Case SystemIconSize.Small - ExtractEx(fileName, Nothing, iconList, firstIconIndex, iconCount) - Case Else - Throw New ArgumentOutOfRangeException("size") - End Select - - Return iconList - End Function - - Public Shared Sub Extract(ByVal fileName As String, ByVal largeIcons As List(Of Icon), ByVal smallIcons As List(Of Icon)) - Dim iconCount = GetIconsCountInFile(fileName) - ExtractEx(fileName, largeIcons, smallIcons, 0, iconCount) - End Sub - - Public Shared Function Extract(ByVal fileName As String, ByVal size As SystemIconSize) As List(Of Icon) - Dim iconCount = GetIconsCountInFile(fileName) - Return ExtractEx(fileName, size, 0, iconCount) - End Function - - Public Shared Function ExtractOne(ByVal fileName As String, ByVal index As Integer, ByVal size As SystemIconSize) As Icon - Try - Dim iconList = ExtractEx(fileName, size, index, 1) - Return iconList(0) - Catch __unusedUnableToExtractIconsException1__ As UnableToExtractIconsException - Throw New IconNotFoundException(fileName, index) - End Try - End Function - - Public shared Sub ExtractOne(ByVal fileName As String, ByVal index As Integer, ByRef largeIcon As Icon, ByRef smallIcon As Icon) - Dim smallIconList As List(Of Icon) = New List(Of Icon)() - Dim largeIconList As List(Of Icon) = New List(Of Icon)() - Try - ExtractEx(fileName, largeIconList, smallIconList, index, 1) - largeIcon = largeIconList(0) - smallIcon = smallIconList(0) - Catch __unusedUnableToExtractIconsException1__ As UnableToExtractIconsException - Throw New IconNotFoundException(fileName, index) - End Try - End Sub - -#End Region - - 'this will look throw the registry - 'to find if the Extension have an icon. - Public Shared Function IconFromExtension(ByVal extension As String, ByVal size As SystemIconSize) As Icon - ' Add the '.' to the extension if needed - If extension(0) <> "."c Then extension = "."c & extension - - 'opens the registry for the wanted key. - Dim Root = Registry.ClassesRoot - Dim ExtensionKey = Root.OpenSubKey(extension) - ExtensionKey.GetValueNames() - Dim ApplicationKey As RegistryKey = Root.OpenSubKey(ExtensionKey.GetValue("").ToString()) - - 'gets the name of the file that have the icon. - Dim IconLocation As String = ApplicationKey.OpenSubKey("DefaultIcon").GetValue("").ToString() - Dim IconPath = IconLocation.Split(","c) - - If Equals(IconPath(1), Nothing) Then IconPath(1) = "0" - Dim Large = New IntPtr(0) {}, Small = New IntPtr(0) {} - - 'extracts the icon from the file. - ExtractIconEx(IconPath(0), Convert.ToInt16(IconPath(1)), Large, Small, 1) - Return If(size = SystemIconSize.Large, Icon.FromHandle(Large(0)), Icon.FromHandle(Small(0))) - End Function - - Public Shared Function IconFromExtensionShell(ByVal extension As String, ByVal size As SystemIconSize) As Icon - 'add '.' if nessesry - If extension(0) <> "."c Then extension = "."c & extension - - 'temp struct for getting file shell info - Dim fileInfo As SHFILEINFO = New SHFILEINFO() - - SHGetFileInfo(extension, 0, fileInfo, Marshal.SizeOf(fileInfo), FileInfoFlags.SHGFI_ICON Or FileInfoFlags.SHGFI_USEFILEATTRIBUTES Or CType(size, FileInfoFlags)) - - Return Icon.FromHandle(fileInfo.hIcon) - End Function - - Public Shared Function IconFromResource(ByVal resourceName As String) As Icon - Dim assembly As Assembly = Assembly.GetCallingAssembly() - - Return New Icon(assembly.GetManifestResourceStream(resourceName)) - End Function - - ''' - ''' Parse strings in registry who contains the name of the icon and - ''' the index of the icon an return both parts. - ''' - ''' The full string in the form "path,index" as found in registry. - ''' The "path" part of the string. - ''' The "index" part of the string. - Public Shared Sub ExtractInformationsFromRegistryString(ByVal regString As String, ByRef fileName As String, ByRef index As Integer) - If Equals(regString, Nothing) Then - Throw New ArgumentNullException("regString") - End If - If regString.Length = 0 Then - Throw New ArgumentException("The string should not be empty.", "regString") - End If - - index = 0 - Dim strArr = regString.Replace("""", "").Split(","c) - fileName = strArr(0).Trim() - If strArr.Length > 1 Then - Call Integer.TryParse(strArr(1).Trim(), index) - End If - End Sub - - Public Shared Function ExtractFromRegistryString(ByVal regString As String, ByVal size As SystemIconSize) As Icon - Dim fileName As String - Dim index As Integer - ExtractInformationsFromRegistryString(regString, fileName, index) - Return ExtractOne(fileName, index, size) - End Function - - End Class - -End Namespace diff --git a/Pilz.Win32/Mapped/FileTypeIcons.cs b/Pilz.Win32/Mapped/FileTypeIcons.cs new file mode 100644 index 0000000..e471096 --- /dev/null +++ b/Pilz.Win32/Mapped/FileTypeIcons.cs @@ -0,0 +1,17 @@ +namespace Pilz.Win32.Mapped; + + +public static class FileTypeIcons +{ + + public static Icon ExtractIconFromFilePath(string filePath, SystemIconSize size) + { + return Internals.IconExtractor.ExtractIcon(filePath, size); + } + + public static Icon ExtractIconFromFileExtension(string fileExtension, SystemIconSize size) + { + return Internals.IconFactory.IconFromExtensionShell(fileExtension, size); + } + +} \ No newline at end of file diff --git a/Pilz.Win32/Mapped/FileTypeIcons.vb b/Pilz.Win32/Mapped/FileTypeIcons.vb deleted file mode 100644 index 395cd49..0000000 --- a/Pilz.Win32/Mapped/FileTypeIcons.vb +++ /dev/null @@ -1,17 +0,0 @@ -Imports System.Drawing - -Namespace Mapped - - Public Module FileTypeIcons - - Public Function ExtractIconFromFilePath(filePath As String, size As SystemIconSize) As Icon - Return Internals.IconExtractor.ExtractIcon(filePath, size) - End Function - - Public Function ExtractIconFromFileExtension(fileExtension As String, size As SystemIconSize) As Icon - Return Internals.IconFactory.IconFromExtensionShell(fileExtension, size) - End Function - - End Module - -End Namespace diff --git a/Pilz.Win32/Mapped/Keyboard.cs b/Pilz.Win32/Mapped/Keyboard.cs new file mode 100644 index 0000000..d77ec9b --- /dev/null +++ b/Pilz.Win32/Mapped/Keyboard.cs @@ -0,0 +1,22 @@ + +using Microsoft.VisualBasic.CompilerServices; +using Pilz.Win32.Native; +using Keys = System.Windows.Forms.Keys; + +namespace Pilz.Win32.Mapped; + + +public class Keyboard +{ + + public static bool IsKeyDown(int keyCode) + { + return Conversions.ToDouble(User32.GetKeyState(keyCode).ToString() + 0x8000) < 0d; + } + + public static bool IsKeyDown(Keys keyCode) + { + return IsKeyDown((int)keyCode); + } + +} \ No newline at end of file diff --git a/Pilz.Win32/Mapped/Keyboard.vb b/Pilz.Win32/Mapped/Keyboard.vb deleted file mode 100644 index b3ce738..0000000 --- a/Pilz.Win32/Mapped/Keyboard.vb +++ /dev/null @@ -1,19 +0,0 @@ -Imports Pilz.Win32.Native - -Imports Keys = System.Windows.Forms.Keys - -Namespace Mapped - - Public Class Keyboard - - Public Shared Function IsKeyDown(keyCode As Integer) As Boolean - Return (User32.GetKeyState(keyCode) & &H8000) < 0 - End Function - - Public Shared Function IsKeyDown(keyCode As Keys) As Boolean - Return IsKeyDown(CInt(keyCode)) - End Function - - End Class - -End Namespace diff --git a/Pilz.Win32/Mapped/NativeFileInfo.cs b/Pilz.Win32/Mapped/NativeFileInfo.cs new file mode 100644 index 0000000..a54ac89 --- /dev/null +++ b/Pilz.Win32/Mapped/NativeFileInfo.cs @@ -0,0 +1,22 @@ +using Pilz.Win32.Native; + +namespace Pilz.Win32.Mapped; + + +public class NativeFileInfo +{ + + public Icon Icon { get; private set; } + public int SystemIconIndex { get; private set; } + public string Displayname { get; private set; } + public string Typename { get; private set; } + + public NativeFileInfo(SHFILEINFO info) + { + Icon = Icon.FromHandle(info.hIcon); + SystemIconIndex = (int)info.iIcon; + Displayname = info.szDisplayName; + Typename = info.szTypeName; + } + +} \ No newline at end of file diff --git a/Pilz.Win32/Mapped/NativeFileInfo.vb b/Pilz.Win32/Mapped/NativeFileInfo.vb deleted file mode 100644 index 34ae50c..0000000 --- a/Pilz.Win32/Mapped/NativeFileInfo.vb +++ /dev/null @@ -1,23 +0,0 @@ -Imports System.Drawing - -Imports Pilz.Win32.Native - -Namespace Mapped - - Public Class NativeFileInfo - - Public ReadOnly Property Icon As Icon - Public ReadOnly Property SystemIconIndex As Integer - Public ReadOnly Property Displayname As String - Public ReadOnly Property Typename As String - - Public Sub New(info As SHFILEINFO) - Icon = Icon.FromHandle(info.hIcon) - SystemIconIndex = info.iIcon - Displayname = info.szDisplayName - Typename = info.szTypeName - End Sub - - End Class - -End Namespace diff --git a/Pilz.Win32/Mapped/SystemIconSize.cs b/Pilz.Win32/Mapped/SystemIconSize.cs new file mode 100644 index 0000000..26172ac --- /dev/null +++ b/Pilz.Win32/Mapped/SystemIconSize.cs @@ -0,0 +1,13 @@ + +namespace Pilz.Win32.Mapped; + + +/// +/// Two constants extracted from the FileInfoFlags, the only that are +/// meaningfull for the user of this class. +/// +public enum SystemIconSize : int +{ + Large, + Small +} \ No newline at end of file diff --git a/Pilz.Win32/Mapped/SystemIconSize.vb b/Pilz.Win32/Mapped/SystemIconSize.vb deleted file mode 100644 index 99bd177..0000000 --- a/Pilz.Win32/Mapped/SystemIconSize.vb +++ /dev/null @@ -1,12 +0,0 @@ -Namespace Mapped - - ''' - ''' Two constants extracted from the FileInfoFlags, the only that are - ''' meaningfull for the user of this class. - ''' - Public Enum SystemIconSize As Integer - Large - Small - End Enum - -End Namespace diff --git a/Pilz.Win32/My Project/Application.Designer.vb b/Pilz.Win32/My Project/Application.Designer.vb deleted file mode 100644 index 8ab460b..0000000 --- a/Pilz.Win32/My Project/Application.Designer.vb +++ /dev/null @@ -1,13 +0,0 @@ -'------------------------------------------------------------------------------ -' -' Dieser Code wurde von einem Tool generiert. -' Laufzeitversion:4.0.30319.42000 -' -' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -' der Code erneut generiert wird. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - diff --git a/Pilz.Win32/My Project/Application.myapp b/Pilz.Win32/My Project/Application.myapp deleted file mode 100644 index 758895d..0000000 --- a/Pilz.Win32/My Project/Application.myapp +++ /dev/null @@ -1,10 +0,0 @@ - - - false - false - 0 - true - 0 - 1 - true - diff --git a/Pilz.Win32/My Project/Resources.Designer.vb b/Pilz.Win32/My Project/Resources.Designer.vb deleted file mode 100644 index 96af753..0000000 --- a/Pilz.Win32/My Project/Resources.Designer.vb +++ /dev/null @@ -1,63 +0,0 @@ -'------------------------------------------------------------------------------ -' -' Dieser Code wurde von einem Tool generiert. -' Laufzeitversion:4.0.30319.42000 -' -' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -' der Code erneut generiert wird. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - -Imports System - -Namespace My.Resources - - 'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert - '-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. - 'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen - 'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. - ''' - ''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. - ''' - _ - Friend Module Resources - - Private resourceMan As Global.System.Resources.ResourceManager - - Private resourceCulture As Global.System.Globalization.CultureInfo - - ''' - ''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. - ''' - _ - Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager - Get - If Object.ReferenceEquals(resourceMan, Nothing) Then - Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Pilz.Win32.Resources", GetType(Resources).Assembly) - resourceMan = temp - End If - Return resourceMan - End Get - End Property - - ''' - ''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle - ''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. - ''' - _ - Friend Property Culture() As Global.System.Globalization.CultureInfo - Get - Return resourceCulture - End Get - Set - resourceCulture = value - End Set - End Property - End Module -End Namespace diff --git a/Pilz.Win32/My Project/Resources.resx b/Pilz.Win32/My Project/Resources.resx deleted file mode 100644 index af7dbeb..0000000 --- a/Pilz.Win32/My Project/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Pilz.Win32/My Project/Settings.Designer.vb b/Pilz.Win32/My Project/Settings.Designer.vb deleted file mode 100644 index 0cc5b4a..0000000 --- a/Pilz.Win32/My Project/Settings.Designer.vb +++ /dev/null @@ -1,73 +0,0 @@ -'------------------------------------------------------------------------------ -' -' Dieser Code wurde von einem Tool generiert. -' Laufzeitversion:4.0.30319.42000 -' -' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -' der Code erneut generiert wird. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - - -Namespace My - - _ - Partial Friend NotInheritable Class MySettings - Inherits Global.System.Configuration.ApplicationSettingsBase - - Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) - -#Region "Automatische My.Settings-Speicherfunktion" -#If _MyType = "WindowsForms" Then - Private Shared addedHandler As Boolean - - Private Shared addedHandlerLockObject As New Object - - _ - Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs) - If My.Application.SaveMySettingsOnExit Then - My.Settings.Save() - End If - End Sub -#End If -#End Region - - Public Shared ReadOnly Property [Default]() As MySettings - Get - -#If _MyType = "WindowsForms" Then - If Not addedHandler Then - SyncLock addedHandlerLockObject - If Not addedHandler Then - AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings - addedHandler = True - End If - End SyncLock - End If -#End If - Return defaultInstance - End Get - End Property - End Class -End Namespace - -Namespace My - - _ - Friend Module MySettingsProperty - - _ - Friend ReadOnly Property Settings() As Global.Pilz.Win32.My.MySettings - Get - Return Global.Pilz.Win32.My.MySettings.Default - End Get - End Property - End Module -End Namespace diff --git a/Pilz.Win32/My Project/Settings.settings b/Pilz.Win32/My Project/Settings.settings deleted file mode 100644 index 85b890b..0000000 --- a/Pilz.Win32/My Project/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/Pilz.Win32/Native/FileInfoFlags.cs b/Pilz.Win32/Native/FileInfoFlags.cs new file mode 100644 index 0000000..70dc1bc --- /dev/null +++ b/Pilz.Win32/Native/FileInfoFlags.cs @@ -0,0 +1,20 @@ +namespace Pilz.Win32.Native; + + +[Flags] +public enum FileInfoFlags : int +{ + /// + /// Retrieve the handle to the icon that represents the file and the index + /// of the icon within the system image list. The handle is copied to the + /// hIcon member of the structure specified by psfi, and the index is copied + /// to the iIcon member. + /// + SHGFI_ICON = 0x100, + /// + /// Indicates that the function should not attempt to access the file + /// specified by pszPath. Rather, it should act as if the file specified by + /// pszPath exists with the file attributes passed in dwFileAttributes. + /// + SHGFI_USEFILEATTRIBUTES = 0x10 +} \ No newline at end of file diff --git a/Pilz.Win32/Native/FileInfoFlags.vb b/Pilz.Win32/Native/FileInfoFlags.vb deleted file mode 100644 index 120f982..0000000 --- a/Pilz.Win32/Native/FileInfoFlags.vb +++ /dev/null @@ -1,20 +0,0 @@ -Namespace Native - - - Public Enum FileInfoFlags As Integer - ''' - ''' Retrieve the handle to the icon that represents the file and the index - ''' of the icon within the system image list. The handle is copied to the - ''' hIcon member of the structure specified by psfi, and the index is copied - ''' to the iIcon member. - ''' - SHGFI_ICON = &H100 - ''' - ''' Indicates that the function should not attempt to access the file - ''' specified by pszPath. Rather, it should act as if the file specified by - ''' pszPath exists with the file attributes passed in dwFileAttributes. - ''' - SHGFI_USEFILEATTRIBUTES = &H10 - End Enum - -End Namespace \ No newline at end of file diff --git a/Pilz.Win32/Native/Kernel32.cs b/Pilz.Win32/Native/Kernel32.cs new file mode 100644 index 0000000..e1924c7 --- /dev/null +++ b/Pilz.Win32/Native/Kernel32.cs @@ -0,0 +1,15 @@ +using System.Runtime.InteropServices; +using System.Text; + +namespace Pilz.Win32.Native; + + +public class Kernel32 +{ + + private const string LIB_KERNEL32 = "kernel32.dll"; + + [DllImport(LIB_KERNEL32)] + public static extern uint GetModuleFileName(nint hModule, StringBuilder lpFilename, int nSize); + +} \ No newline at end of file diff --git a/Pilz.Win32/Native/Kernel32.vb b/Pilz.Win32/Native/Kernel32.vb deleted file mode 100644 index 0164502..0000000 --- a/Pilz.Win32/Native/Kernel32.vb +++ /dev/null @@ -1,16 +0,0 @@ -Imports System.Runtime.InteropServices -Imports System.Text - -Namespace Native - - Public Class Kernel32 - - Private Const LIB_KERNEL32 As String = "kernel32.dll" - - - Public Shared Function GetModuleFileName(hModule As IntPtr, lpFilename As StringBuilder, nSize As Integer) As UInteger - End Function - - End Class - -End Namespace diff --git a/Pilz.Win32/Native/POINT.cs b/Pilz.Win32/Native/POINT.cs new file mode 100644 index 0000000..d9d570c --- /dev/null +++ b/Pilz.Win32/Native/POINT.cs @@ -0,0 +1,23 @@ +using System.Runtime.InteropServices; + +namespace Pilz.Win32.Native; + + +[StructLayout(LayoutKind.Sequential)] +public struct POINT +{ + public POINT(System.Drawing.Point p) + { + x = p.X; + y = p.Y; + } + + public POINT(int x, int y) + { + this.x = x; + this.y = y; + } + + public int x; + public int y; +} \ No newline at end of file diff --git a/Pilz.Win32/Native/POINT.vb b/Pilz.Win32/Native/POINT.vb deleted file mode 100644 index e967331..0000000 --- a/Pilz.Win32/Native/POINT.vb +++ /dev/null @@ -1,21 +0,0 @@ -Imports System.Runtime.InteropServices - -Namespace Native - - - Public Structure POINT - Public Sub New(ByVal p As System.Drawing.Point) - Me.x = p.X - Me.y = p.Y - End Sub - - Public Sub New(ByVal x As Integer, ByVal y As Integer) - Me.x = x - Me.y = y - End Sub - - Public x As Integer - Public y As Integer - End Structure - -End Namespace diff --git a/Pilz.Win32/Native/RECT.cs b/Pilz.Win32/Native/RECT.cs new file mode 100644 index 0000000..1fd75a2 --- /dev/null +++ b/Pilz.Win32/Native/RECT.cs @@ -0,0 +1,98 @@ +using System.Runtime.InteropServices; + +namespace Pilz.Win32.Native; + + +[Serializable] +[StructLayout(LayoutKind.Sequential)] +public struct RECT +{ + public int Left; + public int Top; + public int Right; + public int Bottom; + + public RECT(int left_, int top_, int right_, int bottom_) + { + Left = left_; + Top = top_; + Right = right_; + Bottom = bottom_; + } + + public RECT(Rectangle r) + { + Left = r.Left; + Top = r.Top; + Right = r.Right; + Bottom = r.Bottom; + } + + public int Height + { + get + { + return Bottom - Top; + } + } + + public int Width + { + get + { + return Right - Left; + } + } + + public Size Size + { + get + { + return new Size(Width, Height); + } + } + + public Point Location + { + get + { + return new Point(Left, Top); + } + } + + public Rectangle ToRectangle() + { + return Rectangle.FromLTRB(Left, Top, Right, Bottom); + } + + public static RECT FromRectangle(Rectangle rectangle) + { + return new RECT(rectangle.Left, rectangle.Top, rectangle.Right, rectangle.Bottom); + } + + public override int GetHashCode() + { + return (int)Math.Round(Math.Pow(Math.Pow(Math.Pow(Left, Top << 13 | Top >> 0x13), Width << 0x1A | Width >> 6), Height << 7 | Height >> 0x19)); + + } + + public static RECT FromXYWH(int x, int y, int width, int height) + { + return new RECT(x, y, x + width, y + height); + } + + public static implicit operator Rectangle(RECT rect) + { + return Rectangle.FromLTRB(rect.Left, rect.Top, rect.Right, rect.Bottom); + } + + public static implicit operator RECT(Rectangle rect) + { + return new RECT(rect.Left, rect.Top, rect.Right, rect.Bottom); + } + + public override string ToString() + { + return "Left=" + Left + ", Top=" + Top + ", Right=" + Right + ", Bottom=" + Bottom; + } +} \ No newline at end of file diff --git a/Pilz.Win32/Native/RECT.vb b/Pilz.Win32/Native/RECT.vb deleted file mode 100644 index 650ecba..0000000 --- a/Pilz.Win32/Native/RECT.vb +++ /dev/null @@ -1,82 +0,0 @@ -Imports System.Drawing -Imports System.Runtime.InteropServices - -Namespace Native - - - Public Structure RECT - Public Left As Integer - Public Top As Integer - Public Right As Integer - Public Bottom As Integer - - Public Sub New(ByVal left_ As Integer, ByVal top_ As Integer, ByVal right_ As Integer, ByVal bottom_ As Integer) - Left = left_ - Top = top_ - Right = right_ - Bottom = bottom_ - End Sub - - Public Sub New(ByVal r As Rectangle) - Left = r.Left - Top = r.Top - Right = r.Right - Bottom = r.Bottom - End Sub - - Public ReadOnly Property Height As Integer - Get - Return Bottom - Top - End Get - End Property - - Public ReadOnly Property Width As Integer - Get - Return Right - Left - End Get - End Property - - Public ReadOnly Property Size As System.Drawing.Size - Get - Return New System.Drawing.Size(Width, Height) - End Get - End Property - - Public ReadOnly Property Location As System.Drawing.Point - Get - Return New System.Drawing.Point(Left, Top) - End Get - End Property - - Public Function ToRectangle() As Rectangle - Return Rectangle.FromLTRB(Left, Top, Right, Bottom) - End Function - - Public Shared Function FromRectangle(ByVal rectangle As Rectangle) As RECT - Return New RECT(rectangle.Left, rectangle.Top, rectangle.Right, rectangle.Bottom) - End Function - - Public Overrides Function GetHashCode() As Integer - Return Left ^ ((Top << 13) Or (Top >> &H13)) _ - ^ ((Width << &H1A) Or (Width >> 6)) _ - ^ ((Height << 7) Or (Height >> &H19)) - End Function - - Public Shared Function FromXYWH(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer) As RECT - Return New RECT(x, y, x + width, y + height) - End Function - - Public Shared Widening Operator CType(ByVal rect As RECT) As Rectangle - Return Rectangle.FromLTRB(rect.Left, rect.Top, rect.Right, rect.Bottom) - End Operator - - Public Shared Widening Operator CType(ByVal rect As Rectangle) As RECT - Return New RECT(rect.Left, rect.Top, rect.Right, rect.Bottom) - End Operator - - Public Overrides Function ToString() As String - Return "Left=" & Me.Left & ", Top=" & Me.Top & ", Right=" & Me.Right & ", Bottom=" & Me.Bottom - End Function - End Structure - -End Namespace diff --git a/Pilz.Win32/Native/SHFILEINFO.cs b/Pilz.Win32/Native/SHFILEINFO.cs new file mode 100644 index 0000000..95d2bed --- /dev/null +++ b/Pilz.Win32/Native/SHFILEINFO.cs @@ -0,0 +1,46 @@ +using System.Runtime.InteropServices; + +namespace Pilz.Win32.Native; + + +/// +/// Contains information about a file object. +/// +[StructLayout(LayoutKind.Sequential)] +public struct SHFILEINFO +{ + public const uint SHGFI_ICON = 0x100U; + public const uint SHGFI_LARGEICON = 0x0U; + public const uint SHGFI_SMALLICON = 0x1U; + /// + /// Handle to the icon that represents the file. You are responsible for + /// destroying this handle with DestroyIcon when you no longer need it. + /// + public nint hIcon; + + /// + /// Index of the icon image within the system image list. + /// + public nint iIcon; + + /// + /// Array of values that indicates the attributes of the file object. + /// For information about these values, see the IShellFolder::GetAttributesOf + /// method. + /// + public uint dwAttributes; + + /// + /// String that contains the name of the file as it appears in the Microsoft + /// Windows Shell, or the path and file name of the file that contains the + /// icon representing the file. + /// + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] + public string szDisplayName; + + /// + /// String that describes the type of file. + /// + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)] + public string szTypeName; +} \ No newline at end of file diff --git a/Pilz.Win32/Native/SHFILEINFO.vb b/Pilz.Win32/Native/SHFILEINFO.vb deleted file mode 100644 index 3717b55..0000000 --- a/Pilz.Win32/Native/SHFILEINFO.vb +++ /dev/null @@ -1,46 +0,0 @@ -Imports System.Runtime.InteropServices - -Namespace Native - - ''' - ''' Contains information about a file object. - ''' - - Public Structure SHFILEINFO - Public Const SHGFI_ICON As UInteger = &H100 - Public Const SHGFI_LARGEICON As UInteger = &H0 - Public Const SHGFI_SMALLICON As UInteger = &H1 - ''' - ''' Handle to the icon that represents the file. You are responsible for - ''' destroying this handle with DestroyIcon when you no longer need it. - ''' - Public hIcon As IntPtr - - ''' - ''' Index of the icon image within the system image list. - ''' - Public iIcon As IntPtr - - ''' - ''' Array of values that indicates the attributes of the file object. - ''' For information about these values, see the IShellFolder::GetAttributesOf - ''' method. - ''' - Public dwAttributes As UInteger - - ''' - ''' String that contains the name of the file as it appears in the Microsoft - ''' Windows Shell, or the path and file name of the file that contains the - ''' icon representing the file. - ''' - - Public szDisplayName As String - - ''' - ''' String that describes the type of file. - ''' - - Public szTypeName As String - End Structure - -End Namespace diff --git a/Pilz.Win32/Native/Shell32.cs b/Pilz.Win32/Native/Shell32.cs new file mode 100644 index 0000000..089487f --- /dev/null +++ b/Pilz.Win32/Native/Shell32.cs @@ -0,0 +1,68 @@ +using System.Runtime.InteropServices; + +namespace Pilz.Win32.Native; + + +public class Shell32 +{ + + /// + /// Creates an array of handles to large or small icons extracted from + /// the specified executable file, dynamic-link library (DLL), or icon + /// file. + /// + /// + /// Name of an executable file, DLL, or icon file from which icons will + /// be extracted. + /// + /// + /// + /// Specifies the zero-based index of the first icon to extract. For + /// example, if this value is zero, the function extracts the first + /// icon in the specified file. + /// + /// + /// If this value is �1 and and + /// are both NULL, the function returns + /// the total number of icons in the specified file. If the file is an + /// executable file or DLL, the return value is the number of + /// RT_GROUP_ICON resources. If the file is an .ico file, the return + /// value is 1. + /// + /// + /// Windows 95/98/Me, Windows NT 4.0 and later: If this value is a + /// negative number and either or + /// is not NULL, the function begins by + /// extracting the icon whose resource identifier is equal to the + /// absolute value of . For example, use -3 + /// to extract the icon whose resource identifier is 3. + /// + /// + /// + /// An array of icon handles that receives handles to the large icons + /// extracted from the file. If this parameter is NULL, no large icons + /// are extracted from the file. + /// + /// + /// An array of icon handles that receives handles to the small icons + /// extracted from the file. If this parameter is NULL, no small icons + /// are extracted from the file. + /// + /// + /// Specifies the number of icons to extract from the file. + /// + /// + /// If the parameter is -1, the + /// parameter is NULL, and the + /// parameter is NULL, then the return + /// value is the number of icons contained in the specified file. + /// Otherwise, the return value is the number of icons successfully + /// extracted from the file. + /// + [DllImport("Shell32", CharSet = CharSet.Auto)] + public static extern int ExtractIconEx([MarshalAs(UnmanagedType.LPTStr)] string lpszFile, int nIconIndex, nint[] phIconLarge, nint[] phIconSmall, int nIcons); + + [DllImport("shell32.dll")] + public static extern nint SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbSizeFileInfo, uint uFlags); + +} \ No newline at end of file diff --git a/Pilz.Win32/Native/Shell32.vb b/Pilz.Win32/Native/Shell32.vb deleted file mode 100644 index b0ed266..0000000 --- a/Pilz.Win32/Native/Shell32.vb +++ /dev/null @@ -1,68 +0,0 @@ -Imports System.Runtime.InteropServices - -Namespace Native - - Public Class Shell32 - - ''' - ''' Creates an array of handles to large or small icons extracted from - ''' the specified executable file, dynamic-link library (DLL), or icon - ''' file. - ''' - ''' - ''' Name of an executable file, DLL, or icon file from which icons will - ''' be extracted. - ''' - ''' - ''' - ''' Specifies the zero-based index of the first icon to extract. For - ''' example, if this value is zero, the function extracts the first - ''' icon in the specified file. - ''' - ''' - ''' If this value is �1 and and - ''' are both NULL, the function returns - ''' the total number of icons in the specified file. If the file is an - ''' executable file or DLL, the return value is the number of - ''' RT_GROUP_ICON resources. If the file is an .ico file, the return - ''' value is 1. - ''' - ''' - ''' Windows 95/98/Me, Windows NT 4.0 and later: If this value is a - ''' negative number and either or - ''' is not NULL, the function begins by - ''' extracting the icon whose resource identifier is equal to the - ''' absolute value of . For example, use -3 - ''' to extract the icon whose resource identifier is 3. - ''' - ''' - ''' - ''' An array of icon handles that receives handles to the large icons - ''' extracted from the file. If this parameter is NULL, no large icons - ''' are extracted from the file. - ''' - ''' - ''' An array of icon handles that receives handles to the small icons - ''' extracted from the file. If this parameter is NULL, no small icons - ''' are extracted from the file. - ''' - ''' - ''' Specifies the number of icons to extract from the file. - ''' - ''' - ''' If the parameter is -1, the - ''' parameter is NULL, and the - ''' parameter is NULL, then the return - ''' value is the number of icons contained in the specified file. - ''' Otherwise, the return value is the number of icons successfully - ''' extracted from the file. - ''' - - Public Shared Function ExtractIconEx( ByVal lpszFile As String, ByVal nIconIndex As Integer, ByVal phIconLarge As IntPtr(), ByVal phIconSmall As IntPtr(), ByVal nIcons As Integer) As Integer - End Function - - Public Declare Function SHGetFileInfo Lib "shell32.dll" (ByVal pszPath As String, ByVal dwFileAttributes As UInteger, ByRef psfi As SHFILEINFO, ByVal cbSizeFileInfo As UInteger, ByVal uFlags As UInteger) As IntPtr - - End Class - -End Namespace diff --git a/Pilz.Win32/Native/User32.cs b/Pilz.Win32/Native/User32.cs new file mode 100644 index 0000000..18e89d0 --- /dev/null +++ b/Pilz.Win32/Native/User32.cs @@ -0,0 +1,20 @@ +using System.Runtime.InteropServices; + +namespace Pilz.Win32.Native; + + +public class User32 +{ + + private const string LIB_USER32 = "user32.dll"; + + [DllImport(LIB_USER32)] + public static extern bool GetWindowRect(nint hWnd, ref RECT r); + + [DllImport(LIB_USER32)] + public static extern nint ChildWindowFromPointEx(nint hWndParent, POINT pt, uint uFlags); + + [DllImport(LIB_USER32)] + public static extern short GetKeyState(int keyCode); + +} \ No newline at end of file diff --git a/Pilz.Win32/Native/User32.vb b/Pilz.Win32/Native/User32.vb deleted file mode 100644 index 3fcce54..0000000 --- a/Pilz.Win32/Native/User32.vb +++ /dev/null @@ -1,23 +0,0 @@ -Imports System.Runtime.InteropServices - -Namespace Native - - Public Class User32 - - Private Const LIB_USER32 As String = "user32.dll" - - - Public Shared Function GetWindowRect(ByVal hWnd As IntPtr, ByRef r As RECT) As Boolean - End Function - - - Public Shared Function ChildWindowFromPointEx(ByVal hWndParent As IntPtr, ByVal pt As POINT, ByVal uFlags As UInteger) As IntPtr - End Function - - - Public Shared Function GetKeyState(keyCode As Integer) As Short - End Function - - End Class - -End Namespace diff --git a/Pilz.Win32/Native/WindowFromPointFlags.cs b/Pilz.Win32/Native/WindowFromPointFlags.cs new file mode 100644 index 0000000..5d3113f --- /dev/null +++ b/Pilz.Win32/Native/WindowFromPointFlags.cs @@ -0,0 +1,11 @@ +namespace Pilz.Win32.Native; + + +[Flags] +public enum WindowFromPointFlags +{ + CWP_ALL = 0x0, + CWP_SKIPINVISIBLE = 0x1, + CWP_SKIPDISABLED = 0x2, + CWP_SKIPTRANSPARENT = 0x4 +} \ No newline at end of file diff --git a/Pilz.Win32/Native/WindowFromPointFlags.vb b/Pilz.Win32/Native/WindowFromPointFlags.vb deleted file mode 100644 index e127c8c..0000000 --- a/Pilz.Win32/Native/WindowFromPointFlags.vb +++ /dev/null @@ -1,11 +0,0 @@ -Namespace Native - - - Public Enum WindowFromPointFlags - CWP_ALL = &H0 - CWP_SKIPINVISIBLE = &H1 - CWP_SKIPDISABLED = &H2 - CWP_SKIPTRANSPARENT = &H4 - End Enum - -End Namespace \ No newline at end of file diff --git a/Pilz.IO/Extensions.cs b/Pilz.Win32/NativeTools.cs similarity index 72% rename from Pilz.IO/Extensions.cs rename to Pilz.Win32/NativeTools.cs index b3f0622..0bfd409 100644 --- a/Pilz.IO/Extensions.cs +++ b/Pilz.Win32/NativeTools.cs @@ -1,12 +1,10 @@ using Pilz.Runtime; using Pilz.Win32.Native; -using System; -using System.Diagnostics; using System.Text; -namespace Pilz.IO; +namespace Pilz.Win32; -public static class Extensions +public static class NativeTools { static readonly int MAX_PATH = 255; @@ -18,7 +16,6 @@ public static class Extensions Kernel32.GetModuleFileName(IntPtr.Zero, sb, MAX_PATH); return sb.ToString(); } - else - return Process.GetCurrentProcess().MainModule.FileName; + return Environment.ProcessPath; //Process.GetCurrentProcess().MainModule.FileName; } } diff --git a/Pilz.Win32/Pilz.Win32.csproj b/Pilz.Win32/Pilz.Win32.csproj new file mode 100644 index 0000000..4506581 --- /dev/null +++ b/Pilz.Win32/Pilz.Win32.csproj @@ -0,0 +1,15 @@ + + + + net8.0-windows + true + 2.1.0 + enable + annotations + + + + + + + \ No newline at end of file diff --git a/Pilz.Win32/Pilz.Win32.vbproj b/Pilz.Win32/Pilz.Win32.vbproj deleted file mode 100644 index d4e4a11..0000000 --- a/Pilz.Win32/Pilz.Win32.vbproj +++ /dev/null @@ -1,81 +0,0 @@ - - - Windows - net6.0-windows;net8.0-windows - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - Pilz.Win32.xml - true - true - - - true - - - false - - - On - - - Binary - - - Off - - - On - - - 2.0.0 - - - - - - - - - - - - - - - - - - - True - Application.myapp - - - True - True - Resources.resx - - - True - Settings.settings - True - - - - - VbMyResourcesResXFileCodeGenerator - Resources.Designer.vb - My.Resources - Designer - - - - - MyApplicationCodeGenerator - Application.Designer.vb - - - SettingsSingleFileGenerator - My - Settings.Designer.vb - - - \ No newline at end of file diff --git a/Pilz.sln b/Pilz.sln index 37cd836..a5e2904 100644 --- a/Pilz.sln +++ b/Pilz.sln @@ -15,7 +15,7 @@ Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Pilz.Threading", "Pilz.Thre EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.IO", "Pilz.IO\Pilz.IO.csproj", "{877D980E-4F61-0E53-0E8B-5C50B7D1440C}" EndProject -Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Pilz.Win32", "Pilz.Win32\Pilz.Win32.vbproj", "{0BE0428D-AC97-4812-ADFC-6D7D00AEE497}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.Win32", "Pilz.Win32\Pilz.Win32.csproj", "{B9C4C3E6-60CF-07E3-2FA4-A7036239D037}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.Configuration", "Pilz.Configuration\Pilz.Configuration.csproj", "{1748E038-0A47-04E1-3C5E-FF9566DFFB7C}" EndProject @@ -101,14 +101,14 @@ Global {877D980E-4F61-0E53-0E8B-5C50B7D1440C}.Release|Any CPU.Build.0 = Release|Any CPU {877D980E-4F61-0E53-0E8B-5C50B7D1440C}.Release|x86.ActiveCfg = Release|Any CPU {877D980E-4F61-0E53-0E8B-5C50B7D1440C}.Release|x86.Build.0 = Release|Any CPU - {0BE0428D-AC97-4812-ADFC-6D7D00AEE497}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0BE0428D-AC97-4812-ADFC-6D7D00AEE497}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0BE0428D-AC97-4812-ADFC-6D7D00AEE497}.Debug|x86.ActiveCfg = Debug|Any CPU - {0BE0428D-AC97-4812-ADFC-6D7D00AEE497}.Debug|x86.Build.0 = Debug|Any CPU - {0BE0428D-AC97-4812-ADFC-6D7D00AEE497}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0BE0428D-AC97-4812-ADFC-6D7D00AEE497}.Release|Any CPU.Build.0 = Release|Any CPU - {0BE0428D-AC97-4812-ADFC-6D7D00AEE497}.Release|x86.ActiveCfg = Release|Any CPU - {0BE0428D-AC97-4812-ADFC-6D7D00AEE497}.Release|x86.Build.0 = Release|Any CPU + {B9C4C3E6-60CF-07E3-2FA4-A7036239D037}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B9C4C3E6-60CF-07E3-2FA4-A7036239D037}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B9C4C3E6-60CF-07E3-2FA4-A7036239D037}.Debug|x86.ActiveCfg = Debug|Any CPU + {B9C4C3E6-60CF-07E3-2FA4-A7036239D037}.Debug|x86.Build.0 = Debug|Any CPU + {B9C4C3E6-60CF-07E3-2FA4-A7036239D037}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B9C4C3E6-60CF-07E3-2FA4-A7036239D037}.Release|Any CPU.Build.0 = Release|Any CPU + {B9C4C3E6-60CF-07E3-2FA4-A7036239D037}.Release|x86.ActiveCfg = Release|Any CPU + {B9C4C3E6-60CF-07E3-2FA4-A7036239D037}.Release|x86.Build.0 = Release|Any CPU {1748E038-0A47-04E1-3C5E-FF9566DFFB7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1748E038-0A47-04E1-3C5E-FF9566DFFB7C}.Debug|Any CPU.Build.0 = Debug|Any CPU {1748E038-0A47-04E1-3C5E-FF9566DFFB7C}.Debug|x86.ActiveCfg = Debug|Any CPU diff --git a/Pilz/Pilz.csproj b/Pilz/Pilz.csproj index b5a1147..347a2bd 100644 --- a/Pilz/Pilz.csproj +++ b/Pilz/Pilz.csproj @@ -4,8 +4,8 @@ net8.0 latest enable - enable - 2.1.1 + annotations + 2.2.0