Compare commits

...

7 Commits

Author SHA1 Message Date
David Hall 7cb35c9a78 Updated project info 2023-12-30 17:57:13 -07:00
David Hall 9ee549b347 Removed errant TargetFrameworks 2023-12-30 17:52:31 -07:00
David Hall c1eda2cdcf Fixed net8 cast issue 2023-12-30 17:51:41 -07:00
David Hall d3012da6e6 Updated TargetFrameworks value 2023-12-30 17:51:11 -07:00
David Hall 37e03de0b5 Nullability additions to Vanara.Windows.Forms 2023-12-30 17:50:35 -07:00
David Hall d7564ed99c NET8.0 changes 2023-12-30 16:29:54 -07:00
David Hall 0fb254a3b2 Checkpoint before net80 changes 2023-12-30 15:29:39 -07:00
59 changed files with 274 additions and 265 deletions

View File

@ -189,7 +189,9 @@ public static partial class InteropExtensions
public static bool IsMarshalable(this Type type)
{
Type t = type.IsNullable() ? type.GetGenericArguments()[0] : type;
#pragma warning disable SYSLIB0050 // Type or member is obsolete
return t.IsSerializable || VanaraMarshaler.CanMarshal(t, out _) || t.IsBlittable();
#pragma warning restore SYSLIB0050 // Type or member is obsolete
}
/// <summary>Determines whether this type is nullable (derived from <see cref="Nullable{T}"/>).</summary>
@ -827,6 +829,7 @@ public static partial class InteropExtensions
{
return GetBlittable(Nullable.GetUnderlyingType(destType)!, out bytesRead);
}
#pragma warning disable SYSLIB0050 // Type or member is obsolete
if (destType.IsSerializable)
{
using var mem = new MemoryStream(ptr.ToByteArray((int)allocatedBytes - offset, offset, allocatedBytes)!);
@ -834,6 +837,7 @@ public static partial class InteropExtensions
bytesRead = (int)mem.Position;
return ret;
}
#pragma warning restore SYSLIB0050 // Type or member is obsolete
}
catch (ArgumentOutOfRangeException)
{
@ -1190,6 +1194,7 @@ public static partial class InteropExtensions
}
// Handle binary serialization
#pragma warning disable SYSLIB0050 // Type or member is obsolete
if (valType.IsSerializable)
{
using var str = new NativeMemoryStream();
@ -1201,6 +1206,7 @@ public static partial class InteropExtensions
str.Pointer.CopyTo(ptr.Offset(offset), str.Length);
return (int)str.Length;
}
#pragma warning restore SYSLIB0050 // Type or member is obsolete
throw new ArgumentException("Unable to convert object to its binary format.");

View File

@ -15,13 +15,13 @@
<PackageReleaseNotes>Currently implements:
Classes
AlignedMemory&lt;T&gt;, AllowNullAttribute, BeginEndEventContext, BitHelper, ByteSizeFormatter, ComConnectionPoint, ComEnumString, ComReleaser&lt;T&gt;, ComReleaserFactory, ComStream, ComTypeExtensions, ConstantConversionExtensions, CorrespondingTypeAttribute, CoTaskMemoryMethods, DisallowNullAttribute, DynamicDependencyAttribute, EnumerableEqualityComparer&lt;T&gt;, EnumExtensions, EventedList&lt;T&gt;, FileTimeExtensions, Formatter, FormatterComposer, GenericSafeHandle, GenericVirtualReadOnlyDictionary&lt;T&gt;, HexDempHelpers, HGlobalMemoryMethods, History&lt;T&gt;, IArrayStructExtensions, IArrayStructMarshaler&lt;T&gt;, InteropExtensions, IntPtrConverter, IOExtensions, LibHelper, LinqHelpers, ListChangedEventArgs&lt;T&gt;, MarshalingStream, MaybeNullAttribute, MaybeNullWhenAttribute, MemberNotNullAttribute, MemoryMethodsBase, NativeMemoryEnumerator&lt;T&gt;, NativeMemoryStream, NotNullAttribute, NotNullWhenAttribute, OSPlatformAttribute, PinnedObject, ReflectionExtensions, ReflectionExtensions, RequiresUnreferencedCodeAttribute, SafeAllocatedMemoryHandle, SafeAllocatedMemoryHandleBase, SafeByteArray, SafeCoTaskMemHandle, SafeCoTaskMemString, SafeCoTaskMemStruct&lt;T&gt;, SafeGuidPtr, SafeHGlobalHandle, SafeHGlobalStruct&lt;T&gt;, SafeLPSTR, SafeLPTSTR, SafeLPWSTR, SafeMemoryHandle&lt;T&gt;, SafeMemoryHandleExt&lt;T&gt;, SafeMemoryPool&lt;T&gt;, SafeMemString&lt;T&gt;, SafeMemStruct&lt;T&gt;, SparseArray&lt;T&gt;, StringHelper, SupportedOSPlatformAttribute, TryGetDelegate, TryGetValueDelegate, UntypedNativeMemoryEnumerator, VanaraCustomMarshaler&lt;T&gt;, VanaraMarshaler, VanaraMarshalerAttribute, VirtualDictionary&lt;T&gt;, VirtualList&lt;T&gt;, VirtualListMethodCarrier&lt;T&gt;, VirtualReadOnlyDictionary&lt;T&gt;, VirtualReadOnlyList&lt;T&gt;
AlignedMemory&lt;T&gt;, BeginEndEventContext, BitHelper, ByteSizeFormatter, ComConnectionPoint, ComEnumString, ComReleaser&lt;T&gt;, ComReleaserFactory, ComStream, ComTypeExtensions, ConstantConversionExtensions, CorrespondingTypeAttribute, CoTaskMemoryMethods, EnumerableEqualityComparer&lt;T&gt;, EnumExtensions, EventedList&lt;T&gt;, FileTimeExtensions, Formatter, FormatterComposer, GenericSafeHandle, GenericVirtualReadOnlyDictionary&lt;T&gt;, HexDempHelpers, HGlobalMemoryMethods, History&lt;T&gt;, IArrayStructExtensions, IArrayStructMarshaler&lt;T&gt;, InteropExtensions, IntPtrConverter, IOExtensions, LibHelper, LinqHelpers, ListChangedEventArgs&lt;T&gt;, MarshalingStream, MemoryMethodsBase, NativeMemoryEnumerator&lt;T&gt;, NativeMemoryStream, PinnedObject, ReflectionExtensions, ReflectionExtensions, SafeAllocatedMemoryHandle, SafeAllocatedMemoryHandleBase, SafeByteArray, SafeCoTaskMemHandle, SafeCoTaskMemString, SafeCoTaskMemStruct&lt;T&gt;, SafeGuidPtr, SafeHGlobalHandle, SafeHGlobalStruct&lt;T&gt;, SafeLPSTR, SafeLPTSTR, SafeLPWSTR, SafeMemoryHandle&lt;T&gt;, SafeMemoryHandleExt&lt;T&gt;, SafeMemoryPool&lt;T&gt;, SafeMemString&lt;T&gt;, SafeMemStruct&lt;T&gt;, SparseArray&lt;T&gt;, StringHelper, TryGetDelegate, TryGetValueDelegate, UntypedNativeMemoryEnumerator, VanaraCustomMarshaler&lt;T&gt;, VanaraMarshaler, VanaraMarshalerAttribute, VirtualDictionary&lt;T&gt;, VirtualList&lt;T&gt;, VirtualListMethodCarrier&lt;T&gt;, VirtualReadOnlyDictionary&lt;T&gt;, VirtualReadOnlyList&lt;T&gt;
Structures
BOOL, BOOLEAN, EnumFlagIndexer&lt;T&gt;, GuidPtr, RefEnumerator&lt;T&gt;, SizeT, StrPtrAnsi, StrPtrAuto, StrPtrUni, time_t
Enumerations
CorrespondingAction, DynamicallyAccessedMemberTypes, FileAttributeConstant, FileOpConstant, FilePermissionConstant, StringListPackMethod
CorrespondingAction, FileAttributeConstant, FileOpConstant, FilePermissionConstant, StringListPackMethod
</PackageReleaseNotes>
<PackageReadmeFile>pkgreadme.md</PackageReadmeFile>

View File

@ -23,4 +23,4 @@ If you're still running into problems, file an [issue](https://github.com/dahall
Classes | Structures | Enumerations | Interfaces
--- | --- | --- | ---
AlignedMemory AllowNullAttribute BeginEndEventContext BitHelper ByteSizeFormatter ComConnectionPoint ComEnumString ComReleaser ComReleaserFactory ComStream ComTypeExtensions ConstantConversionExtensions CorrespondingTypeAttribute CoTaskMemoryMethods DisallowNullAttribute DynamicDependencyAttribute EnumerableEqualityComparer EnumExtensions EventedList FileTimeExtensions Formatter FormatterComposer GenericSafeHandle GenericVirtualReadOnlyDictionary HexDempHelpers HGlobalMemoryMethods History IArrayStructExtensions IArrayStructMarshaler InteropExtensions IntPtrConverter IOExtensions LibHelper LinqHelpers ListChangedEventArgs MarshalingStream MaybeNullAttribute MaybeNullWhenAttribute MemberNotNullAttribute MemoryMethodsBase NativeMemoryEnumerator NativeMemoryStream NotNullAttribute NotNullWhenAttribute OSPlatformAttribute PinnedObject ReflectionExtensions ReflectionExtensions RequiresUnreferencedCodeAttribute SafeAllocatedMemoryHandle SafeAllocatedMemoryHandleBase SafeByteArray SafeCoTaskMemHandle SafeCoTaskMemString SafeCoTaskMemStruct SafeGuidPtr SafeHGlobalHandle SafeHGlobalStruct SafeLPSTR SafeLPTSTR SafeLPWSTR SafeMemoryHandle SafeMemoryHandleExt SafeMemoryPool SafeMemString SafeMemStruct SparseArray StringHelper SupportedOSPlatformAttribute TryGetDelegate TryGetValueDelegate UntypedNativeMemoryEnumerator VanaraCustomMarshaler VanaraMarshaler VanaraMarshalerAttribute VirtualDictionary VirtualList VirtualListMethodCarrier VirtualReadOnlyDictionary VirtualReadOnlyList | BOOL BOOLEAN EnumFlagIndexer GuidPtr RefEnumerator SizeT StrPtrAnsi StrPtrAuto StrPtrUni time_t | CorrespondingAction DynamicallyAccessedMemberTypes FileAttributeConstant FileOpConstant FilePermissionConstant StringListPackMethod | IArrayStruct IHandle IHistory IMemoryMethods ISafeMemoryHandle ISimpleMemoryMethods ISupportIndexer IVanaraMarshaler IVirtualListMethods IVirtualReadOnlyListMethods
AlignedMemory BeginEndEventContext BitHelper ByteSizeFormatter ComConnectionPoint ComEnumString ComReleaser ComReleaserFactory ComStream ComTypeExtensions ConstantConversionExtensions CorrespondingTypeAttribute CoTaskMemoryMethods EnumerableEqualityComparer EnumExtensions EventedList FileTimeExtensions Formatter FormatterComposer GenericSafeHandle GenericVirtualReadOnlyDictionary HexDempHelpers HGlobalMemoryMethods History IArrayStructExtensions IArrayStructMarshaler InteropExtensions IntPtrConverter IOExtensions LibHelper LinqHelpers ListChangedEventArgs MarshalingStream MemoryMethodsBase NativeMemoryEnumerator NativeMemoryStream PinnedObject ReflectionExtensions ReflectionExtensions SafeAllocatedMemoryHandle SafeAllocatedMemoryHandleBase SafeByteArray SafeCoTaskMemHandle SafeCoTaskMemString SafeCoTaskMemStruct SafeGuidPtr SafeHGlobalHandle SafeHGlobalStruct SafeLPSTR SafeLPTSTR SafeLPWSTR SafeMemoryHandle SafeMemoryHandleExt SafeMemoryPool SafeMemString SafeMemStruct SparseArray StringHelper TryGetDelegate TryGetValueDelegate UntypedNativeMemoryEnumerator VanaraCustomMarshaler VanaraMarshaler VanaraMarshalerAttribute VirtualDictionary VirtualList VirtualListMethodCarrier VirtualReadOnlyDictionary VirtualReadOnlyList | BOOL BOOLEAN EnumFlagIndexer GuidPtr RefEnumerator SizeT StrPtrAnsi StrPtrAuto StrPtrUni time_t | CorrespondingAction FileAttributeConstant FileOpConstant FilePermissionConstant StringListPackMethod | IArrayStruct IHandle IHistory IMemoryMethods ISafeMemoryHandle ISimpleMemoryMethods ISupportIndexer IVanaraMarshaler IVirtualListMethods IVirtualReadOnlyListMethods

View File

@ -9,7 +9,6 @@ This library includes shared methods, structures and constants for use throughou
Enum | Description | Values
---- | ---- | ----
[Vanara.InteropServices.CorrespondingAction](https://github.com/dahall/Vanara/search?l=C%23&q=CorrespondingAction) | Actions that can be taken with a corresponding type. | None, Get, Set, GetSet, Exception
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes](https://github.com/dahall/Vanara/search?l=C%23&q=DynamicallyAccessedMemberTypes) | Specifies the types of members that are dynamically accessed. This enumeration has a System.FlagsAttribute attribute that allows a bitwise combination of its member values. | None, PublicParameterlessConstructor, PublicConstructors, NonPublicConstructors, PublicMethods, NonPublicMethods, PublicFields, NonPublicFields, PublicNestedTypes, NonPublicNestedTypes, PublicProperties, NonPublicProperties, PublicEvents, NonPublicEvents, Interfaces, All
[Vanara.RunTimeLib.FileAttributeConstant](https://github.com/dahall/Vanara/search?l=C%23&q=FileAttributeConstant) | These constants specify the current attributes of the file or directory specified by the function. | _A_NORMAL, _A_RDONLY, _A_HIDDEN, _A_SYSTEM, _A_SUBDIR, _A_ARCH
[Vanara.RunTimeLib.FileOpConstant](https://github.com/dahall/Vanara/search?l=C%23&q=FileOpConstant) | The integer expression formed from one or more of these constants determines the type of reading or writing operations permitted. It is formed by combining one or more constants with a translation-mode constant. | _O_RDONLY, _O_WRONLY, _O_RDWR, _O_APPEND, _O_RANDOM, _O_SEQUENTIAL, _O_TEMPORARY, _O_NOINHERIT, _O_CREAT, _O_TRUNC, _O_EXCL, _O_SHORT_LIVED, _O_OBTAIN_DIR, _O_TEXT, _O_RAW, _O_BINARY, _O_WTEXT, _O_U16TEXT, _O_U8TEXT
[Vanara.RunTimeLib.FilePermissionConstant](https://github.com/dahall/Vanara/search?l=C%23&q=FilePermissionConstant) | These constants are used to indicate file type in the st_mode field of the _stat structure. | _S_IEXEC, _S_IWRITE, _S_IREAD, _S_IFIFO, _S_IFCHR, _S_IFDIR, _S_IFREG, _S_IFMT
@ -44,7 +43,6 @@ Interface | Description
Class | Description
---- | ----
[Vanara.InteropServices.AlignedMemory<T>](https://github.com/dahall/Vanara/search?l=C%23&q=AlignedMemory<T>) | A memory block aligned on a specific byte boundary.
[System.Diagnostics.CodeAnalysis.AllowNullAttribute](https://github.com/dahall/Vanara/search?l=C%23&q=AllowNullAttribute) | Specifies that null is allowed as an input even if the corresponding type disallows it.
[Vanara.PInvoke.BeginEndEventContext](https://github.com/dahall/Vanara/search?l=C%23&q=BeginEndEventContext) | A disposable context for which a delegate is called at entry and exit.
[Vanara.Extensions.BitHelper](https://github.com/dahall/Vanara/search?l=C%23&q=BitHelper) | Static methods to help with bit manipulation.
[Vanara.ByteSizeFormatter](https://github.com/dahall/Vanara/search?l=C%23&q=ByteSizeFormatter) | A custom formatter for byte sizes (things like files, network bandwidth, etc.) that will automatically determine the best abbreviation.
@ -57,8 +55,6 @@ Class | Description
[Vanara.RunTimeLib.ConstantConversionExtensions](https://github.com/dahall/Vanara/search?l=C%23&q=ConstantConversionExtensions) | Extension methods for CRT enumerations to convert to .NET enumerations.
[Vanara.InteropServices.CorrespondingTypeAttribute](https://github.com/dahall/Vanara/search?l=C%23&q=CorrespondingTypeAttribute) | Attribute for enum values that provides information about corresponding types and related actions. Useful for Get/Set methods that use an enumeration value to determine the type to get or set.
[Vanara.InteropServices.CoTaskMemoryMethods](https://github.com/dahall/Vanara/search?l=C%23&q=CoTaskMemoryMethods) | Unmanaged memory methods for COM.
[System.Diagnostics.CodeAnalysis.DisallowNullAttribute](https://github.com/dahall/Vanara/search?l=C%23&q=DisallowNullAttribute) | Specifies that null is disallowed as an input even if the corresponding type allows it.
[System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute](https://github.com/dahall/Vanara/search?l=C%23&q=DynamicDependencyAttribute) | States a dependency that one member has on another.
[Vanara.Collections.EnumerableEqualityComparer<T>](https://github.com/dahall/Vanara/search?l=C%23&q=EnumerableEqualityComparer<T>) | Checks the linear equality of two enumerated lists. For lists to be equal, they must have the same number of elements and each index must hold the same value in each list.
[Vanara.Extensions.EnumExtensions](https://github.com/dahall/Vanara/search?l=C%23&q=EnumExtensions) | Extensions for enumerated types.
[Vanara.Collections.EventedList<T>](https://github.com/dahall/Vanara/search?l=C%23&q=EventedList<T>) | A generic list that provides event for changes to the list. This is an alternative to ObservableCollection that provides distinct events for each action (add, insert, remove, changed).
@ -79,19 +75,12 @@ Class | Description
[Vanara.LinqHelpers](https://github.com/dahall/Vanara/search?l=C%23&q=LinqHelpers) | Helper methods for LINQ
[Vanara.Collections.EventedList<T>.ListChangedEventArgs<T>](https://github.com/dahall/Vanara/search?l=C%23&q=ListChangedEventArgs<T>) | An `System.EventArgs` structure passed to events generated by an `Vanara.Collections.EventedList`1`.
[Vanara.InteropServices.MarshalingStream](https://github.com/dahall/Vanara/search?l=C%23&q=MarshalingStream) | A `System.IO.Stream` derivative for working with unmanaged memory.
[System.Diagnostics.CodeAnalysis.MaybeNullAttribute](https://github.com/dahall/Vanara/search?l=C%23&q=MaybeNullAttribute) | Specifies that an output may be <see langword="null" /> even if the corresponding type disallows it.
[System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute](https://github.com/dahall/Vanara/search?l=C%23&q=MaybeNullWhenAttribute) | Specifies that when a method returns ReturnValue, the parameter may be null even if the corresponding type disallows it.
[System.Diagnostics.CodeAnalysis.MemberNotNullAttribute](https://github.com/dahall/Vanara/search?l=C%23&q=MemberNotNullAttribute) | Specifies that the method or property will ensure that the listed field and property members have values that aren't <see langword="null" />.
[Vanara.InteropServices.MemoryMethodsBase](https://github.com/dahall/Vanara/search?l=C%23&q=MemoryMethodsBase) | Implementation of `Vanara.InteropServices.IMemoryMethods` using just the methods from `Vanara.InteropServices.ISimpleMemoryMethods`.
[Vanara.PInvoke.Collections.NativeMemoryEnumerator<T>](https://github.com/dahall/Vanara/search?l=C%23&q=NativeMemoryEnumerator<T>) | Provides a generic enumerator over native memory.
[Vanara.InteropServices.NativeMemoryStream](https://github.com/dahall/Vanara/search?l=C%23&q=NativeMemoryStream) | A `System.IO.Stream` derivative for working with unmanaged memory.
[System.Diagnostics.CodeAnalysis.NotNullAttribute](https://github.com/dahall/Vanara/search?l=C%23&q=NotNullAttribute) | Specifies that an output may be null even if the corresponding type disallows it. Specifies that an input argument was not null when the call returns.
[System.Diagnostics.CodeAnalysis.NotNullWhenAttribute](https://github.com/dahall/Vanara/search?l=C%23&q=NotNullWhenAttribute) | Specifies that when a method returns ReturnValue, the parameter will not be null even if the corresponding type allows it.
[System.Runtime.Versioning.OSPlatformAttribute](https://github.com/dahall/Vanara/search?l=C%23&q=OSPlatformAttribute) | Some information relates to prerelease product that may be substantially modified before its released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
[Vanara.InteropServices.PinnedObject](https://github.com/dahall/Vanara/search?l=C%23&q=PinnedObject) | A safe class that represents an object that is pinned in memory.
[Vanara.Extensions.ReflectionExtensions](https://github.com/dahall/Vanara/search?l=C%23&q=ReflectionExtensions) | Extensions related to <c>System.Reflection</c>
[Vanara.Extensions.Reflection.ReflectionExtensions](https://github.com/dahall/Vanara/search?l=C%23&q=ReflectionExtensions) | Extensions for `System.Object` related to <c>System.Reflection</c>
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute](https://github.com/dahall/Vanara/search?l=C%23&q=RequiresUnreferencedCodeAttribute) | Indicates that the specified method requires dynamic access to code that is not referenced statically, for example, through `System.Reflection`.
[Vanara.InteropServices.SafeAllocatedMemoryHandle](https://github.com/dahall/Vanara/search?l=C%23&q=SafeAllocatedMemoryHandle) | Abstract base class for all SafeHandle derivatives that encapsulate handling unmanaged memory.
[Vanara.InteropServices.SafeAllocatedMemoryHandleBase](https://github.com/dahall/Vanara/search?l=C%23&q=SafeAllocatedMemoryHandleBase) | Abstract base class for all SafeHandle derivatives that encapsulate handling unmanaged memory. This class assumes read-only memory.
[Vanara.InteropServices.SafeByteArray](https://github.com/dahall/Vanara/search?l=C%23&q=SafeByteArray) | An safe unmanaged array of bytes allocated on the global heap.
@ -111,7 +100,6 @@ Class | Description
[Vanara.InteropServices.SafeMemStruct<T>](https://github.com/dahall/Vanara/search?l=C%23&q=SafeMemStruct<T>) | Base abstract class for a structure handler based on `Vanara.InteropServices.SafeMemoryHandle`1`.
[Vanara.Collections.SparseArray<T>](https://github.com/dahall/Vanara/search?l=C%23&q=SparseArray<T>) | A sparse array based on a dictionary.
[Vanara.Extensions.StringHelper](https://github.com/dahall/Vanara/search?l=C%23&q=StringHelper) | A safe class that represents an object that is pinned in memory.
[System.Runtime.Versioning.SupportedOSPlatformAttribute](https://github.com/dahall/Vanara/search?l=C%23&q=SupportedOSPlatformAttribute) | Some information relates to prerelease product that may be substantially modified before its released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
[Vanara.Collections.VirtualReadOnlyList<T>.TryGetDelegate](https://github.com/dahall/Vanara/search?l=C%23&q=TryGetDelegate) | Delegate for a method that tries to get the element at the specified index.
[Vanara.Collections.GenericVirtualReadOnlyDictionary<T>.TryGetValueDelegate](https://github.com/dahall/Vanara/search?l=C%23&q=TryGetValueDelegate) | Delegate for the implementation of the `Vanara.Collections.GenericVirtualReadOnlyDictionary`2.TryGetValue(`0,`1@)` method.
[Vanara.PInvoke.Collections.UntypedNativeMemoryEnumerator](https://github.com/dahall/Vanara/search?l=C%23&q=UntypedNativeMemoryEnumerator) | Provides an enumerator over native memory.

View File

@ -1,6 +1,7 @@
<Project>
<PropertyGroup>
<TargetFrameworks>net45;net48;net6.0;net7.0;netstandard2.0;netcoreapp3.1</TargetFrameworks>
<Version>4.0.0-beta2</Version>
<TargetFrameworks>net45;net48;net6.0;net7.0;net8.0-windows;netstandard2.0;netcoreapp3.1</TargetFrameworks>
<Configurations>Debug;Release</Configurations>
<Platforms>AnyCPU;x64;x86</Platforms>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@ -20,9 +21,9 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<Import Project="Package.targets" />
<Import Condition="('$(MSBuildProjectExtension)'=='.csproj' Or '$(MSBuildProjectExtension)'=='.vbproj') And !$(MSBuildProjectDirectory.Contains('UnitTests'))" Project="$(MSBuildThisFileDirectory)SourceLink.targets"/>
<Import Condition="('$(MSBuildProjectExtension)'=='.csproj' Or '$(MSBuildProjectExtension)'=='.vbproj') And !$(MSBuildProjectDirectory.Contains('UnitTests'))" Project="$(MSBuildThisFileDirectory)SourceLink.targets" />
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)docs\icons\Vanara64x64.png" Pack="true" PackagePath="\" />
<Compile Include="$(MSBuildThisFileDirectory)AsmDef.cs" Link="AsmDef.cs" Condition="'$(MSBuildProjectExtension)'=='.csproj'"/>
<Compile Include="$(MSBuildThisFileDirectory)AsmDef.cs" Link="AsmDef.cs" Condition="'$(MSBuildProjectExtension)'=='.csproj'" />
</ItemGroup>
</Project>

View File

@ -24,7 +24,7 @@ AccessibleChildren AccessibleObjectFromEvent AccessibleObjectFromPoint Accessibl
<ItemGroup Condition=" $(TargetFramework.StartsWith('net4')) ">
<Reference Include="Accessibility" />
</ItemGroup>
<PropertyGroup Condition=" $(TargetFramework.StartsWith('netcoreapp3')) ">
<PropertyGroup Condition=" $(TargetFramework.StartsWith('netcoreapp3')) Or $(TargetFramework.StartsWith('net8')) ">
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>

View File

@ -4,7 +4,7 @@
<SupportedDlls>FirewallApi.dll</SupportedDlls>
</ProjectExtensions>
<PropertyGroup>
<TargetFrameworks>net45;net48;net6.0-windows;net7.0-windows;netstandard2.0;netcoreapp3.1</TargetFrameworks>
<!--<TargetFrameworks>net45;net48;net6.0-windows;net7.0-windows;netstandard2.0;netcoreapp3.1</TargetFrameworks>-->
<Description>PInvoke API (methods, structures and constants) imported from FirewallApi.dll for Windows Firewall with Advanced Security.</Description>
<AssemblyName>Vanara.PInvoke.FirewallApi</AssemblyName>
<AssemblyTitle>$(AssemblyName)</AssemblyTitle>

View File

@ -3150,7 +3150,9 @@ public static partial class Mpr
/// <param name="context">
/// The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.
/// </param>
#pragma warning disable SYSLIB0051 // Type or member is obsolete
protected NetworkProviderException(SerializationInfo info, StreamingContext context) : base(info, context)
#pragma warning restore SYSLIB0051 // Type or member is obsolete
{
Description = info.GetString("Description") ?? string.Empty;
Provider = info.GetString("Provider") ?? string.Empty;
@ -3190,6 +3192,9 @@ public static partial class Mpr
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter" />
/// </PermissionSet>
#if NET8_0_OR_GREATER
[Obsolete]
#endif
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info is null) throw new ArgumentNullException(nameof(info));

View File

@ -54,7 +54,7 @@ Native Method | Header | Managed Method
[PeerEnumIdentities](https://www.google.com/search?num=5&q=PeerEnumIdentities+site%3Alearn.microsoft.com) | p2p.h | [Vanara.PInvoke.P2P.PeerEnumIdentities](https://github.com/dahall/Vanara/search?l=C%23&q=PeerEnumIdentities)
[PeerFreeData](https://www.google.com/search?num=5&q=PeerFreeData+site%3Alearn.microsoft.com) | p2p.h | [Vanara.PInvoke.P2P.PeerFreeData](https://github.com/dahall/Vanara/search?l=C%23&q=PeerFreeData)
[PeerGetItemCount](https://www.google.com/search?num=5&q=PeerGetItemCount+site%3Alearn.microsoft.com) | p2p.h | [Vanara.PInvoke.P2P.PeerGetItemCount](https://github.com/dahall/Vanara/search?l=C%23&q=PeerGetItemCount)
[PeerGetNextItem](https://www.google.com/search?num=5&q=PeerGetNextItem+site%3Alearn.microsoft.com) | | [Vanara.PInvoke.P2P.PeerGetNextItem](https://github.com/dahall/Vanara/search?l=C%23&q=PeerGetNextItem)
[PeerGetNextItem](https://www.google.com/search?num=5&q=PeerGetNextItem+site%3Alearn.microsoft.com) | p2p.h | [Vanara.PInvoke.P2P.PeerGetNextItem](https://github.com/dahall/Vanara/search?l=C%23&q=PeerGetNextItem)
[PeerGraphShutdown](https://www.google.com/search?num=5&q=PeerGraphShutdown+site%3Alearn.microsoft.com) | p2p.h | [Vanara.PInvoke.P2P.PeerGraphShutdown](https://github.com/dahall/Vanara/search?l=C%23&q=PeerGraphShutdown)
[PeerGraphStartup](https://www.google.com/search?num=5&q=PeerGraphStartup+site%3Alearn.microsoft.com) | p2p.h | [Vanara.PInvoke.P2P.PeerGraphStartup](https://github.com/dahall/Vanara/search?l=C%23&q=PeerGraphStartup)
[PeerGroupAddRecord](https://www.google.com/search?num=5&q=PeerGroupAddRecord+site%3Alearn.microsoft.com) | p2p.h | [Vanara.PInvoke.P2P.PeerGroupAddRecord](https://github.com/dahall/Vanara/search?l=C%23&q=PeerGroupAddRecord)

View File

@ -3925,7 +3925,7 @@ public static partial class AdvApi32
public uint GroupCount;
/// <summary>Specifies an array of SID_AND_ATTRIBUTES structures that contain a set of SIDs and corresponding attributes.</summary>
[MarshalAs(UnmanagedType.ByValArray)]
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
public SID_AND_ATTRIBUTES[] Groups;
/// <summary>Initializes a new instance of the <see cref="TOKEN_GROUPS"/> struct.</summary>
@ -4141,7 +4141,7 @@ public static partial class AdvApi32
/// </item>
/// </list>
/// </summary>
[MarshalAs(UnmanagedType.ByValArray)]
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
public LUID_AND_ATTRIBUTES[] Privileges;
/// <summary>Initializes a new instance of the <see cref="TOKEN_PRIVILEGES"/> structure with a single LUID_AND_ATTRIBUTES value.</summary>

View File

@ -234,7 +234,7 @@ Native Method | Native DLL | Header | Managed Method
[GetComputerObjectName](https://www.google.com/search?num=5&q=GetComputerObjectNameA+site%3Alearn.microsoft.com) | secur32.dll | secext.h | [Vanara.PInvoke.Secur32.GetComputerObjectName](https://github.com/dahall/Vanara/search?l=C%23&q=GetComputerObjectName)
[GetCurrentHwProfile](https://www.google.com/search?num=5&q=GetCurrentHwProfileA+site%3Alearn.microsoft.com) | advapi32.dll | winbase.h | [Vanara.PInvoke.AdvApi32.GetCurrentHwProfile](https://github.com/dahall/Vanara/search?l=C%23&q=GetCurrentHwProfile)
[GetEffectiveRightsFromAcl](https://www.google.com/search?num=5&q=GetEffectiveRightsFromAclA+site%3Alearn.microsoft.com) | advapi32.dll | Aclapi.h | [Vanara.PInvoke.AdvApi32.GetEffectiveRightsFromAcl](https://github.com/dahall/Vanara/search?l=C%23&q=GetEffectiveRightsFromAcl)
[GetEventLogInformation](https://www.google.com/search?num=5&q=GetEventLogInformation+site%3Alearn.microsoft.com) | advapi32.dll | | [Vanara.PInvoke.AdvApi32.GetEventLogInformation](https://github.com/dahall/Vanara/search?l=C%23&q=GetEventLogInformation)
[GetEventLogInformation](https://www.google.com/search?num=5&q=GetEventLogInformation+site%3Alearn.microsoft.com) | advapi32.dll | winbase.h | [Vanara.PInvoke.AdvApi32.GetEventLogInformation](https://github.com/dahall/Vanara/search?l=C%23&q=GetEventLogInformation)
[GetExplicitEntriesFromAcl](https://www.google.com/search?num=5&q=GetExplicitEntriesFromAclA+site%3Alearn.microsoft.com) | advapi32.dll | aclapi.h | [Vanara.PInvoke.AdvApi32.GetExplicitEntriesFromAcl](https://github.com/dahall/Vanara/search?l=C%23&q=GetExplicitEntriesFromAcl)
[GetFileSecurity](https://www.google.com/search?num=5&q=GetFileSecurityA+site%3Alearn.microsoft.com) | advapi32.dll | winbase.h | [Vanara.PInvoke.AdvApi32.GetFileSecurity](https://github.com/dahall/Vanara/search?l=C%23&q=GetFileSecurity)
[GetInheritanceSource](https://www.google.com/search?num=5&q=GetInheritanceSourceA+site%3Alearn.microsoft.com) | advapi32.dll | Aclapi.h | [Vanara.PInvoke.AdvApi32.GetInheritanceSource](https://github.com/dahall/Vanara/search?l=C%23&q=GetInheritanceSource)

View File

@ -16,7 +16,7 @@
<PackageReleaseNotes>Currently implements:
Classes
AnySizeStringMarshaler&lt;T&gt;, AssociateAttribute, AssociateStringAttribute, ClipCorrespondingTypeAttribute, ComTryGetNext, CoTaskMemStringMarshaler, FunctionHelper, GenericStringMarshaler&lt;T&gt;, GenericStringMarshalerBase&lt;T&gt;, IEnumeratorFromNext&lt;T&gt;, IEnumFromCom&lt;T&gt;, IEnumFromIndexer&lt;T&gt;, IEnumFromNext&lt;T&gt;, IndirectResource, IndirectString, Lib, LOGPALETTE, Macros, NullTermStringArrayMarshaler, OverlappedAsync, OverlappedAsyncResult, PFILETIME, PInvokeClientExtensions, PInvokeDataAttribute, PRECT, PSYSTEMTIME, PtrFunc&lt;T&gt;, RegistryTypeExt, SafeAnysizeStruct&lt;T&gt;, SafeAnysizeStructBase&lt;T&gt;, SafeAnysizeStructMarshaler&lt;T&gt;, SafeElementArray&lt;T&gt;, SafeHANDLE, SafeNativeArray&lt;T&gt;, SafeNativeArrayBase&lt;T&gt;, SafeNativeLinkedList&lt;T&gt;, SafeNativeListBase&lt;T&gt;, SafeResourceId, SBFunc&lt;T&gt;, SBFunc&lt;T&gt;, SBFunc&lt;T&gt;, SECURITY_ATTRIBUTES, SizeFunc&lt;T&gt;, StaticFieldValueHash, StringPtrArrayMarshaler, StructHelper, TryGetNext&lt;T&gt;, TryGetNext&lt;T&gt;
AnySizeStringMarshaler&lt;T&gt;, AssociateAttribute, AssociateStringAttribute, ClipCorrespondingTypeAttribute, ComTryGetNext, CoTaskMemStringMarshaler, EnumeratorToEnumVariantMarshaler, FunctionHelper, GenericStringMarshaler&lt;T&gt;, GenericStringMarshalerBase&lt;T&gt;, IEnumeratorFromNext&lt;T&gt;, IEnumFromCom&lt;T&gt;, IEnumFromIndexer&lt;T&gt;, IEnumFromNext&lt;T&gt;, IndirectResource, IndirectString, Lib, LOGPALETTE, Macros, NullTermStringArrayMarshaler, OverlappedAsync, OverlappedAsyncResult, PFILETIME, PInvokeClientExtensions, PInvokeDataAttribute, PRECT, PSYSTEMTIME, PtrFunc&lt;T&gt;, RegistryTypeExt, SafeAnysizeStruct&lt;T&gt;, SafeAnysizeStructBase&lt;T&gt;, SafeAnysizeStructMarshaler&lt;T&gt;, SafeElementArray&lt;T&gt;, SafeHANDLE, SafeNativeArray&lt;T&gt;, SafeNativeArrayBase&lt;T&gt;, SafeNativeLinkedList&lt;T&gt;, SafeNativeListBase&lt;T&gt;, SafeResourceId, SBFunc&lt;T&gt;, SBFunc&lt;T&gt;, SBFunc&lt;T&gt;, SECURITY_ATTRIBUTES, SizeFunc&lt;T&gt;, StaticFieldValueHash, StringPtrArrayMarshaler, StructHelper, TryGetNext&lt;T&gt;, TryGetNext&lt;T&gt;
Structures
ACCESS_MASK, BusNumber, CLIPFORMAT, CM_FULL_RESOURCE_DESCRIPTOR, CM_PARTIAL_RESOURCE_DESCRIPTOR, CM_PARTIAL_RESOURCE_LIST, CM_POWER_DATA, CM_RESOURCE_LIST, COLORREF, Connection, CORRELATION_VECTOR, CY, DATE, DECIMAL, DEVICE_CAPABILITIES, DevicePrivate, DeviceSpecificData, DEVMODE, Dma, DmaV3, Generic, HACCEL, HANDLE, HBITMAP, HBRUSH, HCOLORSPACE, HCURSOR, HDC, HDESK, HDPA, HDROP, HDSA, HDWP, HENHMETAFILE, HEVENT, HFILE, HFONT, HGDIOBJ, HICON, HIMAGELIST, HINSTANCE, HKEY, HMENU, HMETAFILE, HMONITOR, HPALETTE, HPEN, HPROCESS, HPROPSHEET, HPROPSHEETPAGE, HRESULT, HRGN, HSECTION, HTASK, HTHEME, HTHREAD, HTHUMBNAIL, HTOKEN, HWINSTA, HWND, Interrupt, LANGID, LCID, LOGFONT, LOGPALETTE, Memory40, Memory48, Memory64, MessageInterruptRaw, MSG, NTStatus, OBJECT_TYPE_LIST, OFSTRUCT, PACE, PACL, PALETTEENTRY, PFILETIME, POINT, POINTS, PRECT, PSECURITY_DESCRIPTOR, PSID, PSYSTEMTIME, RECT, ResourceId, ResourceIdOrHandle&lt;T&gt;, RGBQUAD, SECURITY_ATTRIBUTES, SIZE, SYSTEMTIME, tagSECURITY_ATTRIBUTES, TEXTMETRIC, Union, WIN32_FIND_DATA, Win32Error

View File

@ -25,4 +25,4 @@ If you're still running into problems, file an [issue](https://github.com/dahall
Classes | Structures | Enumerations | Interfaces
--- | --- | --- | ---
AnySizeStringMarshaler AssociateAttribute AssociateStringAttribute ClipCorrespondingTypeAttribute ComTryGetNext CoTaskMemStringMarshaler FunctionHelper GenericStringMarshaler GenericStringMarshalerBase IEnumeratorFromNext IEnumFromCom IEnumFromIndexer IEnumFromNext IndirectResource IndirectString Lib LOGPALETTE Macros NullTermStringArrayMarshaler OverlappedAsync OverlappedAsyncResult PFILETIME PInvokeClientExtensions PInvokeDataAttribute PRECT PSYSTEMTIME PtrFunc RegistryTypeExt SafeAnysizeStruct SafeAnysizeStructBase SafeAnysizeStructMarshaler SafeElementArray SafeHANDLE SafeNativeArray SafeNativeArrayBase SafeNativeLinkedList SafeNativeListBase SafeResourceId SBFunc SBFunc SBFunc SECURITY_ATTRIBUTES SizeFunc StaticFieldValueHash StringPtrArrayMarshaler StructHelper TryGetNext TryGetNext | ACCESS_MASK BusNumber CLIPFORMAT CM_FULL_RESOURCE_DESCRIPTOR CM_PARTIAL_RESOURCE_DESCRIPTOR CM_PARTIAL_RESOURCE_LIST CM_POWER_DATA CM_RESOURCE_LIST COLORREF Connection CORRELATION_VECTOR CY DATE DECIMAL DEVICE_CAPABILITIES DevicePrivate DeviceSpecificData DEVMODE Dma DmaV3 Generic HACCEL HANDLE HBITMAP HBRUSH HCOLORSPACE HCURSOR HDC HDESK HDPA HDROP HDSA HDWP HENHMETAFILE HEVENT HFILE HFONT HGDIOBJ HICON HIMAGELIST HINSTANCE HKEY HMENU HMETAFILE HMONITOR HPALETTE HPEN HPROCESS HPROPSHEET HPROPSHEETPAGE HRESULT HRGN HSECTION HTASK HTHEME HTHREAD HTHUMBNAIL HTOKEN HWINSTA HWND Interrupt LANGID LCID LOGFONT LOGPALETTE Memory40 Memory48 Memory64 MessageInterruptRaw MSG NTStatus OBJECT_TYPE_LIST OFSTRUCT PACE PACL PALETTEENTRY PFILETIME POINT POINTS PRECT PSECURITY_DESCRIPTOR PSID PSYSTEMTIME RECT ResourceId ResourceIdOrHandle RGBQUAD SECURITY_ATTRIBUTES SIZE SYSTEMTIME tagSECURITY_ATTRIBUTES TEXTMETRIC Union WIN32_FIND_DATA Win32Error | CharacterSet CM_DEVCAP CM_FILE CM_INSTALL_STATE CM_REMOVAL_POLICY CM_RESOURCE CM_SHARE_DISPOSITION CmResourceType CONFIGFLAG DEVICE_POWER_STATE DEVICE_SCALE_FACTOR DMCOLLATE DMCOLOR DMDFO DMDISPLAY DMDITHER DMDO DMDUP DMFIELDS DMICM DMICMMETHOD DMMEDIA DMNUP DMORIENT DMPAPER DMRES DMTT DN DrawTextFlags FacilityCode FacilityCode FILE_DEVICE FILE_SHARE FileFlagsAndAttributes FontFamily FontPitch INTERFACE_TYPE LANG LogFontClippingPrecision LogFontOutputPrecision LogFontOutputQuality MouseButtonState NTDDI ObjectTypeListLevel PC PDCAP PInvokeClient ProcessorArchitecture REG_VALUE_TYPE ResourceType SECURITY_INFORMATION SeverityLevel SeverityLevel ShowWindowCommand SORT STGM SUBLANG SYSTEM_POWER_STATE SystemColorIndex SystemShutDownReason URLZONE WIN32_WINNT | IClipboardFormatter ICOMEnum IErrorProvider IGraphicsObjectHandle IKernelHandle ISecurityObject IShellHandle ISyncHandle IUserHandle
AnySizeStringMarshaler AssociateAttribute AssociateStringAttribute ClipCorrespondingTypeAttribute ComTryGetNext CoTaskMemStringMarshaler EnumeratorToEnumVariantMarshaler FunctionHelper GenericStringMarshaler GenericStringMarshalerBase IEnumeratorFromNext IEnumFromCom IEnumFromIndexer IEnumFromNext IndirectResource IndirectString Lib LOGPALETTE Macros NullTermStringArrayMarshaler OverlappedAsync OverlappedAsyncResult PFILETIME PInvokeClientExtensions PInvokeDataAttribute PRECT PSYSTEMTIME PtrFunc RegistryTypeExt SafeAnysizeStruct SafeAnysizeStructBase SafeAnysizeStructMarshaler SafeElementArray SafeHANDLE SafeNativeArray SafeNativeArrayBase SafeNativeLinkedList SafeNativeListBase SafeResourceId SBFunc SBFunc SBFunc SECURITY_ATTRIBUTES SizeFunc StaticFieldValueHash StringPtrArrayMarshaler StructHelper TryGetNext TryGetNext | ACCESS_MASK BusNumber CLIPFORMAT CM_FULL_RESOURCE_DESCRIPTOR CM_PARTIAL_RESOURCE_DESCRIPTOR CM_PARTIAL_RESOURCE_LIST CM_POWER_DATA CM_RESOURCE_LIST COLORREF Connection CORRELATION_VECTOR CY DATE DECIMAL DEVICE_CAPABILITIES DevicePrivate DeviceSpecificData DEVMODE Dma DmaV3 Generic HACCEL HANDLE HBITMAP HBRUSH HCOLORSPACE HCURSOR HDC HDESK HDPA HDROP HDSA HDWP HENHMETAFILE HEVENT HFILE HFONT HGDIOBJ HICON HIMAGELIST HINSTANCE HKEY HMENU HMETAFILE HMONITOR HPALETTE HPEN HPROCESS HPROPSHEET HPROPSHEETPAGE HRESULT HRGN HSECTION HTASK HTHEME HTHREAD HTHUMBNAIL HTOKEN HWINSTA HWND Interrupt LANGID LCID LOGFONT LOGPALETTE Memory40 Memory48 Memory64 MessageInterruptRaw MSG NTStatus OBJECT_TYPE_LIST OFSTRUCT PACE PACL PALETTEENTRY PFILETIME POINT POINTS PRECT PSECURITY_DESCRIPTOR PSID PSYSTEMTIME RECT ResourceId ResourceIdOrHandle RGBQUAD SECURITY_ATTRIBUTES SIZE SYSTEMTIME tagSECURITY_ATTRIBUTES TEXTMETRIC Union WIN32_FIND_DATA Win32Error | CharacterSet CM_DEVCAP CM_FILE CM_INSTALL_STATE CM_REMOVAL_POLICY CM_RESOURCE CM_SHARE_DISPOSITION CmResourceType CONFIGFLAG DEVICE_POWER_STATE DEVICE_SCALE_FACTOR DMCOLLATE DMCOLOR DMDFO DMDISPLAY DMDITHER DMDO DMDUP DMFIELDS DMICM DMICMMETHOD DMMEDIA DMNUP DMORIENT DMPAPER DMRES DMTT DN DrawTextFlags FacilityCode FacilityCode FILE_DEVICE FILE_SHARE FileFlagsAndAttributes FontFamily FontPitch INTERFACE_TYPE LANG LogFontClippingPrecision LogFontOutputPrecision LogFontOutputQuality MouseButtonState NTDDI ObjectTypeListLevel PC PDCAP PInvokeClient ProcessorArchitecture REG_VALUE_TYPE ResourceType SECURITY_INFORMATION SeverityLevel SeverityLevel ShowWindowCommand SORT STGM SUBLANG SYSTEM_POWER_STATE SystemColorIndex SystemShutDownReason URLZONE WIN32_WINNT | IClipboardFormatter ICOMEnum IErrorProvider IGraphicsObjectHandle IKernelHandle ISecurityObject IShellHandle ISyncHandle IUserHandle

View File

@ -191,6 +191,7 @@ Class | Description
[Vanara.PInvoke.ClipCorrespondingTypeAttribute](https://github.com/dahall/Vanara/search?l=C%23&q=ClipCorrespondingTypeAttribute) | Indicates the type, medium and method for getting and setting the payload associated with known clipboard formats.
[Vanara.Collections.IEnumFromCom<T>.ComTryGetNext](https://github.com/dahall/Vanara/search?l=C%23&q=ComTryGetNext) | Delegate that gets the next value in an enumeration and returns true or returns false to indicate there are no more items in the enumeration.
[Vanara.InteropServices.CoTaskMemStringMarshaler](https://github.com/dahall/Vanara/search?l=C%23&q=CoTaskMemStringMarshaler) | Marshals strings that are allocated by native code and must be freed using CoTaskMemFree after use.
[System.Runtime.InteropServices.CustomMarshalers.EnumeratorToEnumVariantMarshaler](https://github.com/dahall/Vanara/search?l=C%23&q=EnumeratorToEnumVariantMarshaler) | Marshals the COM <c>IEnumVARIANT</c> interface to the .NET Framework `System.Collections.IEnumerator` interface, and vice versa.
[Vanara.PInvoke.FunctionHelper](https://github.com/dahall/Vanara/search?l=C%23&q=FunctionHelper) | Generic functions to help with standard function patterns like getting a string from a method.
[Vanara.InteropServices.GenericStringMarshaler<T>](https://github.com/dahall/Vanara/search?l=C%23&q=GenericStringMarshaler<T>) | Marshals strings that are allocated by native code and must be freed after use.
[Vanara.InteropServices.GenericStringMarshalerBase<T>](https://github.com/dahall/Vanara/search?l=C%23&q=GenericStringMarshalerBase<T>) | Base abstract class for marshaling strings that are allocated by native code and must be freed after use.

View File

@ -1852,7 +1852,9 @@ public static partial class Shell32
}
using MemoryStream mem = new(bytes, false) { Position = guidBytes.Length };
#pragma warning disable SYSLIB0050 // Type or member is obsolete
return new BinaryFormatter() { AssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple }.Deserialize(mem);
#pragma warning restore SYSLIB0050 // Type or member is obsolete
static bool Equals(byte[] bytes, byte[] guid, int length)
{

View File

@ -1065,6 +1065,7 @@ public static partial class Shell32
/// <summary>Flags for SHGetStockIconInfo.</summary>
// https://docs.microsoft.com/en-us/windows/desktop/api/shellapi/nf-shellapi-shgetstockiconinfo
[PInvokeData("shellapi.h", MSDNShortId = "c08b1a53-e67c-4ed0-a9c6-d000c448e182")]
[Flags]
public enum SHGSI : uint
{
/// <summary>

View File

@ -125,7 +125,7 @@ public class WindowClass
/// <summary>Gets a handle to the brush representing the standard MDI window background (COLOR_APPWORKSPACE).</summary>
/// <value>The standard MDI window background brush handle.</value>
public static HBRUSH MdiWindowBrush => (HBRUSH)(SystemColorIndex.COLOR_APPWORKSPACE + 1);
public static HBRUSH MdiWindowBrush => (HBRUSH)(IntPtr)(SystemColorIndex.COLOR_APPWORKSPACE + 1);
/// <summary>
/// Gets a handle to a null brush (GetStockObject(NULL_BRUSH)). Use this for the background of non-displayable windows or to prevent
@ -144,7 +144,7 @@ public class WindowClass
/// <summary>Gets a handle to the brush representing the standard window background (COLOR_WINDOW).</summary>
/// <value>The standard window background brush handle.</value>
public static HBRUSH WindowBrush => (HBRUSH)(SystemColorIndex.COLOR_WINDOW + 1);
public static HBRUSH WindowBrush => (HBRUSH)(IntPtr)(SystemColorIndex.COLOR_WINDOW + 1);
/// <summary>Gets the windows class name.</summary>
public string ClassName => wc.lpszClassName;

View File

@ -1,4 +1,4 @@
#include "pch.h"
#include "pch.h"
using namespace System;
using namespace System::Reflection;
@ -9,9 +9,9 @@ using namespace System::Security::Permissions;
[assembly:AssemblyTitleAttribute(L"Vanara.PInvoke.VssApi")];
[assembly:AssemblyDescriptionAttribute(L"PInvoke API (methods, structures and constants) imported from Windows Volume Shadow Copy Service (VssApi.dll).")];
[assembly:AssemblyProductAttribute(L"Vanara")];
[assembly:AssemblyCopyrightAttribute(L"Copyright © 2017-2023")];
[assembly:AssemblyCopyrightAttribute(L"Copyright © 2017-2023")];
[assembly:AssemblyKeyFileAttribute(L"..\\..\\Vanara.snk")]
[assembly:AssemblyVersionAttribute("4.0.0")];
[assembly:AssemblyVersionAttribute("4.0.0.0")];
[assembly:AssemblyInformationalVersionAttribute("4.0.0-beta")];
[assembly:ComVisible(false)];
[assembly:ComVisible(false)];

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>Vanara.PInvoke.VssApi</id>
@ -15,50 +15,48 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<language>en-US</language>
<dependencies>
<group targetFramework="net45">
<!--<group targetFramework="net45">
<dependency id="Vanara.Core" version="$version$" exclude="Build,Analyzers" />
<dependency id="Vanara.PInvoke.Shared" version="$version$" exclude="Build,Analyzers" />
</group>
<group targetFramework="net48">
<dependency id="Vanara.Core" version="$version$" exclude="Build,Analyzers" />
<dependency id="Vanara.PInvoke.Shared" version="$version$" exclude="Build,Analyzers" />
</group>
</group>-->
<group targetFramework="net6.0">
<dependency id="Vanara.Core" version="$version$" exclude="Build,Analyzers" />
<dependency id="Vanara.PInvoke.Shared" version="$version$" exclude="Build,Analyzers" />
</group>
<group targetFramework="net7.0">
<!--<group targetFramework="net7.0">
<dependency id="Vanara.Core" version="$version$" exclude="Build,Analyzers" />
<dependency id="Vanara.PInvoke.Shared" version="$version$" exclude="Build,Analyzers" />
</group>
<group targetFramework="netcoreapp3.1">
<dependency id="Vanara.Core" version="$version$" exclude="Build,Analyzers" />
<dependency id="Vanara.PInvoke.Shared" version="$version$" exclude="Build,Analyzers" />
</group>
</group>-->
</dependencies>
<releaseNotes></releaseNotes>
<suppportedDlls>vssapi.dll</suppportedDlls>
</metadata>
<files>
<file src="bin\Release\net45\Win32\Vanara.PInvoke.VssApi*.???" target="lib\net45" />
<!--<file src="bin\Release\net45\Win32\Vanara.PInvoke.VssApi*.???" target="lib\net45" />
<file src="bin\Release\net45\Win32\Vanara.PInvoke.VssApi*.???" target="runtimes\win10-x86\lib\net45" />
<file src="bin\Release\net45\x64\Vanara.PInvoke.VssApi*.???" target="runtimes\win10-x64\lib\net45" />
<file src="bin\Release\net48\Win32\Vanara.PInvoke.VssApi*.???" target="lib\net48" />
<file src="bin\Release\net48\Win32\Vanara.PInvoke.VssApi*.???" target="runtimes\win10-x86\lib\net48" />
<file src="bin\Release\net48\x64\Vanara.PInvoke.VssApi*.???" target="runtimes\win10-x64\lib\net48" />
<file src="bin\Release\net6.0\Win32\Vanara.PInvoke.VssApi*.???" target="lib\net6.0" />
<file src="bin\Release\net6.0\Win32\Vanara.PInvoke.VssApi*.???" target="runtimes\win10-x86\lib\net6.0" />
<file src="bin\Release\net48\x64\Vanara.PInvoke.VssApi*.???" target="runtimes\win10-x64\lib\net48" />-->
<file src="bin\Release\net6.0\x64\Vanara.PInvoke.VssApi*.???" target="lib\net6.0" />
<!--<file src="bin\Release\net6.0\Win32\Vanara.PInvoke.VssApi*.???" target="runtimes\win10-x86\lib\net6.0" />-->
<file src="bin\Release\net6.0\x64\Vanara.PInvoke.VssApi*.???" target="runtimes\win10-x64\lib\net6.0" />
<file src="bin\Release\net7.0\Win32\Vanara.PInvoke.VssApi*.???" target="lib\net7.0" />
<!--<file src="bin\Release\net7.0\Win32\Vanara.PInvoke.VssApi*.???" target="lib\net7.0" />
<file src="bin\Release\net7.0\Win32\Vanara.PInvoke.VssApi*.???" target="runtimes\win10-x86\lib\net7.0" />
<file src="bin\Release\net7.0\x64\Vanara.PInvoke.VssApi*.???" target="runtimes\win10-x64\lib\net7.0" />
<file src="bin\Release\netcoreapp3.1\Win32\Vanara.PInvoke.VssApi*.???" target="lib\netcoreapp3.1" />
<file src="bin\Release\netcoreapp3.1\Win32\Vanara.PInvoke.VssApi*.???" target="runtimes\win10-x86\lib\netcoreapp3.1" />
<file src="bin\Release\netcoreapp3.1\x64\Vanara.PInvoke.VssApi*.???" target="runtimes\win10-x64\lib\netcoreapp3.1" />
<file src="bin\Release\netcoreapp3.1\x64\Vanara.PInvoke.VssApi*.???" target="runtimes\win10-x64\lib\netcoreapp3.1" />-->
<file src="..\..\docs\icons\Vanara64x64.png" target="Vanara64x64.png" />
<file src="pkgreadme.md" target="pkgreadme.md" />
</files>

View File

@ -61,7 +61,6 @@
<Keyword Condition="'$(CoreBuild)'=='true'">NetCoreCProj</Keyword>
<RootNamespace>VssApi</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>7.0</WindowsTargetPlatformMinVersion>
<TargetFrameworkVersion Condition="$(TargetFramework.StartsWith('net4'))">$([System.Text.RegularExpressions.Regex]::Replace($(TargetFramework), `net([2-4])([0-9])`, `v$1.$2`))</TargetFrameworkVersion>
<ProjectName>Vanara.PInvoke.VssApi</ProjectName>
<Description>PInvoke API (methods, structures and constants) imported from Windows Volume Shadow Copy Service (VssApi.dll).</Description>

View File

@ -3,6 +3,6 @@
<package id="Microsoft.Build.Tasks.Git" version="8.0.0" targetFramework="native" developmentDependency="true" />
<package id="Microsoft.SourceLink.Common" version="8.0.0" targetFramework="native" developmentDependency="true" />
<package id="Microsoft.SourceLink.GitHub" version="8.0.0" targetFramework="native" developmentDependency="true" />
<package id="Vanara.Core" version="4.0.0-beta" targetFramework="native" developmentDependency="true" />
<package id="Vanara.PInvoke.Shared" version="4.0.0-beta" targetFramework="native" developmentDependency="true" />
<package id="Vanara.Core" version="4.0.0-beta2" targetFramework="native" developmentDependency="true" />
<package id="Vanara.PInvoke.Shared" version="4.0.0-beta2" targetFramework="native" developmentDependency="true" />
</packages>

View File

@ -1,6 +1,6 @@
![Vanara](https://raw.githubusercontent.com/dahall/Vanara/master/docs/icons/VanaraHeading.png)
### **Vanara.PInvoke.VssApiMgd NuGet Package**
[![Version](https://img.shields.io/nuget/v/Vanara.PInvoke.VssApiMgd?label=NuGet&style=flat-square)](https://github.com/dahall/Vanara/releases)
### **Vanara.PInvoke.VssApi NuGet Package**
[![Version](https://img.shields.io/nuget/v/?label=NuGet&style=flat-square)](https://github.com/dahall/Vanara/releases)
[![Build status](https://img.shields.io/appveyor/build/dahall/vanara?label=AppVeyor%20build&style=flat-square)](https://ci.appveyor.com/project/dahall/vanara)
PInvoke API (methods, structures and constants) imported from Windows Volume Shadow Copy Service (VssApi.dll).
@ -14,8 +14,8 @@ PInvoke API (methods, structures and constants) imported from Windows Volume Sha
First check if it's already fixed by trying the [AppVeyor build](https://ci.appveyor.com/nuget/vanara-prerelease).
If you're still running into problems, file an [issue](https://github.com/dahall/Vanara/issues).
### **Included in Vanara.PInvoke.VssApiMgd**
### **Included in Vanara.PInvoke.VssApi**
Functions | Enumerations | Structures | Interfaces
--- | --- | --- | ---
IsVolumeSnapshotted IsVolumeSnapshottedInternal ShouldBlockRevert ShouldBlockRevertInternal | VDS_INTERCONNECT_ADDRESS_TYPE VDS_STORAGE_BUS_TYPE VDS_STORAGE_IDENTIFIER_CODE_SET VDS_STORAGE_IDENTIFIER_TYPE VSS_MGMT_OBJECT_TYPE VSS_PROTECTION_FAULT VSS_PROTECTION_LEVEL VSS_APPLICATION_LEVEL VSS_BACKUP_SCHEMA VSS_BACKUP_TYPE VSS_FILE_SPEC_BACKUP_TYPE VSS_HARDWARE_OPTIONS VSS_OBJECT_TYPE VSS_PROVIDER_CAPABILITIES VSS_PROVIDER_TYPE VSS_RECOVERY_OPTIONS VSS_RESTORE_TYPE VSS_ROLLFORWARD_TYPE VSS_SNAPSHOT_COMPATIBILITY VSS_SNAPSHOT_CONTEXT VSS_SNAPSHOT_PROPERTY_ID VSS_SNAPSHOT_STATE VSS_VOLUME_SNAPSHOT_ATTRIBUTES VSS_WRITER_STATE VSS_ALTERNATE_WRITER_STATE VSS_COMPONENT_FLAGS VSS_COMPONENT_TYPE VSS_FILE_RESTORE_STATUS VSS_RESTORE_TARGET VSS_RESTOREMETHOD_ENUM VSS_SOURCE_TYPE VSS_SUBSCRIBE_MASK VSS_USAGE_TYPE VSS_WRITERRESTORE_ENUM | VDS_INTERCONNECT VDS_LUN_INFORMATION VDS_STORAGE_DEVICE_ID_DESCRIPTOR VDS_STORAGE_IDENTIFIER VSS_COMPONENTINFO VssWriterStatus VSS_DIFF_AREA_PROP VSS_DIFF_VOLUME_PROP VSS_MGMT_OBJECT_PROP VSS_MGMT_OBJECT_UNION VSS_VOLUME_PROP VSS_VOLUME_PROTECTION_INFO VSS_OBJECT_PROP VSS_OBJECT_UNION VSS_PROVIDER_PROP VSS_SNAPSHOT_PROP VssDifferencedFile VssDirectedTarget VssPartialFile VssRestoreSubcomponent | IVssAdmin IVssAdminEx IVssDifferentialSoftwareSnapshotMgmt IVssDifferentialSoftwareSnapshotMgmt2 IVssDifferentialSoftwareSnapshotMgmt3 IVssEnumMgmtObject IVssSnapshotMgmt IVssSnapshotMgmt2 IVssFileShareSnapshotProvider IVssHardwareSnapshotProvider IVssHardwareSnapshotProviderEx IVssProviderCreateSnapshotSet IVssProviderNotifications IVssSoftwareSnapshotProvider IVssAsync IVssEnumObject IVssCreateExpressWriterMetadata
Functions
---
CreateVssBackupComponentsInternal CreateVssExamineWriterMetadataInternal CreateVssExpressWriterInternal CreateVssSnapshotSetDescription CreateWriter CreateWriterEx GetProviderMgmtInterface GetProviderMgmtInterfaceInternal IsVolumeSnapshotted IsVolumeSnapshottedInternal LoadVssSnapshotSetDescription long __cdecl CreateVssBackupComponents(class IVssBackupComponents * __ptr64 * __ptr64) long __cdecl CreateVssExamineWriterMetadata(unsigned short * __ptr64,class IVssExamineWriterMetadata * __ptr64 * __ptr64) ShouldBlockRevert ShouldBlockRevertInternal VssFreeSnapshotProperties VssFreeSnapshotPropertiesInternal

View File

@ -43,7 +43,9 @@ public class BadValueException : Exception
/// <param name="context">
/// The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.
/// </param>
#pragma warning disable SYSLIB0051 // Type or member is obsolete
protected BadValueException(SerializationInfo info, StreamingContext context) : base(info, context)
#pragma warning restore SYSLIB0051 // Type or member is obsolete
{
}
}
@ -113,7 +115,9 @@ internal class ClaimValueDictionary : Dictionary<string, ClaimValue>
/// serialized stream associated with the <see cref="T:System.Collections.Generic.Dictionary`2"/>.
/// </param>
protected ClaimValueDictionary(SerializationInfo info, StreamingContext context)
#pragma warning disable SYSLIB0051 // Type or member is obsolete
: base(info, context)
#pragma warning restore SYSLIB0051 // Type or member is obsolete
{
}
@ -135,7 +139,7 @@ internal class ClaimValueDictionary : Dictionary<string, ClaimValue>
i++;
}
AUTHZ_SECURITY_ATTRIBUTE_OPERATION[] claimOps = new AUTHZ_SECURITY_ATTRIBUTE_OPERATION[0];
AUTHZ_SECURITY_ATTRIBUTE_OPERATION[] claimOps = [];
if (claimInfo.AttributeCount != 0)
{
claimOps = new AUTHZ_SECURITY_ATTRIBUTE_OPERATION[claimInfo.AttributeCount];
@ -165,13 +169,13 @@ internal class ClaimValueDictionary : Dictionary<string, ClaimValue>
/// A <see cref="T:System.Runtime.Serialization.StreamingContext"/> structure that contains the source and destination of the
/// serialized stream associated with the <see cref="T:System.Collections.Generic.Dictionary`2"/> instance.
/// </param>
#if NET8_0_OR_GREATER
[Obsolete]
#endif
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
if (info != null)
{
info.AddValue("claimDefnType", claimDefnType);
}
info?.AddValue("claimDefnType", claimDefnType);
}
}

View File

@ -9,7 +9,7 @@
<PackageReleaseNotes>Currently implements:
Classes
AccessControlHelper, AccessExtension, AccountPrivileges, AccountUtils, ActiveDirectoryExtension, BadValueException, CentralAccessPolicy, CentralAccessPolicyEntry, ClaimValue, LogonRights, PinnedAcl, PinnedSecurityDescriptor, PinnedSid, PrivilegeAndAttributes, PrivilegedCodeBlock, PrivilegeExtension, SystemAccountInfo, SystemSecurity, UAC, WindowsImpersonatedIdentity, WindowsLoggedInIdentity
AccessControlHelper, AccessExtension, AccountPrivileges, AccountUtils, ActiveDirectoryExtension, BadValueException, CentralAccessPolicy, CentralAccessPolicyEntry, ClaimValue, LogonRights, PinnedAcl, PinnedSecurityDescriptor, PinnedSid, PrivilegeAndAttributes, PrivilegedCodeBlock, PrivilegeExtension, SystemAccountInfo, SystemSecurity, UAC, WindowsLoggedInIdentity
Enumerations
AccountLogonRights, DesiredAccess, SystemPrivilege

View File

@ -18,4 +18,4 @@ If you're still running into problems, file an [issue](https://github.com/dahall
Classes | Enumerations
--- | ---
AccessControlHelper AccessExtension AccountPrivileges AccountUtils ActiveDirectoryExtension BadValueException CentralAccessPolicy CentralAccessPolicyEntry ClaimValue LogonRights PinnedAcl PinnedSecurityDescriptor PinnedSid PrivilegeAndAttributes PrivilegedCodeBlock PrivilegeExtension SystemAccountInfo SystemSecurity UAC WindowsImpersonatedIdentity WindowsLoggedInIdentity | AccountLogonRights DesiredAccess SystemPrivilege
AccessControlHelper AccessExtension AccountPrivileges AccountUtils ActiveDirectoryExtension BadValueException CentralAccessPolicy CentralAccessPolicyEntry ClaimValue LogonRights PinnedAcl PinnedSecurityDescriptor PinnedSid PrivilegeAndAttributes PrivilegedCodeBlock PrivilegeExtension SystemAccountInfo SystemSecurity UAC WindowsLoggedInIdentity | AccountLogonRights DesiredAccess SystemPrivilege

View File

@ -28,5 +28,4 @@ Class | Description
[Vanara.Security.AccessControl.SystemSecurity.SystemAccountInfo](https://github.com/dahall/Vanara/search?l=C%23&q=SystemAccountInfo) | Contains a corresponding result for each name provided to the `Vanara.Security.AccessControl.SystemSecurity.GetAccountInfo(System.Boolean,System.String[])` method.
[Vanara.Security.AccessControl.SystemSecurity](https://github.com/dahall/Vanara/search?l=C%23&q=SystemSecurity) | Provides access to the local security authority on a given server.
[Vanara.Security.UAC](https://github.com/dahall/Vanara/search?l=C%23&q=UAC) | Provides information about the state of User Access Control for the system.
[Vanara.Security.Principal.WindowsImpersonatedIdentity](https://github.com/dahall/Vanara/search?l=C%23&q=WindowsImpersonatedIdentity) | Impersonation of a user. Allows to execute code under another user context. Please note that the account that instantiates this class needs to have the 'Act as part of operating system' privilege set.
[Vanara.Security.Principal.WindowsLoggedInIdentity](https://github.com/dahall/Vanara/search?l=C%23&q=WindowsLoggedInIdentity) | Impersonation of a user. Allows to execute code under another user context. Please note that the account that instantiates this class needs to have the 'Act as part of operating system' privilege set.

View File

@ -15,7 +15,7 @@ public abstract class ResultIs // : NUnit.Framework.Is
public class MyConstraintExpression
{
private OpConstraint.Op op;
private readonly OpConstraint.Op op;
private MyConstraintExpression(OpConstraint.Op _op) => op = _op;
@ -26,7 +26,13 @@ public class MyConstraintExpression
public ValueConstraint Value(object? value) => new(value, op);
}
public class FailureConstraint : Constraint
public abstract class DescConstraint : Constraint
{
protected string description = "";
public override string Description => description;
}
public class FailureConstraint : DescConstraint
{
public FailureConstraint(object? expected = null)
{
@ -57,16 +63,16 @@ public class FailureConstraint : Constraint
public override ConstraintResult ApplyTo<TActual>(TActual actual)
{
var success = false;
object updActual = actual;
object? updActual = actual;
switch (actual)
{
case bool b:
success = b;
Description = nameof(Win32Error.ERROR_SUCCESS);
description = nameof(Win32Error.ERROR_SUCCESS);
if (!b)
{
var le = Win32Error.GetLastError();
if (Expected != null) Description = Expected.ToString();
if (Expected != null) description = Expected.ToString() ?? "";
success = Expected is null ? le.Failed : le.Failed && ((IErrorProvider)Expected).ToHRESULT().Equals(le.ToHRESULT());
updActual = le;
}
@ -74,31 +80,31 @@ public class FailureConstraint : Constraint
case HRESULT hr:
success = Expected is null ? hr.Failed : hr.Failed && ((IErrorProvider)Expected).ToHRESULT().Equals(hr);
Description = Expected?.ToString() ?? nameof(HRESULT.S_OK);
description = Expected?.ToString() ?? nameof(HRESULT.S_OK);
break;
case Win32Error err:
success = Expected is null ? err.Failed : err.Failed && ((IErrorProvider)Expected).ToHRESULT().Equals(err.ToHRESULT());
Description = Expected?.ToString() ?? nameof(Win32Error.ERROR_SUCCESS);
description = Expected?.ToString() ?? nameof(Win32Error.ERROR_SUCCESS);
break;
case NTStatus st:
success = Expected is null ? st.Failed : st.Failed && ((IErrorProvider)Expected).ToHRESULT().Equals(((IErrorProvider)st).ToHRESULT());
Description = Expected?.ToString() ?? nameof(NTStatus.STATUS_SUCCESS);
description = Expected?.ToString() ?? nameof(NTStatus.STATUS_SUCCESS);
break;
case uint i:
var e = new Win32Error(i);
success = Expected is null ? e.Failed : e.Failed && ((IErrorProvider)Expected).ToHRESULT().Equals(e.ToHRESULT());
updActual = e;
Description = Expected?.ToString() ?? nameof(Win32Error.ERROR_SUCCESS);
description = Expected?.ToString() ?? nameof(Win32Error.ERROR_SUCCESS);
break;
case int ui:
var h = new HRESULT(ui);
success = Expected is null ? h.Failed : h.Failed && ((IErrorProvider)Expected).ToHRESULT().Equals(h);
updActual = h;
Description = Expected?.ToString() ?? nameof(HRESULT.S_OK);
description = Expected?.ToString() ?? nameof(HRESULT.S_OK);
break;
default:
@ -108,7 +114,7 @@ public class FailureConstraint : Constraint
}
}
public class SuccessfulConstraint : Constraint
public class SuccessfulConstraint : DescConstraint
{
public SuccessfulConstraint()
{
@ -122,7 +128,7 @@ public class SuccessfulConstraint : Constraint
{
case bool b:
success = b;
Description = nameof(Win32Error.ERROR_SUCCESS);
description = nameof(Win32Error.ERROR_SUCCESS);
if (!b)
{
var le = Win32Error.GetLastError();
@ -133,31 +139,31 @@ public class SuccessfulConstraint : Constraint
case HRESULT hr:
success = hr.Succeeded;
Description = nameof(HRESULT.S_OK);
description = nameof(HRESULT.S_OK);
break;
case Win32Error err:
success = err.Succeeded;
Description = nameof(Win32Error.ERROR_SUCCESS);
description = nameof(Win32Error.ERROR_SUCCESS);
break;
case NTStatus st:
success = st.Succeeded;
Description = nameof(NTStatus.STATUS_SUCCESS);
description = nameof(NTStatus.STATUS_SUCCESS);
break;
case uint i:
var e = new Win32Error(i);
success = e.Succeeded;
updActual = e;
Description = nameof(Win32Error.ERROR_SUCCESS);
description = nameof(Win32Error.ERROR_SUCCESS);
break;
case int ui:
var h = new HRESULT(ui);
success = h.Succeeded;
updActual = h;
Description = nameof(HRESULT.S_OK);
description = nameof(HRESULT.S_OK);
break;
default:
@ -167,7 +173,7 @@ public class SuccessfulConstraint : Constraint
}
}
public abstract class OpConstraint : Constraint
public abstract class OpConstraint : DescConstraint
{
public enum Op
{
@ -179,19 +185,11 @@ public abstract class OpConstraint : Constraint
protected OpConstraint(Op op) => AppliedOp = op;
protected string Prefix
protected string Prefix => AppliedOp switch
{
get
{
switch (AppliedOp)
{
case Op.Not:
return "Not ";
default:
return "";
}
}
}
Op.Not => "Not ",
_ => "",
};
}
public class ValidHandleConstraint : OpConstraint
@ -226,11 +224,11 @@ public class ValidHandleConstraint : OpConstraint
default:
throw new InvalidCastException("Cannot get a handle from value.");
}
Description = $"Valid handle";
description = $"Valid handle";
if (AppliedOp == Op.Not)
{
success = !success;
Description = $"Invalid handle";
description = $"Invalid handle";
}
return new ErrConstraintResult(this, string.Format("0x{0:X" + IntPtr.Size + "}", val.ToInt64()), success);
}
@ -245,7 +243,7 @@ public class ValueConstraint : OpConstraint
public override ConstraintResult ApplyTo<TActual>(TActual actual)
{
var eq = new EqualConstraint(Expected);
Description = Prefix + eq.Description;
description = Prefix + eq.Description;
var success = eq.ApplyTo(actual).IsSuccess;
if (AppliedOp == Op.Not)
success = !success;
@ -257,7 +255,7 @@ public class ErrConstraintResult : ConstraintResult
{
private readonly Win32Error lastErr;
public ErrConstraintResult(IConstraint constraint, object actualValue, bool isSuccessful) : base(constraint, actualValue, isSuccessful) => lastErr = Win32Error.GetLastError();
public ErrConstraintResult(IConstraint constraint, object? actualValue, bool isSuccessful) : base(constraint, actualValue, isSuccessful) => lastErr = Win32Error.GetLastError();
public override void WriteAdditionalLinesTo(MessageWriter writer) => writer.Write($" (Err: {lastErr})");
}

View File

@ -299,7 +299,7 @@ public sealed class TemporaryDirectory : IDisposable
CreateTreeCore(folder, level, false, randomizedDates, readOnly, hidden);
}
Assert.AreEqual(level, folderCount, "The number of folders does not equal level argument, but is expected to.");
Assert.That(level, Is.EqualTo(folderCount), "The number of folders does not equal level argument, but is expected to.");
return dirInfo;
}

View File

@ -13,8 +13,8 @@
<SupportedPlatform Include="windows" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
<ItemGroup>

View File

@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>UnitTest.PInvoke.FhSvcCtl</AssemblyName>
<RuntimeIdentifier Condition=" !$(TargetFramework.StartsWith('net8')) ">win10-x64</RuntimeIdentifier>
<SelfContained Condition=" $(TargetFramework.StartsWith('net8')) ">true</SelfContained>
<RuntimeIdentifier Condition=" !$(TargetFramework.StartsWith('net8')) ">win10-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\PInvoke\FhSvcCtl\Vanara.PInvoke.FhSvcCtl.csproj" />

View File

@ -44,7 +44,7 @@ public class VssApiTests
var setId = backup.StartSnapshotSet();
try
{
Assert.True(backup.IsVolumeSupported(default, "C:\\"));
Assert.That(backup.IsVolumeSupported(default, "C:\\"), Is.True);
var snapId = backup.AddToSnapshotSet("C:\\");
var props = backup.GetSnapshotProperties(snapId);
TestContext.WriteLine(props.m_pwszSnapshotDeviceObject);

View File

@ -3,7 +3,7 @@
<metadata>
<id>Vanara.Library</id>
<title>Vanara Libraries Metapackage</title>
<version>4.0.0</version>
<version>4.0.0-beta2</version>
<description>The full set of packages associated with the Vanara PInvoke Libraries.</description>
<tags>pinvoke;vanara;net-extensions;interop</tags>
<copyright>Copyright © 2017-2022</copyright>
@ -16,114 +16,114 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<language>en-US</language>
<dependencies>
<dependency id="Vanara.BITS" version="4.0.0" />
<dependency id="Vanara.Core" version="4.0.0" />
<dependency id="Vanara.Management" version="4.0.0" />
<dependency id="Vanara.Net" version="4.0.0" />
<dependency id="Vanara.PInvoke.Accessibility" version="4.0.0" />
<dependency id="Vanara.PInvoke.AclUI" version="4.0.0" />
<dependency id="Vanara.PInvoke.AMSI" version="4.0.0" />
<dependency id="Vanara.PInvoke.Avrt" version="4.0.0" />
<dependency id="Vanara.PInvoke.BITS" version="4.0.0" />
<dependency id="Vanara.PInvoke.Cabinet" version="4.0.0" />
<dependency id="Vanara.PInvoke.CfgMgr32" version="4.0.0" />
<dependency id="Vanara.PInvoke.CimFs" version="4.0.0" />
<dependency id="Vanara.PInvoke.CldApi" version="4.0.0" />
<dependency id="Vanara.PInvoke.ClfsW32" version="4.0.0" />
<dependency id="Vanara.PInvoke.ComCtl32" version="4.0.0" />
<dependency id="Vanara.PInvoke.ComDlg32" version="4.0.0" />
<dependency id="Vanara.PInvoke.CoreAudio" version="4.0.0" />
<dependency id="Vanara.PInvoke.CredUI" version="4.0.0" />
<dependency id="Vanara.PInvoke.Cryptography" version="4.0.0" />
<dependency id="Vanara.PInvoke.DavClnt" version="4.0.0" />
<dependency id="Vanara.PInvoke.DbgHelp" version="4.0.0" />
<dependency id="Vanara.PInvoke.Dhcp" version="4.0.0" />
<dependency id="Vanara.PInvoke.DnsApi" version="4.0.0" />
<dependency id="Vanara.PInvoke.DOSvc" version="4.0.0" />
<dependency id="Vanara.PInvoke.Drt" version="4.0.0" />
<dependency id="Vanara.PInvoke.DwmApi" version="4.0.0" />
<dependency id="Vanara.PInvoke.EnhancedStorage" version="4.0.0" />
<dependency id="Vanara.PInvoke.FhSvcCtl" version="4.0.0" />
<dependency id="Vanara.PInvoke.FirewallApi" version="4.0.0" />
<dependency id="Vanara.PInvoke.FunDisc" version="4.0.0" />
<dependency id="Vanara.PInvoke.FwpUClnt" version="4.0.0" />
<dependency id="Vanara.PInvoke.Gdi32" version="4.0.0" />
<dependency id="Vanara.PInvoke.Graphics" version="4.0.0" />
<dependency id="Vanara.PInvoke.HttpApi" version="4.0.0" />
<dependency id="Vanara.PInvoke.IMAPI" version="4.0.0" />
<dependency id="Vanara.PInvoke.Imm32" version="4.0.0" />
<dependency id="Vanara.PInvoke.IpHlpApi" version="4.0.0" />
<dependency id="Vanara.PInvoke.IScsiDsc" version="4.0.0" />
<dependency id="Vanara.PInvoke.Kernel32" version="4.0.0" />
<dependency id="Vanara.PInvoke.KtmW32" version="4.0.0" />
<dependency id="Vanara.PInvoke.Lz32" version="4.0.0" />
<dependency id="Vanara.PInvoke.Magnification" version="4.0.0" />
<dependency id="Vanara.PInvoke.Mpr" version="4.0.0" />
<dependency id="Vanara.PInvoke.MsftEdit" version="4.0.0" />
<dependency id="Vanara.PInvoke.Msi" version="4.0.0" />
<dependency id="Vanara.PInvoke.MsRdc" version="4.0.0" />
<dependency id="Vanara.PInvoke.Multimedia" version="4.0.0" />
<dependency id="Vanara.PInvoke.NdfApi" version="4.0.0" />
<dependency id="Vanara.PInvoke.NetApi32" version="4.0.0" />
<dependency id="Vanara.PInvoke.NetListMgr" version="4.0.0" />
<dependency id="Vanara.PInvoke.NewDev" version="4.0.0" />
<dependency id="Vanara.PInvoke.NtDll" version="4.0.0" />
<dependency id="Vanara.PInvoke.NTDSApi" version="4.0.0" />
<dependency id="Vanara.PInvoke.Ole" version="4.0.0" />
<dependency id="Vanara.PInvoke.OleDlg" version="4.0.0" />
<dependency id="Vanara.PInvoke.Opc" version="4.0.0" />
<dependency id="Vanara.PInvoke.P2P" version="4.0.0" />
<dependency id="Vanara.PInvoke.Pdh" version="4.0.0" />
<dependency id="Vanara.PInvoke.PeerDist" version="4.0.0" />
<dependency id="Vanara.PInvoke.PhotoAcquire" version="4.0.0" />
<dependency id="Vanara.PInvoke.PortableDeviceApi" version="4.0.0" />
<dependency id="Vanara.PInvoke.PowrProf" version="4.0.0" />
<dependency id="Vanara.PInvoke.Printing" version="4.0.0" />
<dependency id="Vanara.PInvoke.ProjectedFSLib" version="4.0.0" />
<dependency id="Vanara.PInvoke.QoS" version="4.0.0" />
<dependency id="Vanara.PInvoke.Rpc" version="4.0.0" />
<dependency id="Vanara.PInvoke.RstrtMgr" version="4.0.0" />
<dependency id="Vanara.PInvoke.SearchApi" version="4.0.0" />
<dependency id="Vanara.PInvoke.Security" version="4.0.0" />
<dependency id="Vanara.PInvoke.SensorsApi" version="4.0.0" />
<dependency id="Vanara.PInvoke.SetupAPI" version="4.0.0" />
<dependency id="Vanara.PInvoke.Shared" version="4.0.0" />
<dependency id="Vanara.PInvoke.SHCore" version="4.0.0" />
<dependency id="Vanara.PInvoke.Shell32" version="4.0.0" />
<dependency id="Vanara.PInvoke.ShlwApi" version="4.0.0" />
<dependency id="Vanara.PInvoke.TaskSchd" version="4.0.0" />
<dependency id="Vanara.PInvoke.TextServicesFramework" version="4.0.0" />
<dependency id="Vanara.PInvoke.UIAutomation" version="4.0.0" />
<dependency id="Vanara.PInvoke.UrlMon" version="4.0.0" />
<dependency id="Vanara.PInvoke.User32" version="4.0.0" />
<dependency id="Vanara.PInvoke.UserEnv" version="4.0.0" />
<dependency id="Vanara.PInvoke.Usp10" version="4.0.0" />
<dependency id="Vanara.PInvoke.UxTheme" version="4.0.0" />
<dependency id="Vanara.PInvoke.Version" version="4.0.0" />
<dependency id="Vanara.PInvoke.VirtDisk" version="4.0.0" />
<dependency id="Vanara.PInvoke.WcmApi" version="4.0.0" />
<dependency id="Vanara.PInvoke.WcnApi" version="4.0.0" />
<dependency id="Vanara.PInvoke.WebSocket" version="4.0.0" />
<dependency id="Vanara.PInvoke.Wer" version="4.0.0" />
<dependency id="Vanara.PInvoke.WinBio" version="4.0.0" />
<dependency id="Vanara.PInvoke.WinHTTP" version="4.0.0" />
<dependency id="Vanara.PInvoke.WinINet" version="4.0.0" />
<dependency id="Vanara.PInvoke.WinSCard" version="4.0.0" />
<dependency id="Vanara.PInvoke.WinTrust" version="4.0.0" />
<dependency id="Vanara.PInvoke.WlanApi" version="4.0.0" />
<dependency id="Vanara.PInvoke.Ws2_32" version="4.0.0" />
<dependency id="Vanara.PInvoke.WscApi" version="4.0.0" />
<dependency id="Vanara.PInvoke.WsmSvc" version="4.0.0" />
<dependency id="Vanara.PInvoke.WTSApi32" version="4.0.0" />
<dependency id="Vanara.Security" version="4.0.0" />
<dependency id="Vanara.SystemServices" version="4.0.0" />
<dependency id="Vanara.VirtualDisk" version="4.0.0" />
<dependency id="Vanara.Windows.Extensions" version="4.0.0" />
<dependency id="Vanara.Windows.Forms" version="4.0.0" />
<dependency id="Vanara.Windows.Shell.Common" version="4.0.0" />
<dependency id="Vanara.Windows.Shell" version="4.0.0" />
<dependency id="Vanara.WinUI.Extensions" version="4.0.0" />
<dependency id="Vanara.WPF.Extensions" version="4.0.0" />
<dependency id="Vanara.BITS" version="4.0.0-beta2" />
<dependency id="Vanara.Core" version="4.0.0-beta2" />
<dependency id="Vanara.Management" version="4.0.0-beta2" />
<dependency id="Vanara.Net" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Accessibility" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.AclUI" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.AMSI" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Avrt" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.BITS" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Cabinet" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.CfgMgr32" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.CimFs" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.CldApi" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.ClfsW32" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.ComCtl32" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.ComDlg32" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.CoreAudio" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.CredUI" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Cryptography" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.DavClnt" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.DbgHelp" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Dhcp" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.DnsApi" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.DOSvc" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Drt" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.DwmApi" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.EnhancedStorage" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.FhSvcCtl" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.FirewallApi" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.FunDisc" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.FwpUClnt" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Gdi32" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Graphics" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.HttpApi" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.IMAPI" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Imm32" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.IpHlpApi" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.IScsiDsc" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Kernel32" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.KtmW32" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Lz32" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Magnification" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Mpr" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.MsftEdit" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Msi" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.MsRdc" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Multimedia" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.NdfApi" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.NetApi32" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.NetListMgr" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.NewDev" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.NtDll" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.NTDSApi" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Ole" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.OleDlg" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Opc" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.P2P" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Pdh" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.PeerDist" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.PhotoAcquire" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.PortableDeviceApi" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.PowrProf" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Printing" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.ProjectedFSLib" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.QoS" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Rpc" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.RstrtMgr" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.SearchApi" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Security" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.SensorsApi" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.SetupAPI" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Shared" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.SHCore" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Shell32" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.ShlwApi" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.TaskSchd" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.TextServicesFramework" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.UIAutomation" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.UrlMon" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.User32" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.UserEnv" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Usp10" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.UxTheme" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Version" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.VirtDisk" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.WcmApi" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.WcnApi" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.WebSocket" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Wer" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.WinBio" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.WinHTTP" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.WinINet" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.WinSCard" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.WinTrust" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.WlanApi" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.Ws2_32" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.WscApi" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.WsmSvc" version="4.0.0-beta2" />
<dependency id="Vanara.PInvoke.WTSApi32" version="4.0.0-beta2" />
<dependency id="Vanara.Security" version="4.0.0-beta2" />
<dependency id="Vanara.SystemServices" version="4.0.0-beta2" />
<dependency id="Vanara.VirtualDisk" version="4.0.0-beta2" />
<dependency id="Vanara.Windows.Extensions" version="4.0.0-beta2" />
<dependency id="Vanara.Windows.Forms" version="4.0.0-beta2" />
<dependency id="Vanara.Windows.Shell.Common" version="4.0.0-beta2" />
<dependency id="Vanara.Windows.Shell" version="4.0.0-beta2" />
<dependency id="Vanara.WinUI.Extensions" version="4.0.0-beta2" />
<dependency id="Vanara.WPF.Extensions" version="4.0.0-beta2" />
</dependencies>
</metadata>
<files />

View File

@ -2046,8 +2046,8 @@ Global
{5CE784D4-42B7-4AA7-B2D0-E175C7FB40C8}.Release|x64.Build.0 = Release|x64
{5CE784D4-42B7-4AA7-B2D0-E175C7FB40C8}.Release|x86.ActiveCfg = Release|x86
{5CE784D4-42B7-4AA7-B2D0-E175C7FB40C8}.Release|x86.Build.0 = Release|x86
{11EF8FFF-25DE-4ADB-A951-FA10A421FFE4}.Debug|Any CPU.ActiveCfg = Debug|Win32
{11EF8FFF-25DE-4ADB-A951-FA10A421FFE4}.Debug|Any CPU.Build.0 = Debug|Win32
{11EF8FFF-25DE-4ADB-A951-FA10A421FFE4}.Debug|Any CPU.ActiveCfg = Debug|x64
{11EF8FFF-25DE-4ADB-A951-FA10A421FFE4}.Debug|Any CPU.Build.0 = Debug|x64
{11EF8FFF-25DE-4ADB-A951-FA10A421FFE4}.Debug|x64.ActiveCfg = Debug|x64
{11EF8FFF-25DE-4ADB-A951-FA10A421FFE4}.Debug|x64.Build.0 = Debug|x64
{11EF8FFF-25DE-4ADB-A951-FA10A421FFE4}.Debug|x86.ActiveCfg = Debug|Win32
@ -2058,8 +2058,8 @@ Global
{11EF8FFF-25DE-4ADB-A951-FA10A421FFE4}.DebugNoTests|x64.Build.0 = Debug|x64
{11EF8FFF-25DE-4ADB-A951-FA10A421FFE4}.DebugNoTests|x86.ActiveCfg = Debug|Win32
{11EF8FFF-25DE-4ADB-A951-FA10A421FFE4}.DebugNoTests|x86.Build.0 = Debug|Win32
{11EF8FFF-25DE-4ADB-A951-FA10A421FFE4}.Release|Any CPU.ActiveCfg = Release|Win32
{11EF8FFF-25DE-4ADB-A951-FA10A421FFE4}.Release|Any CPU.Build.0 = Release|Win32
{11EF8FFF-25DE-4ADB-A951-FA10A421FFE4}.Release|Any CPU.ActiveCfg = Release|x64
{11EF8FFF-25DE-4ADB-A951-FA10A421FFE4}.Release|Any CPU.Build.0 = Release|x64
{11EF8FFF-25DE-4ADB-A951-FA10A421FFE4}.Release|x64.ActiveCfg = Release|x64
{11EF8FFF-25DE-4ADB-A951-FA10A421FFE4}.Release|x64.Build.0 = Release|x64
{11EF8FFF-25DE-4ADB-A951-FA10A421FFE4}.Release|x86.ActiveCfg = Release|Win32
@ -3457,7 +3457,6 @@ Global
{B62EE3FD-4AA8-4A99-AAB3-3A4022AEB682}.DebugNoTests|x86.ActiveCfg = DebugNoTests|x86
{B62EE3FD-4AA8-4A99-AAB3-3A4022AEB682}.DebugNoTests|x86.Build.0 = DebugNoTests|x86
{B62EE3FD-4AA8-4A99-AAB3-3A4022AEB682}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B62EE3FD-4AA8-4A99-AAB3-3A4022AEB682}.Release|Any CPU.Build.0 = Release|Any CPU
{B62EE3FD-4AA8-4A99-AAB3-3A4022AEB682}.Release|x64.ActiveCfg = Release|x64
{B62EE3FD-4AA8-4A99-AAB3-3A4022AEB682}.Release|x64.Build.0 = Release|x64
{B62EE3FD-4AA8-4A99-AAB3-3A4022AEB682}.Release|x86.ActiveCfg = Release|x86

View File

@ -3,7 +3,7 @@
<PropertyGroup>
<Description>Extension methods and conversions from Vanara P/Invoke types and methods to WPF types and methods.</Description>
<AssemblyTitle>$(AssemblyName)</AssemblyTitle>
<TargetFrameworks>net45;net48;net6.0-windows;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net45;net48;net6.0;net7.0;net8.0-windows;netcoreapp3.1</TargetFrameworks>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<UseWPF>true</UseWPF>
<DefineConstants>$(DefineConstants);WPF</DefineConstants>

View File

@ -3,7 +3,7 @@
<PropertyGroup>
<Description>Extension methods and conversions from Vanara P/Invoke types and methods to UWP and WinUI types and methods.</Description>
<AssemblyTitle>$(AssemblyName)</AssemblyTitle>
<TargetFrameworks>net45;net48;net6.0-windows;netstandard2.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net45;net48;net6.0;net7.0;net8.0-windows;netcoreapp3.1</TargetFrameworks>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<UseWPF>true</UseWPF>
<AssemblyName>Vanara.WinUI.Extensions</AssemblyName>

View File

@ -3,7 +3,7 @@
<PropertyGroup>
<Description>Extension methods and conversions from Vanara P/Invoke types and methods to Windows Forms types and methods.</Description>
<AssemblyTitle>$(AssemblyName)</AssemblyTitle>
<TargetFrameworks>net45;net48;net6.0-windows;netstandard2.0;netcoreapp3.1</TargetFrameworks>
<!--<TargetFrameworks>net45;net48;net6.0-windows;netstandard2.0;netcoreapp3.1</TargetFrameworks>-->
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyName>Vanara.Windows.Extensions</AssemblyName>
@ -27,5 +27,6 @@ Corners
<ItemGroup>
<PackageReference Include="System.Drawing.Common" Version="6.0.0" Condition=" $(TargetFramework.StartsWith('netcore')) " />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" Condition=" $(TargetFramework.StartsWith('netstandard')) " />
<PackageReference Include="System.Drawing.Common" Version="8.0.0" Condition=" $(TargetFramework.StartsWith('net8')) " />
</ItemGroup>
</Project>

View File

@ -119,7 +119,7 @@ public class MenuStripMRUManager : MRUManager
fileMenuItemClickAction = fileMenuItemClick;
foreach (var f in files)
{
RecentFileMenuItem.DropDownItems.Add(new ToolStripMenuItem(CompactPath(RecentFileMenuItem.GetCurrentParent().CreateGraphics(), f, RecentFileMenuItem.Font, RecentFileMenuItem.Width), menuImageCallback?.Invoke(f) as Image, OnFileMenuItemClick) { Tag = f });
RecentFileMenuItem.DropDownItems.Add(new ToolStripMenuItem(CompactPath(RecentFileMenuItem.GetCurrentParent()!.CreateGraphics(), f, RecentFileMenuItem.Font, RecentFileMenuItem.Width), menuImageCallback?.Invoke(f) as Image, OnFileMenuItemClick) { Tag = f });
}
if (!clearListMenuItemOnTop && !string.IsNullOrEmpty(clearListMenuItemText))
@ -146,7 +146,7 @@ public class MenuStripMRUManager : MRUManager
private void OnFileMenuItemClick(object? sender, EventArgs e)
{
if (sender is ToolStripMenuItem item)
fileMenuItemClickAction?.Invoke(item.Tag.ToString()!);
fileMenuItemClickAction?.Invoke(item.Tag?.ToString()!);
}
}
}

View File

@ -420,7 +420,7 @@ public class CollapsiblePanel : Control, ISupportInitialize
public override void Layout(PaintEventArgs e)
{
headerImages.Images.Clear();
headerImages.Images.AddRange(Control.CustomStyle.ExpandoImages);
headerImages.Images.AddRange(Control.CustomStyle.ExpandoImages!);
}
public override void Paint(PaintEventArgs e)

View File

@ -208,7 +208,7 @@ internal class VistaCustomDrawingStyle : IDrawingStyle<CommandLink, PushButtonSt
{
var m = new Measurements(ctrl, state, e.Graphics);
e.Graphics.Clear(ctrl.Parent.BackColor);
e.Graphics.Clear(ctrl.Parent!.BackColor);
var gp = new GraphicsPath();
gp.AddRoundedRectangle(m.client, new Size(rndRectRadius, rndRectRadius));
e.Graphics.FillPath(m.dp.Fill, gp);

View File

@ -86,8 +86,8 @@ public class CustomButton : CustomDrawBase
var translateRect = Bounds;
pevent.Graphics.TranslateTransform(-Left, -Top);
var pe = new PaintEventArgs(pevent.Graphics, translateRect);
InvokePaintBackground(Parent, pe);
InvokePaint(Parent, pe);
InvokePaintBackground(Parent!, pe);
InvokePaint(Parent!, pe);
pevent.Graphics.ResetTransform();
pevent.Graphics.EndContainer(g);
@ -213,9 +213,9 @@ public class CustomButton : CustomDrawBase
internal class RoundCornersEditor : UITypeEditor
{
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
public override object? EditValue(ITypeDescriptorContext? context, IServiceProvider provider, object? value)
{
if (!(value is Corners) || provider == null)
if (value is not Corners || provider == null)
return value;
var edSvc = (IWindowsFormsEditorService?)provider.GetService(typeof(IWindowsFormsEditorService));
@ -224,7 +224,7 @@ internal class RoundCornersEditor : UITypeEditor
var cornerFlags = Corners.None;
using (var lb = new CheckedListBox { BorderStyle = BorderStyle.None, CheckOnClick = true })
{
lb.Items.Add("TopLeft", (((CustomButton)context.Instance).RoundCorners & Corners.TopLeft) == Corners.TopLeft);
lb.Items.Add("TopLeft", (((CustomButton)context.Instance!).RoundCorners & Corners.TopLeft) == Corners.TopLeft);
lb.Items.Add("TopRight", (((CustomButton)context.Instance).RoundCorners & Corners.TopRight) == Corners.TopRight);
lb.Items.Add("BottomLeft", (((CustomButton)context.Instance).RoundCorners & Corners.BottomLeft) == Corners.BottomLeft);
lb.Items.Add("BottomRight", (((CustomButton)context.Instance).RoundCorners & Corners.BottomRight) == Corners.BottomRight);
@ -237,5 +237,5 @@ internal class RoundCornersEditor : UITypeEditor
return cornerFlags;
}
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) => UITypeEditorEditStyle.DropDown;
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext? context) => UITypeEditorEditStyle.DropDown;
}

View File

@ -315,7 +315,7 @@ public abstract class CustomComboBox : ComboBox, IPopupControlHost
/// </PermissionSet>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Browsable(false), ReadOnly(true)]
public new object SelectedItem { get => base.SelectedItem; set { } }
public new object SelectedItem { get => base.SelectedItem!; set { } }
/// <summary>Gets or sets the text that is selected in the editable portion of a <see cref="T:System.Windows.Forms.ComboBox"/>.</summary>
/// <value></value>
@ -347,7 +347,7 @@ public abstract class CustomComboBox : ComboBox, IPopupControlHost
/// <exception cref="T:System.InvalidOperationException">The assigned value is null or the empty string ("").</exception>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Browsable(false), ReadOnly(true)]
public new object SelectedValue { get => base.SelectedValue; set { } }
public new object SelectedValue { get => base.SelectedValue!; set { } }
/// <summary>Gets or sets the number of characters selected in the editable portion of the combo box.</summary>
/// <value></value>
@ -416,7 +416,7 @@ public abstract class CustomComboBox : ComboBox, IPopupControlHost
/// </PermissionSet>
public new string Text
{
get => base.Items.Count == 0 ? string.Empty : base.Items[0].ToString()!;
get => base.Items.Count == 0 ? string.Empty : base.Items[0]!.ToString()!;
set
{
// Get toolTip value

View File

@ -26,7 +26,7 @@ public class EnumComboBox : CustomComboBox
/// <summary>Gets or sets the data source for this <see cref="T:System.Windows.Forms.ComboBox"/>.</summary>
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public new object DataSource { get => base.DataSource; set => base.DataSource = value; }
public new object DataSource { get => base.DataSource!; set => base.DataSource = value; }
/// <summary>Gets or sets the property to display for this <see cref="T:System.Windows.Forms.ListControl"/>.</summary>
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
@ -162,7 +162,7 @@ public class EnumComboBox : CustomComboBox
var c = checkListBox?.CheckedItems.Count ?? 0;
var items = new string?[c];
for (var i = 0; i < c; i++)
items[i] = checkListBox?.CheckedItems[i].ToString();
items[i] = checkListBox?.CheckedItems[i]!.ToString();
return string.Join(", ", items);
}

View File

@ -1107,7 +1107,7 @@ public class ExplorerBrowser : Control, ICommDlgBrowser3, IExplorerBrowserEvents
pe.Graphics.DrawString(nameof(ExplorerBrowser), font, SystemBrushes.GrayText, Rectangle.Inflate(cr, -3, -3), sf);
}
base.OnPaint(pe);
base.OnPaint(pe!);
}
/// <summary>Sizes the native control to match the WinForms control wrapper.</summary>

View File

@ -106,7 +106,9 @@ public partial class IPAddressBox : Control
public override string Text
{
get => base.Text;
#pragma warning disable CS8765 // Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes).
set
#pragma warning restore CS8765 // Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes).
{
if (value == Name) return;
if (!string.IsNullOrEmpty(value) && !System.Text.RegularExpressions.Regex.Match(value, @"^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$").Success)

View File

@ -872,7 +872,7 @@ public class ShellNamespaceTreeControl : Control, Shell32.IServiceProvider, INam
// Initialize and capture child window handles
var rect = BorderStyle == BorderStyle.None ? Bounds : Rectangle.Inflate(Bounds, -1, -1);
pCtrl.Initialize(Parent.Handle, rect, style).ThrowIfFailed();
pCtrl.Initialize(Parent!.Handle, rect, style).ThrowIfFailed();
var sb = new StringBuilder(512);
var srect = (RECT)RectangleToScreen(rect);
hWndNsTreeCtrl = User32.EnumChildWindows(Parent.Handle).First(h => IsClass(h, "NamespaceTreeControl"));

View File

@ -99,13 +99,15 @@ public class ThemedImageDraw : CustomDrawBase
public override string Text
{
get => base.Text;
#pragma warning disable CS8765 // Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes).
set => base.Text = value;
#pragma warning restore CS8765 // Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes).
}
/// <summary>Gets or sets the tool tip text.</summary>
/// <value>The tool tip text.</value>
[DefaultValue(defaultToolTip), Category("Appearance")]
public string ToolTipText
public string? ToolTipText
{
get => toolTip.GetToolTip(this);
set => toolTip.SetToolTip(this, value);
@ -217,13 +219,13 @@ public class ThemedImageDraw : CustomDrawBase
var translateRect = bounds;
graphics.TranslateTransform(-bounds.Left, -bounds.Top);
var pe = new PaintEventArgs(graphics, translateRect);
InvokePaintBackground(Parent, pe);
InvokePaint(Parent, pe);
InvokePaintBackground(Parent!, pe);
InvokePaint(Parent!, pe);
graphics.ResetTransform();
graphics.EndContainer(g);
}
else
graphics.Clear(Parent.BackColor);
graphics.Clear(Parent!.BackColor);
if (forceDisabled)
ControlPaint.DrawImageDisabled(graphics, ImageList.Images[idx], 0, 0, Color.Transparent);
else

View File

@ -227,7 +227,7 @@ public class ThemedLabel : Label
else
{
// If we get here, then "Show accent color on title bars" has been disabled in Settings.
if (Form.ActiveForm.Equals(FindForm())) textColor = SystemColors.ControlText;
if (Form.ActiveForm!.Equals(FindForm())) textColor = SystemColors.ControlText;
else textColor = SystemColors.GrayText;
}
}

View File

@ -106,7 +106,7 @@ public class ThemedPanel : Panel
try { e.Graphics.Clear(Color.Black); } catch { }
else
{
var state = UnfocusedStyleState == -1 || FindForm().Focused ? styleState : UnfocusedStyleState;
var state = UnfocusedStyleState == -1 || FindForm()!.Focused ? styleState : UnfocusedStyleState;
if (theme != null && ThemingSupported)
{
if (theme.IsBackgroundPartiallyTransparent(stylePart, state))

View File

@ -108,7 +108,7 @@ public class ThemedTableLayoutPanel : TableLayoutPanel
try { e.Graphics.Clear(Color.Black); } catch { }
else
{
var state = UnfocusedStyleState == -1 || FindForm().Focused ? styleState : UnfocusedStyleState;
var state = UnfocusedStyleState == -1 || FindForm()!.Focused ? styleState : UnfocusedStyleState;
if (theme != null && ThemingSupported)
{
if (theme.IsBackgroundPartiallyTransparent(stylePart, state))

View File

@ -28,13 +28,13 @@ public class FlagEnumUIEditor<TE> : UITypeEditor where TE : struct, Enum
/// <returns>
/// The new value of the object. If the value of the object has not changed, this should return the same object it was passed.
/// </returns>
public override object? EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
public override object? EditValue(ITypeDescriptorContext? context, IServiceProvider provider, object? value)
{
if (context?.Instance != null && provider != null)
if (context?.Instance != null && provider != null && value != null)
{
var edSvc = provider.GetService<IWindowsFormsEditorService>();
if (edSvc == null) return null;
var e = (TE)Convert.ChangeType(value, context.PropertyDescriptor.PropertyType);
if (edSvc is null) return null;
var e = (TE)Convert.ChangeType(value, context.PropertyDescriptor?.PropertyType ?? throw new ArgumentNullException(nameof(context)));
listBox.Value = e;
edSvc.DropDownControl(listBox);
return listBox.Value;
@ -55,7 +55,7 @@ public class FlagEnumUIEditor<TE> : UITypeEditor where TE : struct, Enum
/// cref="T:System.Drawing.Design.UITypeEditor"/> does not support this method, then <see
/// cref="M:System.Drawing.Design.UITypeEditor.GetEditStyle"/> will return <see cref="F:System.Drawing.Design.UITypeEditorEditStyle.None"/>.
/// </returns>
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) => UITypeEditorEditStyle.DropDown;
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext? context) => UITypeEditorEditStyle.DropDown;
/// <summary>A checked list box to use as the editor.</summary>
/// <seealso cref="UITypeEditor"/>

View File

@ -428,7 +428,7 @@ public abstract class AttributedDesignerActionList : DesignerActionList
/// <param name="value">The value.</param>
protected void SetComponentProperty<T>(string propName, T value) => ComponentProp(propName, typeof(T))?.SetValue(Component, value, null);
private PropertyInfo? ComponentProp(string propName, Type retType) => Component.GetType().GetProperty(propName, InternalComponentDesignerExtension.allInstBind, null, retType, Type.EmptyTypes, null);
private PropertyInfo? ComponentProp(string propName, Type retType) => Component!.GetType().GetProperty(propName, InternalComponentDesignerExtension.allInstBind, null, retType, Type.EmptyTypes, null);
}
/// <summary>A designer for parent controls supported by attributes.</summary>
@ -748,7 +748,7 @@ public class EditorServiceContext : IWindowsFormsEditorService, ITypeDescriptorC
{
}
void IWindowsFormsEditorService.DropDownControl(Control control)
void IWindowsFormsEditorService.DropDownControl(Control? control)
{
}
@ -832,7 +832,7 @@ public abstract class TypedDesignerActionList<TComponentDesigner, TComponent> :
public new TComponentDesigner ParentDesigner { get; }
/// <summary>Gets the component related to <see cref="T:System.ComponentModel.Design.DesignerActionList"/>.</summary>
public new TComponent Component => (TComponent)base.Component;
public new TComponent Component => (TComponent)base.Component!;
}
/// <summary>A glyph associated with a designer.</summary>
@ -936,7 +936,7 @@ internal static class InternalComponentDesignerExtension
var curCat = col[i].Category;
if (string.Compare(curCat, cat, true) != 0)
{
col.Insert(i++, new DesignerActionHeaderItem(curCat));
col.Insert(i++, new DesignerActionHeaderItem(curCat!));
cat = curCat;
}
}

View File

@ -341,7 +341,7 @@ public class InputDialog : CommonDialog
// Get value from control
var c = table.Controls[$"input{i}"];
var box = c as CheckBox;
var val = box?.Checked ?? ConvertFromStr(c.Text, itemType);
var val = box?.Checked ?? ConvertFromStr(c!.Text, itemType);
// Apply value to dataObj
if (item == null)
@ -435,7 +435,7 @@ public class InputDialog : CommonDialog
if (Image != null)
{
table.Controls.Add(new PictureBox { Image = Image, Size = Image.Size, Margin = new Padding(0, 0, 7, 0), TabStop = false }, 0, 0);
table.SetRowSpan(table.GetControlFromPosition(0, 0), table.RowCount);
table.SetRowSpan(table.GetControlFromPosition(0, 0)!, table.RowCount);
}
var hrow = 0;

View File

@ -149,7 +149,7 @@ public class ProgressDialog : CommonDialog
{
if (BackgroundTask is null)
throw new InvalidOperationException($"{nameof(BackgroundTask)} must be set before calling {nameof(RunDialog)}.");
ShowDialog(NativeWindow.FromHandle(hwndOwner), BackgroundTask).Wait();
ShowDialog(NativeWindow.FromHandle(hwndOwner)!, BackgroundTask).Wait();
return true;
}
catch
@ -191,7 +191,7 @@ public class ProgressDialog : CommonDialog
public InternalProgressDialog()
{
InitializeComponent();
MaximumSize = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
MaximumSize = new Size(Screen.PrimaryScreen!.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
}
/// <summary>Occurs when the Cancel button is pressed.</summary>

View File

@ -80,11 +80,12 @@ public static partial class ControlExtension
/// <returns>Culture defined direction of text for this control.</returns>
public static RightToLeft GetRightToLeftProperty(this Control ctrl)
{
while (ctrl != null)
Control? c = ctrl;
while (c != null)
{
if (ctrl.RightToLeft != RightToLeft.Inherit)
return ctrl.RightToLeft;
ctrl = ctrl.Parent;
if (c.RightToLeft != RightToLeft.Inherit)
return c.RightToLeft;
c = c.Parent;
}
return RightToLeft.No;
}

View File

@ -63,7 +63,7 @@ public static partial class TreeViewExtension
{
try
{
tv.ImageList.Images.Add(ext, IconExtension.GetFileIcon(ext, GetIconSizeFromSize(tv.ImageList.ImageSize)));
tv.ImageList.Images.Add(ext, IconExtension.GetFileIcon(ext, GetIconSizeFromSize(tv.ImageList.ImageSize))!);
}
catch (ArgumentException ex)
{

View File

@ -3,7 +3,7 @@
<PropertyGroup>
<Description>Classes for user interface related items derived from the Vanara PInvoke libraries. Includes extensions for almost all common controls to give post Vista capabilities, WinForms controls (panel, commandlink, enhanced combo boxes, IPAddress, split button, trackbar and themed controls), shutdown/restart/lock control, buffered painting, resource files, access control editor, simplifed designer framework for Windows.Forms.</Description>
<AssemblyTitle>$(AssemblyName)</AssemblyTitle>
<TargetFrameworks>net45;net48;net6.0-windows;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net45;net48;net6.0;net7.0;net8.0-windows;netcoreapp3.1</TargetFrameworks>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyName>Vanara.Windows.Forms</AssemblyName>

View File

@ -34,7 +34,7 @@ public class ShellItemArray : IReadOnlyList<ShellItem>, IDisposable
/// <param name="pidls">The list of child item IDs for which the array is being created. This value can be <see langword="null"/>.</param>
public ShellItemArray(IShellFolder parent, IEnumerable<PIDL>? pidls)
{
var pa = pidls?.Cast<IntPtr>().ToArray();
var pa = pidls?.Select(p => (IntPtr)p).ToArray();
SHCreateShellItemArray(PIDL.Null, parent, (uint)(pa?.Length ?? 0), pa, out array).ThrowIfFailed();
}
@ -43,7 +43,7 @@ public class ShellItemArray : IReadOnlyList<ShellItem>, IDisposable
/// <param name="pidls">The list of child item IDs for which the array is being created. This value can be <see langword="null"/>.</param>
public ShellItemArray(PIDL pidlParent, IEnumerable<PIDL>? pidls)
{
var pa = pidls?.Cast<IntPtr>().ToArray();
var pa = pidls?.Select(p => (IntPtr)p).ToArray();
SHCreateShellItemArray(pidlParent, null, (uint)(pa?.Length ?? 0), pa, out array).ThrowIfFailed();
}

View File

@ -25,9 +25,11 @@ ChangeFilters, DialogStatus, ExecutableType, FileUsageType, FolderItemFilter, Li
<ItemGroup>
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" Condition=" $(TargetFramework.StartsWith('netcore')) " />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="7.0.0" Condition=" $(TargetFramework.StartsWith('netstandard')) " />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" Condition=" $(TargetFramework.StartsWith('net8')) " />
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0" Condition=" $(TargetFramework.StartsWith('netcore')) Or $(TargetFramework.StartsWith('netstandard')) Or $(TargetFramework.StartsWith('net5')) Or $(TargetFramework.StartsWith('net6')) Or $(TargetFramework.StartsWith('net7')) " />
<PackageReference Include="System.Security.Permissions" Version="6.0.0" Condition=" $(TargetFramework.StartsWith('netcore')) " />
<PackageReference Include="System.Security.Permissions" Version="7.0.0" Condition=" $(TargetFramework.StartsWith('net5')) Or $(TargetFramework.StartsWith('net6')) Or $(TargetFramework.StartsWith('net7')) " />
<PackageReference Include="System.Security.Permissions" Version="8.0.0" Condition=" $(TargetFramework.StartsWith('net8')) " />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Core\Vanara.Core.csproj" />

View File

@ -3,7 +3,7 @@
<PropertyGroup>
<Description>Classes for Windows Shell items derived from the Vanara PInvoke libraries. Includes shell items, files, icons, links, and taskbar lists.</Description>
<AssemblyTitle>$(AssemblyName)</AssemblyTitle>
<TargetFrameworks>net45;net48;net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net45;net48;net6.0;net7.0;net8.0-windows;netcoreapp3.1</TargetFrameworks>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF>