mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 00:11:10 +00:00
Implements directory browser dialog, part 3: file system explorer
This commit is contained in:
1 parent
a4f9199d2c
commit
493f34c883
76 files changed
+2377
-437
No files matched your search
+5
-2
@@ -26,11 +26,14 @@ public static class PresentationWebLayerServices
|
||||
{
|
||||
// scan the current assembly for validators and register them to the DI container
|
||||
services.AddValidatorsFromAssemblyContaining<Program>(ServiceLifetime.Singleton);
|
||||
|
||||
|
||||
// handle transient errors like network timeouts or intermittent failures
|
||||
var retryPolicy = Policy
|
||||
.Handle<HttpRequestException>()
|
||||
.OrResult<HttpResponseMessage>(r => !r.IsSuccessStatusCode)
|
||||
.OrResult<HttpResponseMessage>(r =>
|
||||
!r.IsSuccessStatusCode &&
|
||||
r.StatusCode != HttpStatusCode.Forbidden &&
|
||||
r.StatusCode != HttpStatusCode.BadRequest)
|
||||
.WaitAndRetryAsync(3, retryAttempt =>
|
||||
TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
namespace Lumina.Presentation.Web.Common.Enums.FileSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the size options for file system icons.
|
||||
/// </summary>
|
||||
public enum FileSystemIconSize
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the smallest icon size, typically used in compact list views or when space is limited.
|
||||
/// </summary>
|
||||
Small,
|
||||
|
||||
/// <summary>
|
||||
/// Represents a medium-sized icon, balancing visibility and space efficiency.
|
||||
/// </summary>
|
||||
Medium,
|
||||
|
||||
/// <summary>
|
||||
/// Represents a large icon size, providing enhanced visibility and detail.
|
||||
/// </summary>
|
||||
Large,
|
||||
|
||||
/// <summary>
|
||||
/// Represents the largest icon size, offering maximum visibility and detail, suitable for high-resolution displays or thumbnail views.
|
||||
/// </summary>
|
||||
ExtraLarge
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace Lumina.Presentation.Web.Common.Enums.FileSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the different view modes for displaying file system items.
|
||||
/// </summary>
|
||||
public enum FileSystemViewMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Displays file system items in a detailed view, typically including additional information such as file size, date modified, and permissions.
|
||||
/// </summary>
|
||||
Details,
|
||||
|
||||
/// <summary>
|
||||
/// Displays file system items in a compact list view, usually showing only the name of each item.
|
||||
/// </summary>
|
||||
List,
|
||||
|
||||
/// <summary>
|
||||
/// Displays file system items as icons, providing a visual representation of each item type.
|
||||
/// </summary>
|
||||
Icons
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Model for directories displayed in custom directory/file browser dialogs.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{Path}")]
|
||||
public class DirectoryModel : FileSystemItemModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets or sets the children items of the directory.
|
||||
/// </summary>
|
||||
public List<FileSystemItemModel> Items { get; set; } = [];
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Model for files displayed in custom directory/file browser dialogs.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{Path}")]
|
||||
public class FileModel : FileSystemItemModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets or sets the size of the file, in bytes
|
||||
/// </summary>
|
||||
public long Size { get; set; }
|
||||
#endregion
|
||||
}
|
||||
@@ -1,15 +1,16 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Enums.FileSystem;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.FileManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Model for files and directories displayed in custom directory/file browser dialogs.
|
||||
/// Base model for files and directories displayed in custom directory/file browser dialogs.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{Path}")]
|
||||
public class FileSystemItemModel
|
||||
public abstract class FileSystemItemModel
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
@@ -18,23 +19,18 @@ public class FileSystemItemModel
|
||||
public string? Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of the file system element.
|
||||
/// Gets or sets the name of the file system item.
|
||||
/// </summary>
|
||||
public FileSystemItemType ItemType { get; set; }
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the file extension of the item, if applicable (e.g., ".txt", ".jpg").
|
||||
/// Gets or sets the creation date of the file system item.
|
||||
/// </summary>
|
||||
public string? Extension { get; set; }
|
||||
public DateTime DateCreated { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the source path or identifier for the icon representing the file system item.
|
||||
/// Gets or sets the modification date of the file system item.
|
||||
/// </summary>
|
||||
public string? IconSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a friendly name for the file system item, which may be a user-friendly display name.
|
||||
/// </summary>
|
||||
public string? FriendlyName { get; set; }
|
||||
public DateTime DateModified { get; set; }
|
||||
#endregion
|
||||
}
|
||||
Reference in new issue
Block a user