checkpoint

This commit is contained in:
2020-04-30 20:40:52 -04:00
parent 9aa367e9f5
commit abba062f4f
28 changed files with 615 additions and 544 deletions

View File

@@ -1,18 +1,17 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace Foodsoft.Alpm
{
public abstract class Package : IPackageData
{
internal SafePackageHandle Handle { get; }
internal Package(SafePackageHandle handle)
{
Handle = handle;
}
internal SafePackageHandle Handle { get; }
public string Filename => alpm.alpm_pkg_get_filename(Handle);
public string Base => alpm.alpm_pkg_get_base(Handle);
public string Name => alpm.alpm_pkg_get_name(Handle);
@@ -30,16 +29,22 @@ namespace Foodsoft.Alpm
public long Size => alpm.alpm_pkg_get_size(Handle);
public long InstalledSize => alpm.alpm_pkg_get_isize(Handle);
public InstallReason InstallReason => alpm.alpm_pkg_get_reason(Handle);
public IEnumerable<string> Licenses =>
EnumerableWrapper.Create(Handle, alpm.alpm_pkg_get_licenses);
public IEnumerable<string> Groups => EnumerableWrapper.Create(Handle, alpm.alpm_pkg_get_groups);
public IEnumerable<Depend> Depends => EnumerableWrapper.CreateForDepend(Handle, alpm.alpm_pkg_get_depends);
public IEnumerable<Depend> OptDepends =>
EnumerableWrapper.CreateForDepend(Handle, alpm.alpm_pkg_get_optdepends);
public IEnumerable<Depend> CheckDepends =>
EnumerableWrapper.CreateForDepend(Handle, alpm.alpm_pkg_get_checkdepends);
public IEnumerable<Depend> MakeDepends =>
EnumerableWrapper.CreateForDepend(Handle, alpm.alpm_pkg_get_makedepends);
public IEnumerable<Depend> Conflicts => EnumerableWrapper.CreateForDepend(Handle, alpm.alpm_pkg_get_conflicts);
public IEnumerable<Depend> Provides => EnumerableWrapper.CreateForDepend(Handle, alpm.alpm_pkg_get_provides);
public IEnumerable<Depend> Replaces => EnumerableWrapper.CreateForDepend(Handle, alpm.alpm_pkg_get_replaces);
@@ -50,28 +55,23 @@ namespace Foodsoft.Alpm
public bool HasScriptlet => alpm.alpm_pkg_has_scriptlet(Handle);
public long DownloadSize => alpm.alpm_pkg_download_size(Handle);
public bool CheckMD5Sum()
{
throw new NotImplementedException();
}
public virtual Database? DB => null;
public IEnumerator<Package> ComputeRequiredBy()
{
throw new NotImplementedException();
}
public IEnumerator<Package> ComputeOptionalFor()
{
throw new NotImplementedException();
}
public void Dispose()
{
Handle.Dispose();
}
public IEnumerable<Package> ComputeRequiredBy()
{
throw new NotImplementedException();
}
public IEnumerable<Package> ComputeOptionalFor()
{
throw new NotImplementedException();
}
public static int VersionCompare(string v1, string v2)
{
return alpm.alpm_pkg_vercmp(v1, v2);