Add native nuget.

This commit is contained in:
2021-10-13 21:20:17 +01:00
parent 28c4cb6890
commit d8495ba2b8
3 changed files with 48 additions and 5 deletions

41
Aaru6.Checksums/Native.cs Normal file
View File

@@ -0,0 +1,41 @@
using System.Runtime.InteropServices;
namespace Aaru6.Checksums
{
public static class Native
{
static bool _checked;
static bool _supported;
public static bool IsSupported
{
get
{
if(_checked)
return _supported;
ulong version;
_checked = true;
try
{
version = get_acn_version();
}
catch
{
_supported = false;
return false;
}
// TODO: Check version compatibility
_supported = version >= 0x06000000;
return _supported;
}
}
[DllImport("libAaru.Checksums.Native", SetLastError = true)]
static extern ulong get_acn_version();
}
}