20 lines
632 B
C#
20 lines
632 B
C#
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;
|
|
}
|
|
}
|
|
} |