Added nullability to IMAPI

nullableenabled
David Hall 2023-10-05 19:19:05 -06:00
parent 2226f6c44c
commit 1d349adada
2 changed files with 30 additions and 29 deletions

View File

@ -62,7 +62,7 @@ public static partial class IMAPI
{
/// <summary>Initializes a new instance of the <see cref="DDiscFormat2DataEventsSink"/> class.</summary>
/// <param name="onUpdate">The update.</param>
public DDiscFormat2DataEventsSink(Action<IDiscFormat2Data, IDiscFormat2DataEventArgs> onUpdate)
public DDiscFormat2DataEventsSink(Action<IDiscFormat2Data, IDiscFormat2DataEventArgs>? onUpdate)
{
if (onUpdate is not null) Update += onUpdate;
}
@ -90,7 +90,7 @@ public static partial class IMAPI
/// </list>
/// <para>To stop the write process, call the IDiscFormat2Data::CancelWrite method.</para>
/// </remarks>
public event Action<IDiscFormat2Data, IDiscFormat2DataEventArgs> Update;
public event Action<IDiscFormat2Data, IDiscFormat2DataEventArgs>? Update;
void DDiscFormat2DataEvents.Update(IDiscFormat2Data @object, IDiscFormat2DataEventArgs progress) => Update?.Invoke(@object, progress);
}
@ -130,7 +130,7 @@ public static partial class IMAPI
{
/// <summary>Initializes a new instance of the <see cref="DDiscFormat2EraseEventsSink"/> class.</summary>
/// <param name="onUpdate">The on update.</param>
public DDiscFormat2EraseEventsSink(Action<IDiscFormat2Erase, int, int> onUpdate)
public DDiscFormat2EraseEventsSink(Action<IDiscFormat2Erase, int, int>? onUpdate)
{
if (onUpdate is not null) Update += onUpdate;
}
@ -144,7 +144,7 @@ public static partial class IMAPI
/// can affect the projected duration of the erasure.
/// </para>
/// </remarks>
public event Action<IDiscFormat2Erase, int, int> Update;
public event Action<IDiscFormat2Erase, int, int>? Update;
void DDiscFormat2EraseEvents.Update(IDiscFormat2Erase @object, int elapsedSeconds, int estimatedTotalSeconds) => Update?.Invoke(@object, elapsedSeconds, estimatedTotalSeconds);
}
@ -185,7 +185,7 @@ public static partial class IMAPI
{
/// <summary>Initializes a new instance of the <see cref="DDiscFormat2RawCDEventsSink"/> class.</summary>
/// <param name="onUpdate">The on update.</param>
public DDiscFormat2RawCDEventsSink(Action<IDiscFormat2RawCD, IDiscFormat2RawCDEventArgs> onUpdate)
public DDiscFormat2RawCDEventsSink(Action<IDiscFormat2RawCD, IDiscFormat2RawCDEventArgs>? onUpdate)
{
if (onUpdate is not null) Update += onUpdate;
}
@ -197,7 +197,7 @@ public static partial class IMAPI
/// </para>
/// <para>To stop the write process, call the IDiscFormat2RawCD::CancelWrite method.</para>
/// </remarks>
public event Action<IDiscFormat2RawCD, IDiscFormat2RawCDEventArgs> Update;
public event Action<IDiscFormat2RawCD, IDiscFormat2RawCDEventArgs>? Update;
void DDiscFormat2RawCDEvents.Update(IDiscFormat2RawCD @object, IDiscFormat2RawCDEventArgs progress) => Update?.Invoke(@object, progress);
}
@ -236,7 +236,7 @@ public static partial class IMAPI
{
/// <summary>Initializes a new instance of the <see cref="DDiscFormat2TrackAtOnceEventsSink"/> class.</summary>
/// <param name="onUpdate">The on update.</param>
public DDiscFormat2TrackAtOnceEventsSink(Action<IDiscFormat2TrackAtOnce, IDiscFormat2TrackAtOnceEventArgs> onUpdate)
public DDiscFormat2TrackAtOnceEventsSink(Action<IDiscFormat2TrackAtOnce, IDiscFormat2TrackAtOnceEventArgs>? onUpdate)
{
if (onUpdate is not null) Update += onUpdate;
}
@ -246,7 +246,7 @@ public static partial class IMAPI
/// <para>Notifications are sent in response to calling the IDiscFormat2TrackAtOnce::AddAudioTrack method.</para>
/// <para>To stop the write process, call the IDiscFormat2TrackAtOnce::CancelAddTrack method.</para>
/// </remarks>
public event Action<IDiscFormat2TrackAtOnce, IDiscFormat2TrackAtOnceEventArgs> Update;
public event Action<IDiscFormat2TrackAtOnce, IDiscFormat2TrackAtOnceEventArgs>? Update;
void DDiscFormat2TrackAtOnceEvents.Update(IDiscFormat2TrackAtOnce @object, IDiscFormat2TrackAtOnceEventArgs progress) => Update?.Invoke(@object, progress);
}
@ -295,17 +295,17 @@ public static partial class IMAPI
/// <summary>Initializes a new instance of the <see cref="DDiscMaster2EventsSink"/> class.</summary>
/// <param name="onAdded">The delegate to call when a device is added.</param>
/// <param name="onRemoved">The delegate to call when a device is removed.</param>
public DDiscMaster2EventsSink(Action<IDiscMaster2, string> onAdded, Action<IDiscMaster2, string> onRemoved)
public DDiscMaster2EventsSink(Action<IDiscMaster2, string>? onAdded, Action<IDiscMaster2, string>? onRemoved)
{
if (onAdded is not null) NotifyDeviceAdded += onAdded;
if (onRemoved is not null) NotifyDeviceRemoved += onRemoved;
}
/// <summary>Receives notification when an optical media device is added to the computer.</summary>
public event Action<IDiscMaster2, string> NotifyDeviceAdded;
public event Action<IDiscMaster2, string>? NotifyDeviceAdded;
/// <summary>Receives notification when an optical media device is removed from the computer.</summary>
public event Action<IDiscMaster2, string> NotifyDeviceRemoved;
public event Action<IDiscMaster2, string>? NotifyDeviceRemoved;
void DDiscMaster2Events.NotifyDeviceAdded(IDiscMaster2 @object, string uniqueId) => NotifyDeviceAdded?.Invoke(@object, uniqueId);
void DDiscMaster2Events.NotifyDeviceRemoved(IDiscMaster2 @object, string uniqueId) => NotifyDeviceRemoved?.Invoke(@object, uniqueId);
@ -357,7 +357,7 @@ public static partial class IMAPI
{
/// <summary>Initializes a new instance of the <see cref="DWriteEngine2EventsSink"/> class.</summary>
/// <param name="onUpdate">The on update.</param>
public DWriteEngine2EventsSink(Action<IWriteEngine2, IWriteEngine2EventArgs> onUpdate)
public DWriteEngine2EventsSink(Action<IWriteEngine2, IWriteEngine2EventArgs>? onUpdate)
{
if (onUpdate is not null) Update += onUpdate;
}
@ -379,7 +379,7 @@ public static partial class IMAPI
/// </list>
/// <para>To stop the write process, call the IWriteEngine2::CancelWrite method.</para>
/// </remarks>
public event Action<IWriteEngine2, IWriteEngine2EventArgs> Update;
public event Action<IWriteEngine2, IWriteEngine2EventArgs>? Update;
void DWriteEngine2Events.Update(IWriteEngine2 @object, IWriteEngine2EventArgs progress) => Update?.Invoke(@object, progress);
}
@ -3772,7 +3772,7 @@ public static partial class IMAPI
// https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagecreator-addsubcoderwgenerator HRESULT
// AddSubcodeRWGenerator( IStream *subcode );
[DispId(0x203)]
void AddSubcodeRWGenerator(IStream subcode);
void AddSubcodeRWGenerator(IStream? subcode);
/// <summary>Gets or sets the value that defines the type of image file that will be generated.</summary>
/// <value>An IMAPI_FORMAT2_RAW_CD_DATA_SECTOR_TYPE enumeration that defines the type of image file.</value>
@ -4056,7 +4056,7 @@ public static partial class IMAPI
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagetrackinfo-put_isrc HRESULT put_ISRC( BSTR value );
[DispId(0x104)]
bool ISRC { set; [return: MarshalAs(UnmanagedType.BStr)] get; }
string? ISRC { set; [return: MarshalAs(UnmanagedType.BStr)] get; }
/// <summary>
/// Sets the digital audio copy "Allowed" bit to one of three values on the resulting media. Please see the

View File

@ -1,3 +1,4 @@
#pragma warning disable IDE1006 // Naming Styles
using System.Collections;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices.ComTypes;
@ -172,7 +173,7 @@ public static partial class IMAPI
{
/// <summary>Initializes a new instance of the <see cref="DFileSystemImageEventsSink"/> class.</summary>
/// <param name="onUpdate">The delegate to assign to the <see cref="Update"/> event.</param>
public DFileSystemImageEventsSink(Action<IFileSystemImage, string, long, long> onUpdate)
public DFileSystemImageEventsSink(Action<IFileSystemImage, string, long, long>? onUpdate)
{
if (onUpdate is not null) Update += onUpdate;
}
@ -220,7 +221,7 @@ public static partial class IMAPI
/// </item>
/// </list>
/// </remarks>
public event Action<IFileSystemImage, string, long, long> Update;
public event Action<IFileSystemImage, string, long, long>? Update;
void DFileSystemImageEvents.Update(IFileSystemImage @object, string currentFile, long copiedSectors, long totalSectors) => Update?.Invoke(@object, currentFile, copiedSectors, totalSectors);
}
@ -290,7 +291,7 @@ public static partial class IMAPI
{
/// <summary>Initializes a new instance of the <see cref="DFileSystemImageImportEventsSink"/> class.</summary>
/// <param name="onUpdateImport">The delegate to call on import update.</param>
public DFileSystemImageImportEventsSink(Action<IFileSystemImage, FsiFileSystems, string, long, long, long, long> onUpdateImport)
public DFileSystemImageImportEventsSink(Action<IFileSystemImage, FsiFileSystems, string, long, long, long, long>? onUpdateImport)
{
if (onUpdateImport is not null) UpdateImport += onUpdateImport;
}
@ -323,7 +324,7 @@ public static partial class IMAPI
/// <para>Import notifications are generated only for files and directories, and not for associated named streams.</para>
/// <para>If the currentItem is a directory, it contains a back slash '' at the end.</para>
/// </remarks>
public event Action<IFileSystemImage, FsiFileSystems, string, long, long, long, long> UpdateImport;
public event Action<IFileSystemImage, FsiFileSystems, string, long, long, long, long>? UpdateImport;
void DFileSystemImageImportEvents.UpdateImport(IFileSystemImage @object, FsiFileSystems fileSystem, string currentItem, long importedDirectoryItems, long totalDirectoryItems, long importedFileItems, long totalFileItems) =>
UpdateImport?.Invoke(@object, fileSystem, currentItem, importedDirectoryItems, totalDirectoryItems, importedFileItems, totalFileItems);
@ -689,14 +690,14 @@ public static partial class IMAPI
// https://docs.microsoft.com/en-us/windows/win32/api/imapi2fs/nf-imapi2fs-ifilesystemimage-get_importedvolumename HRESULT
// get_ImportedVolumeName( BSTR *pVal );
[DispId(5)]
string ImportedVolumeName { [return: MarshalAs(UnmanagedType.BStr)] get; }
string? ImportedVolumeName { [return: MarshalAs(UnmanagedType.BStr)] get; }
/// <summary>Retrieves the boot image that you want to add to the file system image.</summary>
/// <value>An IBootOptions interface of the boot image to add to the disc. Is <c>NULL</c> if a boot image has not been specified.</value>
// https://docs.microsoft.com/en-us/windows/win32/api/imapi2fs/nf-imapi2fs-ifilesystemimage-get_bootimageoptions HRESULT
// get_BootImageOptions( IBootOptions **pVal );
[DispId(6)]
IBootOptions BootImageOptions { [return: MarshalAs(UnmanagedType.Interface)] get; set; }
IBootOptions? BootImageOptions { [return: MarshalAs(UnmanagedType.Interface)] get; set; }
/// <summary>Retrieves the number of files in the file system image.</summary>
/// <value>Number of files in the file system image.</value>
@ -908,7 +909,7 @@ public static partial class IMAPI
// https://docs.microsoft.com/en-us/windows/win32/api/imapi2fs/nf-imapi2fs-ifilesystemimage-identifyfilesystemsondisc HRESULT
// IdentifyFileSystemsOnDisc( IDiscRecorder2 *discRecorder, FsiFileSystems *fileSystems );
[DispId(19)]
FsiFileSystems IdentifyFileSystemsOnDisc(IDiscRecorder2 discRecorder);
FsiFileSystems IdentifyFileSystemsOnDisc(IDiscRecorder2? discRecorder);
/// <summary>Retrieves the file system to import by default.</summary>
/// <param name="fileSystems">One or more file system values. For possible values, see the FsiFileSystems enumeration type.</param>
@ -1206,14 +1207,14 @@ public static partial class IMAPI
// https://docs.microsoft.com/en-us/windows/win32/api/imapi2fs/nf-imapi2fs-ifilesystemimage-get_importedvolumename HRESULT
// get_ImportedVolumeName( BSTR *pVal );
[DispId(5)]
new string ImportedVolumeName { [return: MarshalAs(UnmanagedType.BStr)] get; }
new string? ImportedVolumeName { [return: MarshalAs(UnmanagedType.BStr)] get; }
/// <summary>Retrieves the boot image that you want to add to the file system image.</summary>
/// <value>An IBootOptions interface of the boot image to add to the disc. Is <c>NULL</c> if a boot image has not been specified.</value>
// https://docs.microsoft.com/en-us/windows/win32/api/imapi2fs/nf-imapi2fs-ifilesystemimage-get_bootimageoptions HRESULT
// get_BootImageOptions( IBootOptions **pVal );
[DispId(6)]
new IBootOptions BootImageOptions { [return: MarshalAs(UnmanagedType.Interface)] get; set; }
new IBootOptions? BootImageOptions { [return: MarshalAs(UnmanagedType.Interface)] get; set; }
/// <summary>Retrieves the number of files in the file system image.</summary>
/// <value>Number of files in the file system image.</value>
@ -1425,7 +1426,7 @@ public static partial class IMAPI
// https://docs.microsoft.com/en-us/windows/win32/api/imapi2fs/nf-imapi2fs-ifilesystemimage-identifyfilesystemsondisc HRESULT
// IdentifyFileSystemsOnDisc( IDiscRecorder2 *discRecorder, FsiFileSystems *fileSystems );
[DispId(19)]
new FsiFileSystems IdentifyFileSystemsOnDisc(IDiscRecorder2 discRecorder);
new FsiFileSystems IdentifyFileSystemsOnDisc(IDiscRecorder2? discRecorder);
/// <summary>Retrieves the file system to import by default.</summary>
/// <param name="fileSystems">One or more file system values. For possible values, see the FsiFileSystems enumeration type.</param>
@ -1742,14 +1743,14 @@ public static partial class IMAPI
// https://docs.microsoft.com/en-us/windows/win32/api/imapi2fs/nf-imapi2fs-ifilesystemimage-get_importedvolumename HRESULT
// get_ImportedVolumeName( BSTR *pVal );
[DispId(5)]
new string ImportedVolumeName { [return: MarshalAs(UnmanagedType.BStr)] get; }
new string? ImportedVolumeName { [return: MarshalAs(UnmanagedType.BStr)] get; }
/// <summary>Retrieves the boot image that you want to add to the file system image.</summary>
/// <value>An IBootOptions interface of the boot image to add to the disc. Is <c>NULL</c> if a boot image has not been specified.</value>
// https://docs.microsoft.com/en-us/windows/win32/api/imapi2fs/nf-imapi2fs-ifilesystemimage-get_bootimageoptions HRESULT
// get_BootImageOptions( IBootOptions **pVal );
[DispId(6)]
new IBootOptions BootImageOptions { [return: MarshalAs(UnmanagedType.Interface)] get; set; }
new IBootOptions? BootImageOptions { [return: MarshalAs(UnmanagedType.Interface)] get; set; }
/// <summary>Retrieves the number of files in the file system image.</summary>
/// <value>Number of files in the file system image.</value>
@ -1961,7 +1962,7 @@ public static partial class IMAPI
// https://docs.microsoft.com/en-us/windows/win32/api/imapi2fs/nf-imapi2fs-ifilesystemimage-identifyfilesystemsondisc HRESULT
// IdentifyFileSystemsOnDisc( IDiscRecorder2 *discRecorder, FsiFileSystems *fileSystems );
[DispId(19)]
new FsiFileSystems IdentifyFileSystemsOnDisc(IDiscRecorder2 discRecorder);
new FsiFileSystems IdentifyFileSystemsOnDisc(IDiscRecorder2? discRecorder);
/// <summary>Retrieves the file system to import by default.</summary>
/// <param name="fileSystems">One or more file system values. For possible values, see the FsiFileSystems enumeration type.</param>
@ -3540,7 +3541,7 @@ public static partial class IMAPI
// https://docs.microsoft.com/en-us/windows/win32/api/imapi2fs/nf-imapi2fs-ifsinamedstreams-get_item HRESULT get_Item( LONG
// index, IFsiFileItem2 **item );
[DispId(0)]
IFsiFileItem2 this[int index] { [return: MarshalAs(UnmanagedType.Interface)] get; }
IFsiFileItem2? this[int index] { [return: MarshalAs(UnmanagedType.Interface)] get; }
/// <summary>Returns the number of the named streams associated with a file in the file system image.</summary>
/// <value>Pointer to a value indicating the total number of named streams in the collection.</value>