From b6180bcfc14885757b8a357b3256ae044f1b2793 Mon Sep 17 00:00:00 2001 From: dahall Date: Sun, 19 Jul 2020 08:32:02 -0600 Subject: [PATCH] BREAKING CHANGE: changed return values of all methods in IFileOperationProgressSink to HRESULT since this is a user implemented interface. --- PInvoke/Shell32/ShObjIdl.IFileDialog.cs | 48 ++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/PInvoke/Shell32/ShObjIdl.IFileDialog.cs b/PInvoke/Shell32/ShObjIdl.IFileDialog.cs index 9d784221..c7a736f6 100644 --- a/PInvoke/Shell32/ShObjIdl.IFileDialog.cs +++ b/PInvoke/Shell32/ShObjIdl.IFileDialog.cs @@ -972,14 +972,16 @@ namespace Vanara.PInvoke public interface IFileOperationProgressSink { /// Performs caller-implemented actions before any specific file operations are performed. - void StartOperations(); + [PreserveSig] + HRESULT StartOperations(); /// Performs caller-implemented actions after the last operation performed by the call to IFileOperation is complete. /// /// The return value of the final operation. Note that this is not the HRESULT returned by one of the IFileOperation methods, /// which simply queue the operations. Instead, this is the result of the actual operation, such as copy, delete, or move. /// - void FinishOperations(HRESULT hrResult); + [PreserveSig] + HRESULT FinishOperations(HRESULT hrResult); /// Performs caller-implemented actions before the rename process for each item begins. /// @@ -987,7 +989,8 @@ namespace Vanara.PInvoke /// /// Pointer to an IShellItem that specifies the item to be renamed. /// Pointer to the new display name of the item. This is a null-terminated, Unicode string. - void PreRenameItem(TRANSFER_SOURCE_FLAGS dwFlags, IShellItem psiItem, [MarshalAs(UnmanagedType.LPWStr)] string pszNewName); + [PreserveSig] + HRESULT PreRenameItem(TRANSFER_SOURCE_FLAGS dwFlags, IShellItem psiItem, [MarshalAs(UnmanagedType.LPWStr)] string pszNewName); /// Performs caller-implemented actions after the rename process for each item is complete. /// @@ -1004,7 +1007,8 @@ namespace Vanara.PInvoke /// rename operation. Instead, this is the result of the actual rename operation. /// /// Pointer to an IShellItem that represents the item with its new name. - void PostRenameItem(TRANSFER_SOURCE_FLAGS dwFlags, IShellItem psiItem, [MarshalAs(UnmanagedType.LPWStr)] string pszNewName, HRESULT hrRename, IShellItem psiNewlyCreated); + [PreserveSig] + HRESULT PostRenameItem(TRANSFER_SOURCE_FLAGS dwFlags, IShellItem psiItem, [MarshalAs(UnmanagedType.LPWStr)] string pszNewName, HRESULT hrRename, IShellItem psiNewlyCreated); /// Performs caller-implemented actions before the move process for each item begins. /// @@ -1018,7 +1022,8 @@ namespace Vanara.PInvoke /// Pointer to a new name for the item in its new location. This is a null-terminated Unicode string and can be NULL. If NULL, /// the name of the destination item is the same as the source. /// - void PreMoveItem(TRANSFER_SOURCE_FLAGS dwFlags, IShellItem psiItem, IShellItem psiDestinationFolder, [MarshalAs(UnmanagedType.LPWStr)] string pszNewName); + [PreserveSig] + HRESULT PreMoveItem(TRANSFER_SOURCE_FLAGS dwFlags, IShellItem psiItem, IShellItem psiDestinationFolder, [MarshalAs(UnmanagedType.LPWStr)] string pszNewName); /// Performs caller-implemented actions after the move process for each item is complete. /// @@ -1038,7 +1043,8 @@ namespace Vanara.PInvoke /// operation. Instead, this is the result of the actual move. /// /// Pointer to an IShellItem that represents the moved item in its new location. - void PostMoveItem(TRANSFER_SOURCE_FLAGS dwFlags, IShellItem psiItem, IShellItem psiDestinationFolder, [MarshalAs(UnmanagedType.LPWStr)] string pszNewName, HRESULT hrMove, IShellItem psiNewlyCreated); + [PreserveSig] + HRESULT PostMoveItem(TRANSFER_SOURCE_FLAGS dwFlags, IShellItem psiItem, IShellItem psiDestinationFolder, [MarshalAs(UnmanagedType.LPWStr)] string pszNewName, HRESULT hrMove, IShellItem psiNewlyCreated); /// Performs caller-implemented actions before the copy process for each item begins. /// @@ -1052,7 +1058,8 @@ namespace Vanara.PInvoke /// Pointer to a new name for the item after it has been copied. This is a null-terminated Unicode string and can be NULL. If /// NULL, the name of the destination item is the same as the source. /// - void PreCopyItem(TRANSFER_SOURCE_FLAGS dwFlags, IShellItem psiItem, IShellItem psiDestinationFolder, [MarshalAs(UnmanagedType.LPWStr)] string pszNewName); + [PreserveSig] + HRESULT PreCopyItem(TRANSFER_SOURCE_FLAGS dwFlags, IShellItem psiItem, IShellItem psiDestinationFolder, [MarshalAs(UnmanagedType.LPWStr)] string pszNewName); /// Performs caller-implemented actions after the copy process for each item is complete. /// @@ -1072,7 +1079,8 @@ namespace Vanara.PInvoke /// operation. Instead, this is the result of the actual copy. /// /// Pointer to an IShellItem that represents the new copy of the item. - void PostCopyItem(TRANSFER_SOURCE_FLAGS dwFlags, IShellItem psiItem, IShellItem psiDestinationFolder, [MarshalAs(UnmanagedType.LPWStr)] string pszNewName, + [PreserveSig] + HRESULT PostCopyItem(TRANSFER_SOURCE_FLAGS dwFlags, IShellItem psiItem, IShellItem psiDestinationFolder, [MarshalAs(UnmanagedType.LPWStr)] string pszNewName, HRESULT hrCopy, IShellItem psiNewlyCreated); /// Performs caller-implemented actions before the delete process for each item begins. @@ -1080,7 +1088,8 @@ namespace Vanara.PInvoke /// bitwise value that contains flags that control the operation. See TRANSFER_SOURCE_FLAGS for flag descriptions. /// /// Pointer to an IShellItem that specifies the item to be deleted. - void PreDeleteItem(TRANSFER_SOURCE_FLAGS dwFlags, IShellItem psiItem); + [PreserveSig] + HRESULT PreDeleteItem(TRANSFER_SOURCE_FLAGS dwFlags, IShellItem psiItem); /// Performs caller-implemented actions after the delete process for each item is complete. /// @@ -1096,7 +1105,8 @@ namespace Vanara.PInvoke /// A pointer to an IShellItem that specifies the deleted item, now in the Recycle Bin. If the item was fully deleted, this /// value is NULL. /// - void PostDeleteItem(TRANSFER_SOURCE_FLAGS dwFlags, IShellItem psiItem, HRESULT hrDelete, IShellItem psiNewlyCreated); + [PreserveSig] + HRESULT PostDeleteItem(TRANSFER_SOURCE_FLAGS dwFlags, IShellItem psiItem, HRESULT hrDelete, IShellItem psiNewlyCreated); /// Performs caller-implemented actions before the process to create a new item begins. /// @@ -1108,7 +1118,8 @@ namespace Vanara.PInvoke /// /// Pointer to the file name of the new item, for instance Newfile.txt. This is a null-terminated, Unicode string. /// - void PreNewItem(TRANSFER_SOURCE_FLAGS dwFlags, IShellItem psiDestinationFolder, [MarshalAs(UnmanagedType.LPWStr)] string pszNewName); + [PreserveSig] + HRESULT PreNewItem(TRANSFER_SOURCE_FLAGS dwFlags, IShellItem psiDestinationFolder, [MarshalAs(UnmanagedType.LPWStr)] string pszNewName); /// Performs caller-implemented actions after the new item is created. /// @@ -1147,25 +1158,30 @@ namespace Vanara.PInvoke /// creation operation. Instead, this is the result of the actual creation. /// /// Pointer to an IShellItem that represents the new item. - void PostNewItem(TRANSFER_SOURCE_FLAGS dwFlags, IShellItem psiDestinationFolder, [MarshalAs(UnmanagedType.LPWStr)] string pszNewName, + [PreserveSig] + HRESULT PostNewItem(TRANSFER_SOURCE_FLAGS dwFlags, IShellItem psiDestinationFolder, [MarshalAs(UnmanagedType.LPWStr)] string pszNewName, [MarshalAs(UnmanagedType.LPWStr)] string pszTemplateName, uint dwFileAttributes, HRESULT hrNew, IShellItem psiNewItem); /// Updates the progress. /// The i work total. /// The i work so far. - void UpdateProgress(uint iWorkTotal, uint iWorkSoFar); + [PreserveSig] + HRESULT UpdateProgress(uint iWorkTotal, uint iWorkSoFar); /// Resets the timer. [Obsolete("This method is not supported.")] - void ResetTimer(); + [PreserveSig] + HRESULT ResetTimer(); /// Pauses the timer. [Obsolete("This method is not supported.")] - void PauseTimer(); + [PreserveSig] + HRESULT PauseTimer(); /// Resumes the timer. [Obsolete("This method is not supported.")] - void ResumeTimer(); + [PreserveSig] + HRESULT ResumeTimer(); } ///