checkpoint for real

This commit is contained in:
2020-04-27 12:34:56 -04:00
parent 6ed92261ec
commit c1618deb83
31 changed files with 1429 additions and 626 deletions

20
SafePackageHandle.cs Normal file
View File

@@ -0,0 +1,20 @@
using System;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
namespace Foodsoft.Alpm
{
internal class SafePackageHandle : SafeHandle
{
protected SafePackageHandle() : base(IntPtr.Zero, true) { }
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail), PrePrepareMethod]
protected override bool ReleaseHandle() => alpm.alpm_pkg_free(handle) == 0;
public override bool IsInvalid
{
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success), PrePrepareMethod]
get => handle == IntPtr.Zero;
}
}
}