checkpoint

This commit is contained in:
2020-04-30 17:27:50 -04:00
parent 9bc522180d
commit 9aa367e9f5
16 changed files with 176 additions and 98 deletions

View File

@@ -7,7 +7,7 @@ namespace Foodsoft.Alpm
public sealed class Handle : IDisposable
{
private readonly SafeAlpmHandle _handle;
public Handle(string root, string dbpath)
{
_handle = alpm.alpm_initialize(root, dbpath, out var err);
@@ -39,13 +39,13 @@ namespace Foodsoft.Alpm
public Database RegisterSyncDB(string treename, SigLevel sigLevel = 0) =>
ToDatabase(alpm.alpm_register_syncdb(_handle, treename, sigLevel));
public void AddCacheDir(string dir) => API.WrapError(_handle, () => alpm.alpm_option_add_cachedir(_handle, dir));
public bool RemoveCacheDir(string dir) => API.WrapErrorBool(_handle, () => alpm.alpm_option_add_cachedir(_handle, dir));
public void AddCacheDir(string dir) => Detail.WrapError(_handle, () => alpm.alpm_option_add_cachedir(_handle, dir));
public bool RemoveCacheDir(string dir) => Detail.WrapErrorBool(_handle, () => alpm.alpm_option_add_cachedir(_handle, dir));
public ICollection<string> CacheDirs
{
get =>
EnumerableWrapper.Create(_handle, alpm.alpm_option_get_cachedirs);
set => Wrapper.SetStringCollection(value, _handle, (s) => alpm.alpm_option_add_cachedir(_handle, s));
set => Detail.SetStringCollection(value, _handle, (s) => alpm.alpm_option_add_cachedir(_handle, s));
}
public bool ShouldIgnorePackage(Package pkg) => alpm.alpm_pkg_should_ignore(_handle, pkg.Handle) == 0;