Skip to content

Code Quality: Re-organize the structure of Files.App.Storage #17340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Files.Shared.Extensions;
using FluentFTP;

namespace Files.App.Storage.Storables
namespace Files.App.Storage
{
internal static class FtpHelpers
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System.Net;

namespace Files.App.Storage.Storables
namespace Files.App.Storage
{
public static class FtpManager
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using FluentFTP;

namespace Files.App.Storage.Storables
namespace Files.App.Storage
{
public abstract class FtpStorable : IStorableChild
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System.IO;

namespace Files.App.Storage.Storables
namespace Files.App.Storage
{
public sealed class FtpStorageFile : FtpStorable, IChildFile
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.IO;
using System.Runtime.CompilerServices;

namespace Files.App.Storage.Storables
namespace Files.App.Storage
{
public sealed class FtpStorageFolder : FtpStorable, IModifiableFolder, IChildFolder, IDirectCopy, IDirectMove, IGetFirstByName
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using FluentFTP;
using System.IO;

namespace Files.App.Storage.Storables
namespace Files.App.Storage
{
/// <inheritdoc cref="IFtpStorageService"/>
public sealed class FtpStorageService : IFtpStorageService
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public static HRESULT TryUnpinFolderFromQuickAccess(this IWindowsFolder @this)
return HRESULT.S_OK;
}

public static IEnumerable<ContextMenuItem> GetShellNewItems(this IWindowsFolder @this)
public static IEnumerable<WindowsContextMenuItem> GetShellNewItems(this IWindowsFolder @this)
{
HRESULT hr = default;

Expand Down Expand Up @@ -249,7 +249,7 @@ public static IEnumerable<ContextMenuItem> GetShellNewItems(this IWindowsFolder
return [];

// Enumerates and populates the list
List<ContextMenuItem> shellNewItems = [];
List<WindowsContextMenuItem> shellNewItems = [];
for (uint dwIndex = 0; dwIndex < dwCount; dwIndex++)
{
MENUITEMINFOW mii = default;
Expand All @@ -264,7 +264,7 @@ public static IEnumerable<ContextMenuItem> GetShellNewItems(this IWindowsFolder
{
Id = mii.wID,
Name = mii.dwTypeData.ToString(),
Type = (ContextMenuType)mii.fState,
Type = (WindowsContextMenuType)mii.fState,
});
}

Expand All @@ -274,7 +274,7 @@ public static IEnumerable<ContextMenuItem> GetShellNewItems(this IWindowsFolder
return shellNewItems;
}

public static bool InvokeShellNewItem(this IWindowsFolder @this, ContextMenuItem item)
public static bool InvokeShellNewItem(this IWindowsFolder @this, WindowsContextMenuItem item)
{
HRESULT hr = default;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ namespace Files.App.Storage
/// <summary>
/// Represents a Windows Shell ContextMenu item.
/// </summary>
public partial class ContextMenuItem
public partial class WindowsContextMenuItem
{
public ContextMenuType Type { get; set; }
public WindowsContextMenuType Type { get; set; }

public uint Id { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Files.App.Storage
{
public enum ContextMenuType
public enum WindowsContextMenuType
{
Normal = 0x00000000,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace Files.App.Storage
{
public unsafe abstract class WindowsStorable : IWindowsStorable
{
/// <inheritdoc/>
public IShellItem* ThisPtr
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand All @@ -20,6 +21,7 @@ public IShellItem* ThisPtr
set;
}

/// <inheritdoc/>
public IContextMenu* ContextMenu
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand All @@ -29,8 +31,10 @@ public IContextMenu* ContextMenu
set;
}

/// <inheritdoc/>
public string Id => this.GetDisplayName(SIGDN.SIGDN_FILESYSPATH);

/// <inheritdoc/>
public string Name => this.GetDisplayName(SIGDN.SIGDN_PARENTRELATIVEFORUI);

public static WindowsStorable? TryParse(string szPath)
Expand All @@ -54,6 +58,7 @@ public IContextMenu* ContextMenu
return isFolder ? new WindowsFolder(pShellItem) : new WindowsFile(pShellItem);
}

/// <inheritdoc/>
public unsafe Task<IFolder?> GetParentAsync(CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
Expand All @@ -72,6 +77,7 @@ public override bool Equals(object? obj)
return Equals(obj as IWindowsStorable);
}

/// <inheritdoc/>
public override int GetHashCode()
{
return HashCode.Combine(Id, Name);
Expand Down
Loading