mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 23: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
@@ -1,7 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Models.FileManagement;
|
||||
using Lumina.Contracts.Responses.FileManagement;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
using Mapster;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.FileManagement;
|
||||
@@ -19,13 +23,30 @@ public class DirectoryMappingConfig : IRegister
|
||||
public void Register(TypeAdapterConfig config)
|
||||
{
|
||||
config.NewConfig<Directory, FileSystemTreeNodeResponse>()
|
||||
.Map(dest => dest.Name, src => src.Name)
|
||||
.Map(dest => dest.Path, src => src.Id.Path)
|
||||
.Map(dest => dest.ItemType, src => src.Type)
|
||||
.Map(dest => dest.IsExpanded, () => false)
|
||||
.Map(dest => dest.ChildrenLoaded, () => false)
|
||||
.Map(dest => dest.Children, src => src.Items)
|
||||
.MapToConstructor(true);
|
||||
.Map(dest => dest.Name, src => src.Name)
|
||||
.Map(dest => dest.Path, src => src.Id.Path)
|
||||
.Map(dest => dest.ItemType, src => src.Type)
|
||||
.Map(dest => dest.IsExpanded, () => false)
|
||||
.Map(dest => dest.ChildrenLoaded, () => false)
|
||||
.Map(dest => dest.Children, src => src.Items)
|
||||
.MapToConstructor(true);
|
||||
|
||||
config.NewConfig<Directory, DirectoryResponse>()
|
||||
.MapWith(src => new DirectoryResponse(
|
||||
src.Id.Path,
|
||||
src.Name,
|
||||
src.DateCreated.Value,
|
||||
src.DateModified.Value,
|
||||
src.Items.Adapt<List<FileSystemItemModel>>()
|
||||
));
|
||||
|
||||
config.NewConfig<FileSystemItem, FileSystemItemModel>()
|
||||
.MapWith(src => new FileSystemItemModel(
|
||||
src.Id.Path,
|
||||
src.Name,
|
||||
DateTime.Now,
|
||||
DateTime.Now
|
||||
));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -25,6 +25,15 @@ public class FileMappingConfig : IRegister
|
||||
.Map(dest => dest.IsExpanded, () => false)
|
||||
.Map(dest => dest.ChildrenLoaded, () => false)
|
||||
.MapToConstructor(true);
|
||||
|
||||
config.NewConfig<File, FileResponse>()
|
||||
.MapWith(src => new FileResponse(
|
||||
src.Id.Path,
|
||||
src.Name,
|
||||
src.DateCreated.HasValue ? src.DateCreated.Value : default,
|
||||
src.DateModified.HasValue ? src.DateModified.Value : default,
|
||||
src.Size
|
||||
));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
Reference in new issue
Block a user