using System; using Vanara.PInvoke; using static Vanara.PInvoke.Shell32; namespace Vanara.Windows.Shell { public partial class ShellFileOperations { /// Arguments supplied to the event. /// public class ShellFileNewOpEventArgs : ShellFileOpEventArgs { internal ShellFileNewOpEventArgs(TRANSFER_SOURCE_FLAGS flags, IShellItem source, IShellItem folder, IShellItem dest, string name, HRESULT hr, string templ, uint attr) : base(flags, source, folder, dest, name, hr) { TemplateName = templ; FileAttributes = (System.IO.FileAttributes)attr; } /// Gets the name of the template. /// The name of the template. public string TemplateName { get; protected set; } /// Gets the file attributes. /// The file attributes. public System.IO.FileAttributes FileAttributes { get; protected set; } } /// /// Arguments supplied to events from . Depending on the event, some properties may not be set. /// /// public class ShellFileOpEventArgs : EventArgs { internal ShellFileOpEventArgs(TRANSFER_SOURCE_FLAGS flags, IShellItem source, IShellItem folder = null, IShellItem dest = null, string name = null, HRESULT hr = default) { Flags = (TransferFlags)flags; if (source != null) try { SourceItem = ShellItem.Open(source); } catch {} if (folder != null) try { DestFolder = ShellItem.Open(folder); } catch {} if (dest != null) try { DestItem = ShellItem.Open(dest); } catch {} Name = name; Result = hr; } /// Gets the destination folder. /// The destination folder. public ShellItem DestFolder { get; protected set; } /// Gets the destination item. /// The destination item. public ShellItem DestItem { get; protected set; } /// Gets the tranfer flag values. /// The flags. public TransferFlags Flags { get; protected set; } /// Gets the name of the item. /// The item name. public string Name { get; protected set; } /// Gets the result of the operation. /// The result. public HRESULT Result { get; protected set; } /// Gets the source item. /// The source item. public ShellItem SourceItem { get; protected set; } /// Returns a that represents this instance. /// A that represents this instance. public override string ToString() => $"HR:{Result};Src:{SourceItem};DFld:{DestFolder};Dst:{DestItem};Name:{Name}"; } } }