checkpoint

This commit is contained in:
2020-04-29 13:10:17 -04:00
parent c1618deb83
commit 64f7dd4b7d
54 changed files with 294 additions and 263 deletions

33
Alpm/API.cs Normal file
View File

@@ -0,0 +1,33 @@
using System;
namespace Foodsoft.Alpm
{
public static class API
{
public static readonly string Version = alpm.alpm_version();
internal static void WrapError(SafeAlpmHandle h, Func<int> f)
{
var err = f();
if (err != 0)
{
throw new Exception(alpm.alpm_errno(h));
}
}
/*
* Handles the pattern where <0 is exceptional, but 1 is some "false"
* condition.
*/
internal static bool WrapErrorBool(SafeAlpmHandle h, Func<int> f)
{
var err = f();
if (err < 0)
{
throw new Exception(alpm.alpm_errno(h));
}
return err == 0;
}
}
}