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,6 +7,16 @@ namespace Foodsoft.Alpm
{
public sealed class Database : IDisposable
{
[Flags]
public enum UsageFlags
{
Sync = 1,
Search = (1 << 1),
Install = (1 << 2),
Upgrade = (1 << 3),
All = (1 << 4) - 1,
}
private readonly SafeDatabaseHandle _handle;
internal Database(SafeDatabaseHandle handle) => _handle = handle;
@@ -14,10 +24,10 @@ namespace Foodsoft.Alpm
public void Unregister() => _handle.Close();
public void AddServer(string url) =>
API.WrapError(_handle.SafeAlpmHandle, () => alpm.alpm_db_add_server(_handle, url));
Detail.WrapError(_handle.SafeAlpmHandle, () => alpm.alpm_db_add_server(_handle, url));
public bool RemoveServer(string url) =>
API.WrapErrorBool(_handle.SafeAlpmHandle, () => alpm.alpm_db_remove_server(_handle, url));
Detail.WrapErrorBool(_handle.SafeAlpmHandle, () => alpm.alpm_db_remove_server(_handle, url));
// FIXME: This is "bug correct", but probably dumb to do it this way, instead just call add_server
// like all the stuff in handle.
@@ -85,7 +95,7 @@ namespace Foodsoft.Alpm
return new CachePackage(new SafeCachePackageHandle(pkgPtr, _handle), this);
}
public CachePackageList CachePackageCache
public CachePackageList PackageCache
{
get
{
@@ -96,6 +106,13 @@ namespace Foodsoft.Alpm
}
}
public CachePackageList Search()
{
}
public UsageFlags Usage => Detail.WrapError<UsageFlags, SafeDatabaseHandle>(_handle.SafeAlpmHandle, _handle, alpm.alpm_db_get_usage);
public void Dispose()
{
_handle.Dispose();