migrate Pilz.Win32 & optimize Pilz & Pilz.IO

This commit is contained in:
2024-09-01 08:54:57 +02:00
parent f370642354
commit 7a94fcf360
55 changed files with 700 additions and 1427 deletions

View File

@@ -93,7 +93,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Pilz.Simple3DFileParser\Pilz.Simple3DFileParser.vbproj" /> <ProjectReference Include="..\Pilz.Simple3DFileParser\Pilz.Simple3DFileParser.vbproj" />
<ProjectReference Include="..\Pilz.Win32\Pilz.Win32.vbproj" /> <ProjectReference Include="..\Pilz.Win32\Pilz.Win32.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="ModelPreview.Designer.vb" /> <Compile Remove="ModelPreview.Designer.vb" />

View File

@@ -1,9 +1,5 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Threading.Tasks;
namespace Pilz.IO; namespace Pilz.IO;

View File

@@ -1,13 +0,0 @@
using System;
namespace Pilz.IO;
public class DataEventArgs : EventArgs
{
public readonly byte[] Data;
public DataEventArgs(byte[] bytes) : base()
{
Data = bytes;
}
}

View File

@@ -0,0 +1,6 @@
namespace Pilz.IO.EventArguments;
public class DataEventArgs(byte[] data) : EventArgs()
{
public byte[] Data { get; } = data;
}

View File

@@ -1,7 +1,4 @@
using System; namespace Pilz.IO;
using System.IO;
namespace Pilz.IO;
public partial class FileLocker : IDisposable public partial class FileLocker : IDisposable
{ {

View File

@@ -1,8 +1,6 @@
using System; using Pilz.IO.EventArguments;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Pilz.IO; namespace Pilz.IO.ManagedPipes;
/// <summary> /// <summary>
/// stellt den Erben "Server" und "Client" 2 verschiedene /// stellt den Erben "Server" und "Client" 2 verschiedene

View File

@@ -1,9 +1,7 @@
using global::System.IO.Pipes; using Pilz.IO.EventArguments;
using System; using System.IO.Pipes;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Pilz.IO; namespace Pilz.IO.ManagedPipes;
public class ManagedPipeClient : ManagedPipe public class ManagedPipeClient : ManagedPipe
{ {

View File

@@ -1,9 +1,7 @@
using global::System.IO.Pipes; using Pilz.IO.EventArguments;
using System; using System.IO.Pipes;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Pilz.IO; namespace Pilz.IO.ManagedPipes;
public class ManagedPipeServer : ManagedPipe public class ManagedPipeServer : ManagedPipe
{ {

View File

@@ -1,11 +0,0 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
// ------------------------------------------------------------------------------

View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>false</MySubMain>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<ApplicationType>1</ApplicationType>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData>

View File

@@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -1,96 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<MyType>Windows</MyType> <TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net6.0-windows;net8.0-windows</TargetFrameworks> <Version>2.1.0</Version>
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes> <Nullable>enable</Nullable>
<LangVersion>latest</LangVersion> <ImplicitUsings>annotations</ImplicitUsings>
<AssemblyTitle>NamedPipeManaging</AssemblyTitle>
<Company>Dr. Schneider Kunststoffwerke GmbH</Company>
<Product>NamedPipeManaging</Product>
<Copyright>Copyright © Pascal Schedel 2017 - 2018</Copyright>
<DocumentationFile>Pilz.IO.xml</DocumentationFile>
<DefineTrace>true</DefineTrace>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineDebug>true</DefineDebug>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,CS1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DefineDebug>false</DefineDebug>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,CS1591</NoWarn>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DefineDebug>true</DefineDebug>
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<UseVSHostingProcess>true</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup>
<Version>2.0.0</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" /> <Compile Remove="My Project\**" />
<PackageReference Include="System.Net.Http" Version="4.3.4" /> <EmbeddedResource Remove="My Project\**" />
<None Remove="My Project\**" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Update="My Project\Application.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
</Compile>
<Compile Update="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<CustomToolNamespace>Pilz.IO.My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Pilz.Win32\Pilz.Win32.vbproj" />
<ProjectReference Include="..\Pilz\Pilz.csproj" /> <ProjectReference Include="..\Pilz\Pilz.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -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")]

View File

@@ -1,63 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Pilz.IO.My.Resources {
using System;
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// 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() {
}
/// <summary>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[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;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -47,6 +47,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Pilz.Drawing\Pilz.Drawing.vbproj" /> <ProjectReference Include="..\Pilz.Drawing\Pilz.Drawing.vbproj" />
<ProjectReference Include="..\Pilz.Win32\Pilz.Win32.vbproj" /> <ProjectReference Include="..\Pilz.Win32\Pilz.Win32.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -0,0 +1,36 @@
using Pilz.Win32.Mapped;
using Pilz.Win32.Native;
using System.Runtime.InteropServices;
namespace Pilz.Win32.Internals;
public class IconExtractor
{
/// <summary>
/// Extrahiert das Icon aus einer Datei oder aus einem Ordner.
/// </summary>
/// <param name="FilePath">Hier übergeben Sie den Pfad der Datei von dem das Icon extrahiert werden soll.</param>
/// <param name="size">Bei übergabe von true wird ein kleines und bei false ein großes Icon zurück gegeben.</param>
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;
}
}

View File

@@ -1,34 +0,0 @@
Imports System.Drawing
Imports System.Runtime.InteropServices
Imports Pilz.Win32.Mapped
Imports Pilz.Win32.Native
Namespace Internals
Public Class IconExtractor
''' <summary>
''' Extrahiert das Icon aus einer Datei oder aus einem Ordner.
''' </summary>
''' <param name="FilePath">Hier übergeben Sie den Pfad der Datei von dem das Icon extrahiert werden soll.</param>
''' <param name="size">Bei übergabe von true wird ein kleines und bei false ein großes Icon zurück gegeben.</param>
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

View File

@@ -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
/// <summary>
/// Get the number of icons in the specified file.
/// </summary>
/// <param name="fileName">Full path of the file to look for.</param>
/// <returns></returns>
private static int GetIconsCountInFile(string fileName)
{
return ExtractIconEx(fileName, -1, null, null, 0);
}
#region ExtractIcon-like functions
public static void ExtractEx(string fileName, List<Icon> largeIcons, List<Icon> 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<Icon> ExtractEx(string fileName, SystemIconSize size, int firstIconIndex, int iconCount)
{
var iconList = new List<Icon>();
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<Icon> largeIcons, List<Icon> smallIcons)
{
var iconCount = GetIconsCountInFile(fileName);
ExtractEx(fileName, largeIcons, smallIcons, 0, iconCount);
}
public static List<Icon> 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<Icon>();
var largeIconList = new List<Icon>();
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));
}
/// <summary>
/// Parse strings in registry who contains the name of the icon and
/// the index of the icon an return both parts.
/// </summary>
/// <param name="regString">The full string in the form "path,index" as found in registry.</param>
/// <param name="fileName">The "path" part of the string.</param>
/// <param name="index">The "index" part of the string.</param>
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);
}
}

View File

@@ -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
''' <summary>
''' Get the number of icons in the specified file.
''' </summary>
''' <param name="fileName">Full path of the file to look for.</param>
''' <returns></returns>
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, <Out> ByRef largeIcon As Icon, <Out> 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
''' <summary>
''' Parse strings in registry who contains the name of the icon and
''' the index of the icon an return both parts.
''' </summary>
''' <param name="regString">The full string in the form "path,index" as found in registry.</param>
''' <param name="fileName">The "path" part of the string.</param>
''' <param name="index">The "index" part of the string.</param>
Public Shared Sub ExtractInformationsFromRegistryString(ByVal regString As String, <Out> ByRef fileName As String, <Out> 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

View File

@@ -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);
}
}

View File

@@ -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

View File

@@ -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);
}
}

View File

@@ -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

View File

@@ -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;
}
}

View File

@@ -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

View File

@@ -0,0 +1,13 @@
namespace Pilz.Win32.Mapped;
/// <summary>
/// Two constants extracted from the FileInfoFlags, the only that are
/// meaningfull for the user of this class.
/// </summary>
public enum SystemIconSize : int
{
Large,
Small
}

View File

@@ -1,12 +0,0 @@
Namespace Mapped
''' <summary>
''' Two constants extracted from the FileInfoFlags, the only that are
''' meaningfull for the user of this class.
''' </summary>
Public Enum SystemIconSize As Integer
Large
Small
End Enum
End Namespace

View File

@@ -1,13 +0,0 @@
'------------------------------------------------------------------------------
' <auto-generated>
' 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.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On

View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>false</MySubMain>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<ApplicationType>1</ApplicationType>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData>

View File

@@ -1,63 +0,0 @@
'------------------------------------------------------------------------------
' <auto-generated>
' 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.
' </auto-generated>
'------------------------------------------------------------------------------
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.
'''<summary>
''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
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
'''<summary>
''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set
resourceCulture = value
End Set
End Property
End Module
End Namespace

View File

@@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -1,73 +0,0 @@
'------------------------------------------------------------------------------
' <auto-generated>
' 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.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
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
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
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
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
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

View File

@@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1,20 @@
namespace Pilz.Win32.Native;
[Flags]
public enum FileInfoFlags : int
{
/// <summary>
/// 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.
/// </summary>
SHGFI_ICON = 0x100,
/// <summary>
/// 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.
/// </summary>
SHGFI_USEFILEATTRIBUTES = 0x10
}

View File

@@ -1,20 +0,0 @@
Namespace Native
<Flags>
Public Enum FileInfoFlags As Integer
''' <summary>
''' 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.
''' </summary>
SHGFI_ICON = &H100
''' <summary>
''' 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.
''' </summary>
SHGFI_USEFILEATTRIBUTES = &H10
End Enum
End Namespace

View File

@@ -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);
}

View File

@@ -1,16 +0,0 @@
Imports System.Runtime.InteropServices
Imports System.Text
Namespace Native
Public Class Kernel32
Private Const LIB_KERNEL32 As String = "kernel32.dll"
<DllImport(LIB_KERNEL32)>
Public Shared Function GetModuleFileName(hModule As IntPtr, lpFilename As StringBuilder, nSize As Integer) As UInteger
End Function
End Class
End Namespace

View File

@@ -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;
}

View File

@@ -1,21 +0,0 @@
Imports System.Runtime.InteropServices
Namespace Native
<StructLayout(LayoutKind.Sequential)>
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

98
Pilz.Win32/Native/RECT.cs Normal file
View File

@@ -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;
}
}

View File

@@ -1,82 +0,0 @@
Imports System.Drawing
Imports System.Runtime.InteropServices
Namespace Native
<Serializable, StructLayout(LayoutKind.Sequential)>
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

View File

@@ -0,0 +1,46 @@
using System.Runtime.InteropServices;
namespace Pilz.Win32.Native;
/// <summary>
/// Contains information about a file object.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct SHFILEINFO
{
public const uint SHGFI_ICON = 0x100U;
public const uint SHGFI_LARGEICON = 0x0U;
public const uint SHGFI_SMALLICON = 0x1U;
/// <summary>
/// Handle to the icon that represents the file. You are responsible for
/// destroying this handle with DestroyIcon when you no longer need it.
/// </summary>
public nint hIcon;
/// <summary>
/// Index of the icon image within the system image list.
/// </summary>
public nint iIcon;
/// <summary>
/// Array of values that indicates the attributes of the file object.
/// For information about these values, see the IShellFolder::GetAttributesOf
/// method.
/// </summary>
public uint dwAttributes;
/// <summary>
/// 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.
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string szDisplayName;
/// <summary>
/// String that describes the type of file.
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
public string szTypeName;
}

View File

@@ -1,46 +0,0 @@
Imports System.Runtime.InteropServices
Namespace Native
''' <summary>
''' Contains information about a file object.
''' </summary>
<StructLayout(LayoutKind.Sequential)>
Public Structure SHFILEINFO
Public Const SHGFI_ICON As UInteger = &H100
Public Const SHGFI_LARGEICON As UInteger = &H0
Public Const SHGFI_SMALLICON As UInteger = &H1
''' <summary>
''' Handle to the icon that represents the file. You are responsible for
''' destroying this handle with DestroyIcon when you no longer need it.
''' </summary>
Public hIcon As IntPtr
''' <summary>
''' Index of the icon image within the system image list.
''' </summary>
Public iIcon As IntPtr
''' <summary>
''' Array of values that indicates the attributes of the file object.
''' For information about these values, see the IShellFolder::GetAttributesOf
''' method.
''' </summary>
Public dwAttributes As UInteger
''' <summary>
''' 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.
''' </summary>
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)>
Public szDisplayName As String
''' <summary>
''' String that describes the type of file.
''' </summary>
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)>
Public szTypeName As String
End Structure
End Namespace

View File

@@ -0,0 +1,68 @@
using System.Runtime.InteropServices;
namespace Pilz.Win32.Native;
public class Shell32
{
/// <summary>
/// Creates an array of handles to large or small icons extracted from
/// the specified executable file, dynamic-link library (DLL), or icon
/// file.
/// </summary>
/// <param name="lpszFile">
/// Name of an executable file, DLL, or icon file from which icons will
/// be extracted.
/// </param>
/// <param name="nIconIndex">
/// <para>
/// 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.
/// </para>
/// <para>
/// If this value is <20>1 and <paramrefname="phiconLarge"/> and
/// <paramrefname="phiconSmall"/> 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.
/// </para>
/// <para>
/// Windows 95/98/Me, Windows NT 4.0 and later: If this value is a
/// negative number and either <paramrefname="phiconLarge"/> or
/// <paramrefname="phiconSmall"/> is not NULL, the function begins by
/// extracting the icon whose resource identifier is equal to the
/// absolute value of <paramrefname="nIconIndex"/>. For example, use -3
/// to extract the icon whose resource identifier is 3.
/// </para>
/// </param>
/// <param name="phIconLarge">
/// 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.
/// </param>
/// <param name="phIconSmall">
/// 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.
/// </param>
/// <param name="nIcons">
/// Specifies the number of icons to extract from the file.
/// </param>
/// <returns>
/// If the <paramrefname="nIconIndex"/> parameter is -1, the
/// <paramrefname="phIconLarge"/> parameter is NULL, and the
/// <paramrefname="phiconSmall"/> 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.
/// </returns>
[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);
}

View File

@@ -1,68 +0,0 @@
Imports System.Runtime.InteropServices
Namespace Native
Public Class Shell32
''' <summary>
''' Creates an array of handles to large or small icons extracted from
''' the specified executable file, dynamic-link library (DLL), or icon
''' file.
''' </summary>
''' <param name="lpszFile">
''' Name of an executable file, DLL, or icon file from which icons will
''' be extracted.
''' </param>
''' <param name="nIconIndex">
''' <para>
''' 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.
''' </para>
''' <para>
''' If this value is <20>1 and <paramrefname="phiconLarge"/> and
''' <paramrefname="phiconSmall"/> 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.
''' </para>
''' <para>
''' Windows 95/98/Me, Windows NT 4.0 and later: If this value is a
''' negative number and either <paramrefname="phiconLarge"/> or
''' <paramrefname="phiconSmall"/> is not NULL, the function begins by
''' extracting the icon whose resource identifier is equal to the
''' absolute value of <paramrefname="nIconIndex"/>. For example, use -3
''' to extract the icon whose resource identifier is 3.
''' </para>
''' </param>
''' <param name="phIconLarge">
''' 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.
''' </param>
''' <param name="phIconSmall">
''' 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.
''' </param>
''' <param name="nIcons">
''' Specifies the number of icons to extract from the file.
''' </param>
''' <returns>
''' If the <paramrefname="nIconIndex"/> parameter is -1, the
''' <paramrefname="phIconLarge"/> parameter is NULL, and the
''' <paramrefname="phiconSmall"/> 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.
''' </returns>
<DllImport("Shell32", CharSet:=CharSet.Auto)>
Public Shared Function ExtractIconEx(<MarshalAs(UnmanagedType.LPTStr)> 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

View File

@@ -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);
}

View File

@@ -1,23 +0,0 @@
Imports System.Runtime.InteropServices
Namespace Native
Public Class User32
Private Const LIB_USER32 As String = "user32.dll"
<DllImport(LIB_USER32)>
Public Shared Function GetWindowRect(ByVal hWnd As IntPtr, ByRef r As RECT) As Boolean
End Function
<DllImport(LIB_USER32)>
Public Shared Function ChildWindowFromPointEx(ByVal hWndParent As IntPtr, ByVal pt As POINT, ByVal uFlags As UInteger) As IntPtr
End Function
<DllImport(LIB_USER32)>
Public Shared Function GetKeyState(keyCode As Integer) As Short
End Function
End Class
End Namespace

View File

@@ -0,0 +1,11 @@
namespace Pilz.Win32.Native;
[Flags]
public enum WindowFromPointFlags
{
CWP_ALL = 0x0,
CWP_SKIPINVISIBLE = 0x1,
CWP_SKIPDISABLED = 0x2,
CWP_SKIPTRANSPARENT = 0x4
}

View File

@@ -1,11 +0,0 @@
Namespace Native
<Flags>
Public Enum WindowFromPointFlags
CWP_ALL = &H0
CWP_SKIPINVISIBLE = &H1
CWP_SKIPDISABLED = &H2
CWP_SKIPTRANSPARENT = &H4
End Enum
End Namespace

View File

@@ -1,12 +1,10 @@
using Pilz.Runtime; using Pilz.Runtime;
using Pilz.Win32.Native; using Pilz.Win32.Native;
using System;
using System.Diagnostics;
using System.Text; using System.Text;
namespace Pilz.IO; namespace Pilz.Win32;
public static class Extensions public static class NativeTools
{ {
static readonly int MAX_PATH = 255; static readonly int MAX_PATH = 255;
@@ -18,7 +16,6 @@ public static class Extensions
Kernel32.GetModuleFileName(IntPtr.Zero, sb, MAX_PATH); Kernel32.GetModuleFileName(IntPtr.Zero, sb, MAX_PATH);
return sb.ToString(); return sb.ToString();
} }
else return Environment.ProcessPath; //Process.GetCurrentProcess().MainModule.FileName;
return Process.GetCurrentProcess().MainModule.FileName;
} }
} }

View File

@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0-windows</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<Version>2.1.0</Version>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>annotations</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Pilz\Pilz.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,81 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<MyType>Windows</MyType>
<TargetFrameworks>net6.0-windows;net8.0-windows</TargetFrameworks>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DocumentationFile>Pilz.Win32.xml</DocumentationFile>
<DefineTrace>true</DefineTrace>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineDebug>true</DefineDebug>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DefineDebug>false</DefineDebug>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup>
<Version>2.0.0</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Update="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
</Compile>
<Compile Update="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Update="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</None>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
</ItemGroup>
</Project>

View File

@@ -15,7 +15,7 @@ Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Pilz.Threading", "Pilz.Thre
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.IO", "Pilz.IO\Pilz.IO.csproj", "{877D980E-4F61-0E53-0E8B-5C50B7D1440C}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.IO", "Pilz.IO\Pilz.IO.csproj", "{877D980E-4F61-0E53-0E8B-5C50B7D1440C}"
EndProject 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 EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.Configuration", "Pilz.Configuration\Pilz.Configuration.csproj", "{1748E038-0A47-04E1-3C5E-FF9566DFFB7C}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.Configuration", "Pilz.Configuration\Pilz.Configuration.csproj", "{1748E038-0A47-04E1-3C5E-FF9566DFFB7C}"
EndProject 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|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.ActiveCfg = Release|Any CPU
{877D980E-4F61-0E53-0E8B-5C50B7D1440C}.Release|x86.Build.0 = 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 {B9C4C3E6-60CF-07E3-2FA4-A7036239D037}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0BE0428D-AC97-4812-ADFC-6D7D00AEE497}.Debug|Any CPU.Build.0 = Debug|Any CPU {B9C4C3E6-60CF-07E3-2FA4-A7036239D037}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0BE0428D-AC97-4812-ADFC-6D7D00AEE497}.Debug|x86.ActiveCfg = Debug|Any CPU {B9C4C3E6-60CF-07E3-2FA4-A7036239D037}.Debug|x86.ActiveCfg = Debug|Any CPU
{0BE0428D-AC97-4812-ADFC-6D7D00AEE497}.Debug|x86.Build.0 = Debug|Any CPU {B9C4C3E6-60CF-07E3-2FA4-A7036239D037}.Debug|x86.Build.0 = Debug|Any CPU
{0BE0428D-AC97-4812-ADFC-6D7D00AEE497}.Release|Any CPU.ActiveCfg = Release|Any CPU {B9C4C3E6-60CF-07E3-2FA4-A7036239D037}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0BE0428D-AC97-4812-ADFC-6D7D00AEE497}.Release|Any CPU.Build.0 = Release|Any CPU {B9C4C3E6-60CF-07E3-2FA4-A7036239D037}.Release|Any CPU.Build.0 = Release|Any CPU
{0BE0428D-AC97-4812-ADFC-6D7D00AEE497}.Release|x86.ActiveCfg = Release|Any CPU {B9C4C3E6-60CF-07E3-2FA4-A7036239D037}.Release|x86.ActiveCfg = Release|Any CPU
{0BE0428D-AC97-4812-ADFC-6D7D00AEE497}.Release|x86.Build.0 = 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.ActiveCfg = Debug|Any CPU
{1748E038-0A47-04E1-3C5E-FF9566DFFB7C}.Debug|Any CPU.Build.0 = 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 {1748E038-0A47-04E1-3C5E-FF9566DFFB7C}.Debug|x86.ActiveCfg = Debug|Any CPU

View File

@@ -4,8 +4,8 @@
<TargetFrameworks>net8.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>annotations</Nullable>
<Version>2.1.1</Version> <Version>2.2.0</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>