mirror of https://github.com/dahall/Vanara.git
Added new property keys for Recycle Bin (#162)
parent
58ab52cba6
commit
3085b7d412
|
@ -6300,6 +6300,28 @@ namespace Vanara.PInvoke
|
|||
=> new PROPERTYKEY(new Guid("{1B5439E7-EBA1-4AF8-BDD7-7AF1D4549493}"), 100);
|
||||
}
|
||||
|
||||
/// <summary>Recycle Bin Properties</summary>
|
||||
public static class Recycle
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>Name: System.Recycle.DeletedFrom</para>
|
||||
/// <para>Description: Location (path) the file in the Recycle Bin was deleted from.</para>
|
||||
/// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
|
||||
/// <para>FormatID: {9b174b33-40ff-11d2-a27e-00c04fc30871}, 2</para>
|
||||
/// </summary>
|
||||
public static PROPERTYKEY DeletedFrom
|
||||
=> new PROPERTYKEY(new Guid("{9b174b33-40ff-11d2-a27e-00c04fc30871}"), 2);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Name: System.Recycle.DateDeleted</para>
|
||||
/// <para>Description: Location (path) the file in the Recycle Bin was deleted from.</para>
|
||||
/// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
|
||||
/// <para>FormatID: {9b174b33-40ff-11d2-a27e-00c04fc30871}, 3</para>
|
||||
/// </summary>
|
||||
public static PROPERTYKEY DateDeleted
|
||||
=> new PROPERTYKEY(new Guid("{9b174b33-40ff-11d2-a27e-00c04fc30871}"), 3);
|
||||
}
|
||||
|
||||
/// <summary>Search Properties</summary>
|
||||
public static class Search
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using Vanara.Extensions;
|
||||
using Vanara.InteropServices;
|
||||
using Vanara.PInvoke;
|
||||
using Vanara.PInvoke.Tests;
|
||||
|
@ -32,13 +33,15 @@ namespace Vanara.Windows.Shell.Tests
|
|||
|
||||
try
|
||||
{
|
||||
var startCount = RecycleBin.Count;
|
||||
// Delete files to bin
|
||||
RecycleBin.DeleteToRecycleBin(paths, true);
|
||||
// Get details
|
||||
TestContext.WriteLine($"cnt={RecycleBin.Count}; sz={RecycleBin.Size}");
|
||||
Assert.That(RecycleBin.Count, Is.EqualTo(startCount + paths.Count));
|
||||
// Restore files
|
||||
RecycleBin.Restore(paths.Select(p => RecycleBin.GetItemFromOriginalPath(p)));
|
||||
Assert.That(RecycleBin.Count, Is.EqualTo(0L));
|
||||
Assert.That(RecycleBin.Count, Is.EqualTo(startCount));
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue