2021-10-13 21:20:17 +01:00
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
|
|
namespace Aaru6.Checksums
|
|
|
|
|
{
|
|
|
|
|
public static class Native
|
|
|
|
|
{
|
|
|
|
|
static bool _checked;
|
|
|
|
|
static bool _supported;
|
|
|
|
|
|
2021-10-13 21:50:11 +01:00
|
|
|
public static bool ForceManaged { get; set; }
|
|
|
|
|
|
2021-10-13 21:20:17 +01:00
|
|
|
public static bool IsSupported
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2021-10-13 21:50:11 +01:00
|
|
|
if(ForceManaged)
|
|
|
|
|
return false;
|
|
|
|
|
|
2021-10-13 21:20:17 +01:00
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|