28 lines
761 B
C#
28 lines
761 B
C#
using System;
|
|
using System.Runtime.ConstrainedExecution;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace Foodsoft.Alpm
|
|
{
|
|
internal abstract class SafePackageHandle : SafeHandle
|
|
{
|
|
protected SafePackageHandle(SafeAlpmHandle safeAlpmHandle) : base(IntPtr.Zero, true)
|
|
{
|
|
SafeAlpmHandle = safeAlpmHandle;
|
|
}
|
|
|
|
internal SafeAlpmHandle SafeAlpmHandle
|
|
{
|
|
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
|
[PrePrepareMethod]
|
|
get;
|
|
}
|
|
|
|
public override bool IsInvalid
|
|
{
|
|
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
|
[PrePrepareMethod]
|
|
get => handle == IntPtr.Zero;
|
|
}
|
|
}
|
|
} |