Skip to content

Commit dc05bf4

Browse files
committed
Update ShellNewItem
1 parent 52e7e70 commit dc05bf4

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

src/Files.App.Storage/Storables/WindowsStorage/ShellNewItem.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,33 @@
33

44
namespace Files.App.Storage
55
{
6+
/// <summary>
7+
/// Represents a ShellNew item with its type, file extension, description, and icon.
8+
/// </summary>
9+
/// <remarks>
10+
/// This class maps to an undocumented struct, SHELLNEW_ITEM.
11+
/// </remarks>
12+
// TODO: Should this class be a record instead?
613
public partial class ShellNewItem
714
{
15+
/// <summary>
16+
/// Gets the type of a new shell item.
17+
/// </summary>
18+
public ShellNewItemType Type { get; set; } = ShellNewItemType.Invalid;
19+
20+
/// <summary>
21+
/// Gets string file extension (e.g. ".txt").
22+
/// </summary>
23+
public string? Extension { get; set; }
24+
25+
/// <summary>
26+
/// Gets string description as a string.
27+
/// </summary>
28+
public string? Description { get; set; }
29+
30+
/// <summary>
31+
/// Gets icon data as a byte array.
32+
/// </summary>
33+
public byte[]? Icon { get; set; }
834
}
935
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright (c) Files Community
2+
// Licensed under the MIT License.
3+
4+
namespace Files.App.Storage
5+
{
6+
public enum ShellNewItemType // Exactly maps to an undocumented enum, SHELLNEW_TYPE
7+
{
8+
Invalid = -1,
9+
Command = 1,
10+
Data = 2,
11+
FileName = 4,
12+
NullFile = 8
13+
}
14+
}

src/Files.App.Storage/Storables/WindowsStorage/ShellNewManager.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) Files Community
22
// Licensed under the MIT License.
33

4-
using Microsoft.Win32;
54
using Windows.Win32;
65
using Windows.Win32.Foundation;
76
using Windows.Win32.System.Registry;

src/Files.App.Storage/Storables/WindowsStorage/WindowsStorableHelpers.Registry.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public static bool GetRegistryValue<T>(HKEY hRootKey, string szSubKey, string sz
6060
pData = (byte*)NativeMemory.Alloc(cbData);
6161
dwResult = PInvoke.RegGetValue(hKey, default, pszValueName, dwRoutineFlags, &dwValueType, pData, &cbData);
6262

63-
6463
switch (dwValueType)
6564
{
6665
case REG_VALUE_TYPE.REG_NONE:

0 commit comments

Comments
 (0)