checkpoint

This commit is contained in:
2020-04-30 13:33:30 -04:00
parent 19a9fc06ba
commit 9bc522180d
21 changed files with 337 additions and 276 deletions

View File

@@ -41,20 +41,10 @@ namespace Foodsoft.Alpm
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));
private readonly struct CacheDirsImpl : ICollectionImpl<string>
{
private readonly SafeAlpmHandle _handle;
internal CacheDirsImpl(SafeAlpmHandle handle) => _handle = handle;
public SafeHandle Handle => _handle;
public IntPtr GetItems() => alpm.alpm_option_get_cachedirs(_handle);
public string PtrToItem(IntPtr p) => Marshal.PtrToStringUTF8(p)!;
}
public ICollection<string> CacheDirs
{
get =>
EnumerableWrapperEx<string>.Create(_handle, alpm.alpm_option_get_cachedirs, Marshal.PtrToStringUTF8!);
EnumerableWrapper.Create(_handle, alpm.alpm_option_get_cachedirs);
set => Wrapper.SetStringCollection(value, _handle, (s) => alpm.alpm_option_add_cachedir(_handle, s));
}