Move to file scoped namespaces.

This commit is contained in:
2022-03-06 13:29:38 +00:00
parent b6c3a54955
commit 0bc819feab
1322 changed files with 268651 additions and 270003 deletions

View File

@@ -32,52 +32,51 @@
using System.Runtime.InteropServices;
namespace Aaru.Compression
namespace Aaru.Compression;
public static class Native
{
public static class Native
static bool _checked;
static bool _supported;
/// <summary>Set to return native as never supported</summary>
public static bool ForceManaged { get; set; }
/// <summary>
/// If set to <c>true</c> the native library was found and loaded correctly and its reported version is
/// compatible.
/// </summary>
public static bool IsSupported
{
static bool _checked;
static bool _supported;
/// <summary>Set to return native as never supported</summary>
public static bool ForceManaged { get; set; }
/// <summary>
/// If set to <c>true</c> the native library was found and loaded correctly and its reported version is
/// compatible.
/// </summary>
public static bool IsSupported
get
{
get
{
if(ForceManaged)
return false;
if(_checked)
return _supported;
ulong version;
_checked = true;
try
{
version = AARU_get_acn_version();
}
catch
{
_supported = false;
return false;
}
// TODO: Check version compatibility
_supported = version >= 0x06000000;
if(ForceManaged)
return false;
if(_checked)
return _supported;
}
}
[DllImport("libAaru.Compression.Native", SetLastError = true)]
static extern ulong AARU_get_acn_version();
ulong version;
_checked = true;
try
{
version = AARU_get_acn_version();
}
catch
{
_supported = false;
return false;
}
// TODO: Check version compatibility
_supported = version >= 0x06000000;
return _supported;
}
}
[DllImport("libAaru.Compression.Native", SetLastError = true)]
static extern ulong AARU_get_acn_version();
}