18 internal readonly Handle _handle;
46 _handle =
new Handle(filePath);
56 GC.SuppressFinalize(
this);
59 SafeHandle IHasSafeHandle.Handle => _handle;
61 internal sealed class Handle : SafeHandleZeroOrMinusOneIsInvalid
63 internal Handle(
string filePath) : base(true)
65 DllHelper.ExecuteAndMapReturnCodes(() =>
66 CInterface.peak_icv_Calibration_Plate_CreateFromFile(out handle,
67 Utils.ToUtf8(filePath)));
70 protected override bool ReleaseHandle()
72 return CInterface.peak_icv_Calibration_Plate_Destroy(handle) ==
73 Backend.Types.peak_icv_status.PEAK_ICV_STATUS_SUCCESS;
77 private static class CInterface
79 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
80 public static extern Backend.Types.peak_icv_status peak_icv_Calibration_Plate_Destroy(
81 IntPtr calibration_plate_handle);
83 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
84 public static extern Backend.Types.peak_icv_status peak_icv_Calibration_Plate_CreateFromFile(
85 out IntPtr calibration_plate_handle,
byte[] filePath);