Rxmxnx.PInvoke.Extensions 0.1.6

There is a newer version of this package available.
See the version list below for details.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Rxmxnx.PInvoke.Extensions --version 0.1.6                
NuGet\Install-Package Rxmxnx.PInvoke.Extensions -Version 0.1.6                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rxmxnx.PInvoke.Extensions" Version="0.1.6" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Rxmxnx.PInvoke.Extensions --version 0.1.6                
#r "nuget: Rxmxnx.PInvoke.Extensions, 0.1.6"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Rxmxnx.PInvoke.Extensions as a Cake Addin
#addin nuget:?package=Rxmxnx.PInvoke.Extensions&version=0.1.6

// Install Rxmxnx.PInvoke.Extensions as a Cake Tool
#tool nuget:?package=Rxmxnx.PInvoke.Extensions&version=0.1.6                

Quality Gate Status Bugs Coverage Lines of Code Reliability Rating Maintainability Rating Security Rating NuGet

Description

Provides a set of extensions and utilites which facilitates the exchange of data from and to .NET P/Invoke methods (or UnmanagedCallersOnly using NativeAOT) avoiding use of both native pointers and unsafe context.

Binary Extensions

Provides a set of extensions for basic operations with Byte instances.

Byte

  • AsHexString() Gets the String representation of byte value.

Byte[]

  • AsValue<T>() Gets a value of generic type which length must match to array lenght.
  • AsHexString() Gets the String representation of binary data into the array.
  • ConcatUtf8() Concatenates the members of a collection of UTF-8 texts.
  • ConcatUtf8Async() Concatenates the members of a collection of UTF-8 texts.

IEnumerable<String>

  • ConcatUtf8() Concatenates the members of a collection of String.

MemoryBlockExtensions

Provides a set of extensions for basic operations with Span<T> and ReadOnlySpan<T> instances.

Span<T>

  • AsIntPtr<T>() Gets the signed pointer to referenced memory.
  • AsUIntPtr<T>() Gets the unsigned pointer to referenced memory.

ReadOnlySpan<T>

  • AsIntPtr<T>() Gets the signed pointer to referenced memory.
  • AsUIntPtr<T>() Gets the unsigned pointer to referenced memory.

PointerExtensions

Provides a set of extensions for basic operations with both signed and unsigned pointers.

IntPtr

  • IsZero() Indicates whether the pointer is a null memory reference.
  • AsUIntPtr() Gets the memory reference as an unsigned pointer.
  • AsString(Int32 length = 0) Gets a String instance taking the memory reference as the UTF-16 text starting point.
  • AsReadOnlySpan<T>(Int32 length) Gets a ReadOnlySpan<T> instance from memory reference.
  • AsDelegate<T>() Gets a generic delegate from from memory reference.
  • AsReference<T>() Gets a managed reference to a generic unmanaged value from a memory reference.

UIntPtr

  • IsZero() Indicates whether the pointer is a null memory reference.
  • AsIntPtr() Gets the memory reference as an signed pointer.
  • AsString(Int32 length = 0) Gets a String instance taking the memory reference as the UTF-16 text starting point.
  • AsReadOnlySpan<T>(Int32 length) Gets a ReadOnlySpan<T> instance from memory reference.
  • AsDelegate<T>() Gets a generic delegate from from memory reference.
  • AsReference<T>() Gets a managed reference to a generic unmanaged value from a memory reference.

ReferenceExtensions

ref T

  • AsIntPtr<T>() Gets a signed pointer to referenced memory by generic managed reference.
  • AsUIntPtr<T>() Gets a unsigned pointer to referenced memory by generic managed reference.
  • AsReferenceOf<TSource, TDestination>() Creates a memory reference to a TDestination generic type value from an exising memory reference to a TSource generic type value.

StringExtensions

String

  • AsUtf8Span() Encodes the UTF-16 text using the UTF-8 charset and retrieves the read-only span which references to the UTF-8 text.
  • AsUtf8() Encodes the UTF-16 text using the UTF-8 charset and retrieves the Byte array with UTF-8 text.

IEnumerable<String>

  • ConcatUtf8() Concatenates the members of a collection of String.
  • ConcatUtf8Async() Concatenates the members of a collection of String.

IEnumerable<CString>

  • Concat() Concatenates the members of a collection of CString.
  • ConcatAsync() Concatenates the members of a collection of CString.

UnmanagedValueExtensions

T

  • AsBytes<T>() Gets the binary data from unmanaged value.
  • AsValues<TSource, TDestination>() Creates an array of TDestination generic type from an array of TSource generic type.

CString

Represents text as a sequence of UTF-8 code units.

  • Empty Represents the empty UTF-8 string. This field is read-only.
  • IsNullOrEmpty(CString value) Indicates whether the specified CString is null or an empty UTF-8 text.
  • GetBytes(CString value) Retrieves the internal binary data from a given <see cref="CString"/>.

CStringSequence

Represents a sequence of null-terminated UTF-8 texts.

  • AsSpan Retrieves the buffer as an ReadOnlySpan<Char> instance and creates a CString array which represents text sequence. The output CString array will remain valid only as long as returned buffer span is on live.

InputValue

Supports a value type that can be referenced.

  • CreateInput<TValue>(in TValue instance) Gets a IReferenceable<TValue> object from a generic value.
  • CreateInput<TValue?>(in TValue? instance) Gets a IReferenceable<TValue> object from a generic nullable value.
  • CreateReference<TValue>(in TValue instance = default) Gets a IMutableReference<TValue> object from a generic value.
  • CreateReference<TValue?>(in TValue? instance = default) Gets a IMutableReference<TValue> object from a generic nullable value.

IReferenceable<TValue>

  • GetInstanceValue<TValue>() Gets the internal instance value.

IReferenceable<TValue?>

  • GetInstanceValue<TValue?>() Gets the internal instance nullable value.

NativeUtilities

Provides a set of utilities for exchange data within the P/Invoke context.

  • SizeOf<T>() Retrieves the size of the generic structure type.
  • LoadNativeLib(String libraryName, DllImportSearchPath? searchPath = default) Loads a native library.
  • LoadNativeLib(String libraryName, ref EventHandler unloadEvent, DllImportSearchPath? searchPath = default) Loads a native library and appends its unloading to given EventHandler delegate.
  • GetNativeMethod<T>(IntPtr handle, String name) Gets a generic delegate which points to a exported symbol into native library.
  • AsBytes<T>(in T value) Gets the binary data of an input generic value.

TextUtilites

Provides a set of utilities for texts.

  • Join(CString, params CString[]) / Join(Byte, params CString[]) Concatenates an array of CString, using the specified separator between each member.

  • Join(CString, IEnumerable<CString>) / Join(Byte, IEnumerable<CString>) Concatenates the members of a collection of CString, using the specified separator between each member.

  • JoinUtf8(CString, params String[]) / JoinUtf8(Char, params String[]) Concatenates an array of strings, using the specified separator between each member.

  • JoinUtf8(String, IEnumerable<String>) / JoinUtf8(Char, IEnumerable<String>) Concatenates the members of a collection of String, using the specified separator between each member.

  • JoinUtf8(ReadOnlySpan<Byte>, params Byte[][]) / JoinUtf8(Byte, params Byte[][]) Concatenates an array of UTF-8 texts, using the specified separator between each member.

  • JoinUtf8(ReadOnlySpan<Byte>, IEnumerable<Byte[]>) / JoinUtf8(Byte, IEnumerable<Byte>) Concatenates the members of a collection of UTF-8 texts, using the specified separator between each member.

  • JoinAsync(CString, params CString[]) / JoinAsync(Byte, params CString[]) Concatenates an array of CString, using the specified separator between each member.

  • JoinAsync(CString, IEnumerable<CString>) / JoinAsync(Byte, IEnumerable<String>) Concatenates the members of a collection of CString, using the specified separator between each member.

  • JoinUtf8Async(String, params String[]) / JoinUtf8Async(Char, params String[]) Concatenates an array of strings, using the specified separator between each member.

  • JoinUtf8Async(String, IEnumerable<String>) / JoinUtf8Async(Char, IEnumerable<String>) Concatenates the members of a collection of String, using the specified separator between each member.

  • Concat(CString, params CString[]) Concatenates all CString parameters passed to this function.

  • ConcatUtf8(String, params String[]) Concatenates all text parameters passed to this function.

  • ConcatUtf8(Byte[], params Byte[][]) Concatenates all UTF-8 text parameters passed to this function.

  • ConcatAsync(CString, params CString[]) Concatenates all CString parameters passed to this function.

  • ConcatUtf8Async(String, params String[]) Concatenates all text parameters passed to this function.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net5.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Rxmxnx.PInvoke.Extensions:

Package Downloads
Rxmxnx.JNetInterface.Core

Rxmxnx.JNetInterface.Core provides an API to use JNI in a high level .NET code.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.5.1 150 9/25/2024
1.5.0 351 8/27/2024
1.2.3 337 6/14/2024
1.2.2 411 5/9/2024
1.2.1 449 1/29/2024
1.2.0 128 1/16/2024
1.1.0 199 12/2/2023
1.0.1.2 230 7/4/2023
1.0.1.1 145 6/23/2023
1.0.1 203 6/13/2023
0.3.3 3,005 11/27/2022 0.3.3 is deprecated because it is no longer maintained.