committed by
GitHub
134 changed files with 2582 additions and 174 deletions
@ -0,0 +1,16 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Ddd.Application" Version="3.0.0" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\LINGYUN.Abp.FileManagement.Domain.Shared\LINGYUN.Abp.FileManagement.Domain.Shared.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,12 @@ |
|||
using Volo.Abp.Application; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpFileManagementDomainSharedModule), |
|||
typeof(AbpDddApplicationModule))] |
|||
public class AbpFileManagementApplicationContractsModule : AbpModule |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement |
|||
{ |
|||
public class FileCopyOrMoveDto |
|||
{ |
|||
[StringLength(255)] |
|||
public string Path { get; set; } |
|||
|
|||
[Required] |
|||
[StringLength(255)] |
|||
public string Name { get; set; } |
|||
|
|||
[Required] |
|||
[StringLength(255)] |
|||
public string ToPath { get; set; } |
|||
|
|||
[StringLength(255)] |
|||
public string ToName { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Volo.Abp.Auditing; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement |
|||
{ |
|||
public class FileCreateDto |
|||
{ |
|||
/// <summary>
|
|||
/// 文件名
|
|||
/// </summary>
|
|||
[StringLength(255)] |
|||
public string Name { get; set; } |
|||
/// <summary>
|
|||
/// 文件路径
|
|||
/// </summary>
|
|||
[StringLength(255)] |
|||
public string Path { get; set; } |
|||
/// <summary>
|
|||
/// 文件数据,前端无需传递此参数,由控制器传递
|
|||
/// </summary>
|
|||
[DisableAuditing] |
|||
public byte[] Data { get; set; } |
|||
/// <summary>
|
|||
/// 当前字节数
|
|||
/// </summary>
|
|||
[Required] |
|||
public int CurrentByte { get; set; } |
|||
/// <summary>
|
|||
/// 最大字节数
|
|||
/// </summary>
|
|||
[Required] |
|||
public int TotalByte { get; set; } |
|||
/// <summary>
|
|||
/// 是否覆盖文件
|
|||
/// </summary>
|
|||
public bool Rewrite { get; set; } = false; |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement |
|||
{ |
|||
public class FileDeleteDto |
|||
{ |
|||
[StringLength(255)] |
|||
public string Path { get; set; } |
|||
|
|||
[Required] |
|||
[StringLength(255)] |
|||
public string Name { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Text; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement |
|||
{ |
|||
public class FileSystemDownloadDto : FileSystemGetDto |
|||
{ |
|||
/// <summary>
|
|||
/// 当前字节数
|
|||
/// </summary>
|
|||
public int CurrentByte { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
using System; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement |
|||
{ |
|||
public class FileSystemDto |
|||
{ |
|||
public FileSystemType Type { get; set; } |
|||
public string Name { get; set; } |
|||
public string Parent { get; set; } |
|||
public string Extension { get; set; } |
|||
public long? Size { get; set; } |
|||
public DateTime CreationTime { get; set; } |
|||
public DateTime? LastModificationTime { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement |
|||
{ |
|||
public class FileSystemGetDto |
|||
{ |
|||
[StringLength(255)] |
|||
public string Path { get; set; } |
|||
|
|||
[Required] |
|||
[StringLength(255)] |
|||
public string Name { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
namespace LINGYUN.Abp.FileManagement |
|||
{ |
|||
public enum FileSystemType |
|||
{ |
|||
Folder = 0, |
|||
File = 1 |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement |
|||
{ |
|||
public class FileSystemUpdateDto |
|||
{ |
|||
[Required] |
|||
[StringLength(255)] |
|||
public string NewName { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement |
|||
{ |
|||
public class FolderCopyDto |
|||
{ |
|||
[Required] |
|||
[StringLength(255)] |
|||
public string CopyToPath { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement |
|||
{ |
|||
public class FolderCreateDto |
|||
{ |
|||
[Required] |
|||
[StringLength(255)] |
|||
public string Path { get; set; } |
|||
|
|||
public string Parent { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement |
|||
{ |
|||
public class FolderMoveDto |
|||
{ |
|||
[Required] |
|||
[StringLength(255)] |
|||
public string MoveToPath { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement |
|||
{ |
|||
public class GetFileSystemListDto : PagedAndSortedResultRequestDto |
|||
{ |
|||
// TODO: Windows最大路径长度,超过了貌似也无效了吧
|
|||
[StringLength(255)] |
|||
public string Parent { get; set; } |
|||
|
|||
public string Filter { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.IO; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement |
|||
{ |
|||
public interface IFileSystemAppService : IApplicationService |
|||
{ |
|||
Task<FileSystemDto> GetAsync(FileSystemGetDto input); |
|||
|
|||
Task<PagedResultDto<FileSystemDto>> GetListAsync(GetFileSystemListDto input); |
|||
|
|||
Task CreateFolderAsync(FolderCreateDto input); |
|||
|
|||
Task<FileSystemDto> UpdateAsync([Required, StringLength(255)] string name, FileSystemUpdateDto input); |
|||
|
|||
Task DeleteFolderAsync([Required, StringLength(255)] string path); |
|||
|
|||
Task MoveFolderAsync([Required, StringLength(255)] string path, FolderMoveDto input); |
|||
|
|||
Task CopyFolderAsync([Required, StringLength(255)] string path, FolderCopyDto input); |
|||
|
|||
Task CreateFileAsync(FileCreateDto input); |
|||
|
|||
Task DeleteFileAsync(FileDeleteDto input); |
|||
|
|||
Task MoveFileAsync(FileCopyOrMoveDto input); |
|||
|
|||
Task CopyFileAsync(FileCopyOrMoveDto input); |
|||
|
|||
Task<Stream> DownloadFileAsync(FileSystemGetDto input); |
|||
} |
|||
} |
|||
@ -0,0 +1,34 @@ |
|||
using LINGYUN.Abp.FileManagement.Localization; |
|||
using Volo.Abp.Authorization.Permissions; |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement.Permissions |
|||
{ |
|||
public class AbpFileManagementPermissionDefinitionProvider : PermissionDefinitionProvider |
|||
{ |
|||
public override void Define(IPermissionDefinitionContext context) |
|||
{ |
|||
var fileManagement = context.AddGroup(AbpFileManagementPermissions.GroupName, L("Permission:FileManagement")); |
|||
|
|||
var fileSystem = fileManagement.AddPermission(AbpFileManagementPermissions.FileSystem.Default, L("Permission:FileSystem")); |
|||
fileSystem.AddChild(AbpFileManagementPermissions.FileSystem.Create, L("Permission:CreateFolder")); |
|||
fileSystem.AddChild(AbpFileManagementPermissions.FileSystem.Delete, L("Permission:DeleteFolder")); |
|||
fileSystem.AddChild(AbpFileManagementPermissions.FileSystem.Update, L("Permission:UpdateFolder")); |
|||
fileSystem.AddChild(AbpFileManagementPermissions.FileSystem.Copy, L("Permission:CopyFolder")); |
|||
fileSystem.AddChild(AbpFileManagementPermissions.FileSystem.Move, L("Permission:MoveFolder")); |
|||
|
|||
var fileManager = fileSystem.AddChild(AbpFileManagementPermissions.FileSystem.FileManager.Default, L("Permission:FileManager")); |
|||
fileManager.AddChild(AbpFileManagementPermissions.FileSystem.FileManager.Create, L("Permission:AppendFile")); |
|||
fileManager.AddChild(AbpFileManagementPermissions.FileSystem.FileManager.Update, L("Permission:UpdateFile")); |
|||
fileManager.AddChild(AbpFileManagementPermissions.FileSystem.FileManager.Delete, L("Permission:DeleteFile")); |
|||
fileManager.AddChild(AbpFileManagementPermissions.FileSystem.FileManager.Copy, L("Permission:CopyFile")); |
|||
fileManager.AddChild(AbpFileManagementPermissions.FileSystem.FileManager.Move, L("Permission:MoveFile")); |
|||
fileManager.AddChild(AbpFileManagementPermissions.FileSystem.FileManager.Download, L("Permission:DownloadFile")); |
|||
} |
|||
|
|||
private static LocalizableString L(string name) |
|||
{ |
|||
return LocalizableString.Create<AbpFileManagementResource>(name); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
namespace LINGYUN.Abp.FileManagement.Permissions |
|||
{ |
|||
public class AbpFileManagementPermissions |
|||
{ |
|||
public const string GroupName = "AbpFileManagement"; |
|||
|
|||
/// <summary>
|
|||
/// 文件系统
|
|||
/// </summary>
|
|||
public class FileSystem |
|||
{ |
|||
public const string Default = GroupName + ".FileSystem"; |
|||
|
|||
public const string Create = Default + ".Create"; |
|||
|
|||
public const string Delete = Default + ".Delete"; |
|||
|
|||
public const string Update = Default + ".Update"; |
|||
|
|||
public const string Copy = Default + ".Copy"; |
|||
|
|||
public const string Move = Default + ".Move"; |
|||
/// <summary>
|
|||
/// 文件管理
|
|||
/// </summary>
|
|||
public class FileManager |
|||
{ |
|||
public const string Default = FileSystem.Default + ".FileManager"; |
|||
|
|||
public const string Create = Default + ".Create"; |
|||
|
|||
public const string Copy = Default + ".Copy"; |
|||
|
|||
public const string Delete = Default + ".Delete"; |
|||
|
|||
public const string Update = Default + ".Update"; |
|||
|
|||
public const string Move = Default + ".Move"; |
|||
|
|||
public const string Download = Default + ".Download"; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\LINGYUN.Abp.FileManagement.Application.Contracts\LINGYUN.Abp.FileManagement.Application.Contracts.csproj" /> |
|||
<ProjectReference Include="..\LINGYUN.Abp.FileManagement.Domain\LINGYUN.Abp.FileManagement.Domain.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,12 @@ |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpFileManagementDomainModule), |
|||
typeof(AbpFileManagementApplicationContractsModule))] |
|||
public class AbpFileManagementApplicationModule : AbpModule |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement |
|||
{ |
|||
public class FileManagementApplicationServiceBase : ApplicationService |
|||
{ |
|||
protected FileManagementApplicationServiceBase() |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,439 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.BlobStoring; |
|||
using Volo.Abp.BlobStoring.FileSystem; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement |
|||
{ |
|||
public class FileSystemAppService : FileManagementApplicationServiceBase, IFileSystemAppService |
|||
{ |
|||
protected IBlobContainer<FileSystemContainer> BlobContainer { get; } |
|||
protected IBlobContainerConfigurationProvider BlobContainerConfigurationProvider { get; } |
|||
public FileSystemAppService( |
|||
IBlobContainer<FileSystemContainer> blobContainer, |
|||
IBlobContainerConfigurationProvider blobContainerConfigurationProvider) |
|||
{ |
|||
BlobContainer = blobContainer; |
|||
BlobContainerConfigurationProvider = blobContainerConfigurationProvider; |
|||
} |
|||
|
|||
public virtual Task CopyFileAsync(FileCopyOrMoveDto input) |
|||
{ |
|||
string fileSystemPath = GetFileSystemPath(input.Path); |
|||
var fileFullName = Path.Combine(fileSystemPath, input.Name); |
|||
if (!File.Exists(fileFullName)) |
|||
{ |
|||
throw new UserFriendlyException("指定的文件不存在!"); |
|||
} |
|||
var copyToFilePath = GetFileSystemPath(input.ToPath); |
|||
var copyToFileFullName = Path.Combine(copyToFilePath, input.ToName ?? input.Name); |
|||
if (File.Exists(copyToFileFullName)) |
|||
{ |
|||
throw new UserFriendlyException("指定的路径中已经有相同的文件名存在!"); |
|||
} |
|||
|
|||
File.Copy(fileFullName, copyToFileFullName); |
|||
|
|||
return Task.CompletedTask; |
|||
} |
|||
|
|||
public virtual Task CopyFolderAsync([Required, StringLength(255)] string path, FolderCopyDto input) |
|||
{ |
|||
string fileSystemPath = GetFileSystemPath(path); |
|||
if (!Directory.Exists(fileSystemPath)) |
|||
{ |
|||
throw new UserFriendlyException("指定目录不存在!"); |
|||
} |
|||
var copyToFilePath = GetFileSystemPath(input.CopyToPath); |
|||
if (Directory.Exists(copyToFilePath)) |
|||
{ |
|||
throw new UserFriendlyException("指定的路径中已经有同名的目录存在!"); |
|||
} |
|||
|
|||
CopyDirectory(fileSystemPath, copyToFilePath); |
|||
|
|||
return Task.CompletedTask; |
|||
} |
|||
|
|||
public virtual async Task CreateFileAsync(FileCreateDto input) |
|||
{ |
|||
string fileSystemPath = GetFileSystemPath(input.Path); |
|||
var fileFullName = Path.Combine(fileSystemPath, input.Name); |
|||
if (File.Exists(fileFullName) && !input.Rewrite) |
|||
{ |
|||
throw new UserFriendlyException("指定的文件已经存在!"); |
|||
} |
|||
await BlobContainer.SaveAsync(input.Name, input.Data, input.Rewrite); |
|||
} |
|||
|
|||
public virtual Task CreateFolderAsync(FolderCreateDto input) |
|||
{ |
|||
string fileSystemPath = GetFileSystemBashPath(); |
|||
if (!input.Parent.IsNullOrWhiteSpace()) |
|||
{ |
|||
fileSystemPath = GetFileSystemPath(input.Parent); |
|||
} |
|||
var newFloderPath = Path.Combine(fileSystemPath, input.Path); |
|||
if (Directory.Exists(newFloderPath)) |
|||
{ |
|||
throw new UserFriendlyException("指定目录已经存在!"); |
|||
} |
|||
Directory.CreateDirectory(newFloderPath); |
|||
|
|||
return Task.CompletedTask; |
|||
} |
|||
|
|||
public virtual Task DeleteFileAsync(FileDeleteDto input) |
|||
{ |
|||
var fileSystemPath = GetFileSystemPath(input.Path); |
|||
fileSystemPath = Path.Combine(fileSystemPath, input.Name); |
|||
if (File.Exists(fileSystemPath)) |
|||
{ |
|||
File.Delete(fileSystemPath); |
|||
} |
|||
return Task.CompletedTask; |
|||
} |
|||
|
|||
public virtual Task DeleteFolderAsync([Required, StringLength(255)] string path) |
|||
{ |
|||
string fileSystemPath = GetFileSystemPath(path); |
|||
if (!Directory.Exists(fileSystemPath)) |
|||
{ |
|||
throw new UserFriendlyException("指定目录不存在!"); |
|||
} |
|||
var fileSystemChildrenPath = Directory.GetDirectories(fileSystemPath); |
|||
if (fileSystemChildrenPath.Length > 0) |
|||
{ |
|||
throw new UserFriendlyException("指定的目录不为空,不可删除此目录!"); |
|||
} |
|||
var fileSystemPathFiles = Directory.GetFiles(fileSystemPath); |
|||
if (fileSystemPathFiles.Length > 0) |
|||
{ |
|||
throw new UserFriendlyException("指定的目录不为空,不可删除此目录!"); |
|||
} |
|||
Directory.Delete(fileSystemPath); |
|||
return Task.CompletedTask; |
|||
} |
|||
|
|||
public virtual async Task<Stream> DownloadFileAsync(FileSystemGetDto input) |
|||
{ |
|||
var fileSystemPath = GetFileSystemPath(input.Path); |
|||
fileSystemPath = Path.Combine(fileSystemPath, input.Name); |
|||
var blobName = GetFileSystemRelativePath(fileSystemPath); |
|||
// 去除第一个路径标识符
|
|||
blobName = blobName.RemovePreFix("/", "\\"); |
|||
return await BlobContainer.GetAsync(blobName); |
|||
} |
|||
|
|||
public virtual Task<FileSystemDto> GetAsync(FileSystemGetDto input) |
|||
{ |
|||
var fileSystemPath = GetFileSystemPath(input.Path); |
|||
fileSystemPath = Path.Combine(fileSystemPath, input.Name); |
|||
if (File.Exists(fileSystemPath)) |
|||
{ |
|||
var fileInfo = new FileInfo(fileSystemPath); |
|||
var fileSystem = new FileSystemDto |
|||
{ |
|||
Type = FileSystemType.File, |
|||
Name = fileInfo.Name, |
|||
Size = fileInfo.Length, |
|||
Extension = fileInfo.Extension, |
|||
CreationTime = fileInfo.CreationTime, |
|||
LastModificationTime = fileInfo.LastWriteTime |
|||
}; |
|||
if (fileInfo.Directory != null && !fileInfo.Directory.FullName.IsNullOrWhiteSpace()) |
|||
{ |
|||
fileSystem.Parent = GetFileSystemRelativePath(fileInfo.Directory.FullName); |
|||
} |
|||
return Task.FromResult(fileSystem); |
|||
} |
|||
if (Directory.Exists(fileSystemPath)) |
|||
{ |
|||
var directoryInfo = new DirectoryInfo(fileSystemPath); |
|||
var fileSystem = new FileSystemDto |
|||
{ |
|||
Type = FileSystemType.Folder, |
|||
Name = directoryInfo.Name, |
|||
CreationTime = directoryInfo.CreationTime, |
|||
LastModificationTime = directoryInfo.LastWriteTime |
|||
}; |
|||
if (directoryInfo.Parent != null && !directoryInfo.Parent.FullName.IsNullOrWhiteSpace()) |
|||
{ |
|||
fileSystem.Parent = GetFileSystemRelativePath(directoryInfo.Parent.FullName); |
|||
} |
|||
return Task.FromResult(fileSystem); |
|||
} |
|||
throw new UserFriendlyException("文件或目录不存在!"); |
|||
} |
|||
|
|||
public virtual Task<PagedResultDto<FileSystemDto>> GetListAsync(GetFileSystemListDto input) |
|||
{ |
|||
List<FileSystemDto> fileSystems = new List<FileSystemDto>(); |
|||
|
|||
string fileSystemPath = GetFileSystemBashPath(); |
|||
if (!input.Parent.IsNullOrWhiteSpace()) |
|||
{ |
|||
fileSystemPath = GetFileSystemPath(input.Parent); |
|||
} |
|||
var directoryInfo = new DirectoryInfo(fileSystemPath); |
|||
if (!directoryInfo.Exists) |
|||
{ |
|||
return Task.FromResult(new PagedResultDto<FileSystemDto>(0, fileSystems)); |
|||
} |
|||
// 查询全部文件系统
|
|||
var fileSystemInfos = directoryInfo.GetFileSystemInfos(); |
|||
// 指定搜索条件查询目录
|
|||
FileSystemInfo[] fileSystemInfoSearchChildren; |
|||
if (!input.Filter.IsNullOrWhiteSpace()) |
|||
{ |
|||
var searchPattern = $"*{input.Filter}*"; |
|||
fileSystemInfoSearchChildren = directoryInfo.GetFileSystemInfos(searchPattern); |
|||
} |
|||
else |
|||
{ |
|||
fileSystemInfoSearchChildren = directoryInfo.GetFileSystemInfos(); |
|||
} |
|||
|
|||
fileSystemInfoSearchChildren = fileSystemInfoSearchChildren |
|||
.Skip((input.SkipCount - 1) * input.MaxResultCount) |
|||
.Take(input.MaxResultCount) |
|||
.ToArray(); |
|||
|
|||
foreach (var fileSystemInfo in fileSystemInfoSearchChildren) |
|||
{ |
|||
var fileSystem = new FileSystemDto |
|||
{ |
|||
Name = fileSystemInfo.Name, |
|||
CreationTime = fileSystemInfo.CreationTime, |
|||
LastModificationTime = fileSystemInfo.LastWriteTime, |
|||
}; |
|||
|
|||
if (fileSystemInfo is FileInfo fileInfo) |
|||
{ |
|||
fileSystem.Type = FileSystemType.File; |
|||
fileSystem.Size = fileInfo.Length; |
|||
fileSystem.Extension = fileInfo.Extension; |
|||
if (fileInfo.Directory != null && !fileInfo.Directory.FullName.IsNullOrWhiteSpace()) |
|||
{ |
|||
fileSystem.Parent = GetFileSystemRelativePath(fileInfo.Directory.FullName); |
|||
} |
|||
} |
|||
else if (fileSystemInfo is DirectoryInfo directory) |
|||
{ |
|||
fileSystem.Type = FileSystemType.Folder; |
|||
if (directory.Parent != null && !directory.Parent.FullName.IsNullOrWhiteSpace()) |
|||
{ |
|||
fileSystem.Parent = GetFileSystemRelativePath(directory.Parent.FullName); |
|||
} |
|||
} |
|||
fileSystems.Add(fileSystem); |
|||
} |
|||
|
|||
fileSystems = fileSystems |
|||
.OrderBy(f => f.Type) |
|||
.ThenBy(f => f.Name) |
|||
.ToList(); |
|||
|
|||
return Task.FromResult(new PagedResultDto<FileSystemDto>( |
|||
fileSystemInfos.Length, fileSystems |
|||
)); |
|||
} |
|||
|
|||
public virtual Task MoveFileAsync(FileCopyOrMoveDto input) |
|||
{ |
|||
string fileSystemPath = GetFileSystemPath(input.Path); |
|||
fileSystemPath = Path.Combine(fileSystemPath, input.Name); |
|||
if (!File.Exists(fileSystemPath)) |
|||
{ |
|||
throw new UserFriendlyException("指定目录不存在!"); |
|||
} |
|||
var moveToFilePath = GetFileSystemPath(input.ToPath); |
|||
moveToFilePath = Path.Combine(moveToFilePath, input.ToName ?? input.Name); |
|||
if (Directory.Exists(moveToFilePath)) |
|||
{ |
|||
throw new UserFriendlyException("指定的路径中已经有同名的文件存在!"); |
|||
} |
|||
|
|||
File.Move(fileSystemPath, moveToFilePath); |
|||
|
|||
return Task.CompletedTask; |
|||
} |
|||
|
|||
public virtual Task MoveFolderAsync([Required, StringLength(255)] string path, FolderMoveDto input) |
|||
{ |
|||
string fileSystemPath = GetFileSystemPath(path); |
|||
if (!Directory.Exists(fileSystemPath)) |
|||
{ |
|||
throw new UserFriendlyException("指定目录不存在!"); |
|||
} |
|||
var moveToFilePath = GetFileSystemPath(input.MoveToPath); |
|||
if (Directory.Exists(moveToFilePath)) |
|||
{ |
|||
throw new UserFriendlyException("指定的路径中已经有同名的目录存在!"); |
|||
} |
|||
|
|||
Directory.Move(fileSystemPath, moveToFilePath); |
|||
|
|||
return Task.CompletedTask; |
|||
} |
|||
|
|||
public virtual Task<FileSystemDto> UpdateAsync([Required, StringLength(255)] string name, FileSystemUpdateDto input) |
|||
{ |
|||
string fileSystemPath = GetFileSystemPath(name); |
|||
var renameFilePath = GetFileSystemPath(input.NewName); |
|||
if (File.Exists(fileSystemPath)) |
|||
{ |
|||
if (File.Exists(renameFilePath)) |
|||
{ |
|||
throw new UserFriendlyException("指定的文件名已经存在!"); |
|||
} |
|||
File.Move(fileSystemPath, renameFilePath); |
|||
|
|||
var fileInfo = new FileInfo(renameFilePath); |
|||
var fileSystem = new FileSystemDto |
|||
{ |
|||
Type = FileSystemType.File, |
|||
Name = fileInfo.Name, |
|||
Size = fileInfo.Length, |
|||
Extension = fileInfo.Extension, |
|||
CreationTime = fileInfo.CreationTime, |
|||
LastModificationTime = fileInfo.LastWriteTime |
|||
}; |
|||
if (fileInfo.Directory != null && !fileInfo.Directory.FullName.IsNullOrWhiteSpace()) |
|||
{ |
|||
fileSystem.Parent = GetFileSystemRelativePath(fileInfo.Directory.FullName); |
|||
} |
|||
return Task.FromResult(fileSystem); |
|||
} |
|||
if (Directory.Exists(fileSystemPath)) |
|||
{ |
|||
if (Directory.Exists(renameFilePath)) |
|||
{ |
|||
throw new UserFriendlyException("指定的路径中已经有同名的目录存在!"); |
|||
} |
|||
|
|||
Directory.Move(fileSystemPath, renameFilePath); |
|||
|
|||
var directoryInfo = new DirectoryInfo(renameFilePath); |
|||
var fileSystem = new FileSystemDto |
|||
{ |
|||
Type = FileSystemType.Folder, |
|||
Name = directoryInfo.Name, |
|||
CreationTime = directoryInfo.CreationTime, |
|||
LastModificationTime = directoryInfo.LastWriteTime |
|||
}; |
|||
if (directoryInfo.Parent != null && !directoryInfo.Parent.FullName.IsNullOrWhiteSpace()) |
|||
{ |
|||
fileSystem.Parent = GetFileSystemRelativePath(directoryInfo.Parent.FullName); |
|||
} |
|||
return Task.FromResult(fileSystem); |
|||
} |
|||
throw new UserFriendlyException("文件或目录不存在!"); |
|||
} |
|||
/// <summary>
|
|||
/// 获取文件系统相对路径
|
|||
/// </summary>
|
|||
/// <param name="path"></param>
|
|||
/// <returns></returns>
|
|||
protected virtual string GetFileSystemRelativePath(string path) |
|||
{ |
|||
// 去除完整路径中的文件系统根目录
|
|||
var fileSystemConfiguration = GetFileSystemBlobProviderConfiguration(); |
|||
var blobPath = fileSystemConfiguration.BasePath; |
|||
// 去除租户或宿主目录
|
|||
if (CurrentTenant.Id == null) |
|||
{ |
|||
blobPath = Path.Combine(blobPath, "host"); |
|||
} |
|||
else |
|||
{ |
|||
blobPath = Path.Combine(blobPath, "tenants", CurrentTenant.Id.Value.ToString("D")); |
|||
} |
|||
// 去除完整路径中的容器根目录
|
|||
var containerName = BlobContainerNameAttribute.GetContainerName<FileSystemContainer>(); |
|||
if (path.Contains(containerName)) |
|||
{ |
|||
blobPath = Path.Combine(blobPath, containerName); |
|||
} |
|||
path = path.Replace(blobPath, ""); |
|||
return path; |
|||
} |
|||
|
|||
protected virtual string GetFileSystemPath(string path) |
|||
{ |
|||
var fileSystemConfiguration = GetFileSystemBlobProviderConfiguration(); |
|||
var blobPath = GetFileSystemBashPath(); |
|||
|
|||
if (!path.IsNullOrWhiteSpace() && fileSystemConfiguration.AppendContainerNameToBasePath) |
|||
{ |
|||
// 去除第一个路径标识符
|
|||
path = path.RemovePreFix("/", "\\"); |
|||
blobPath = Path.Combine(blobPath, path); |
|||
} |
|||
|
|||
return blobPath; |
|||
} |
|||
|
|||
protected virtual string GetFileSystemBashPath() |
|||
{ |
|||
var fileSystemConfiguration = GetFileSystemBlobProviderConfiguration(); |
|||
var blobPath = fileSystemConfiguration.BasePath; |
|||
blobPath = Path.Combine(Directory.GetCurrentDirectory(), blobPath); |
|||
if (CurrentTenant.Id == null) |
|||
{ |
|||
blobPath = Path.Combine(blobPath, "host"); |
|||
} |
|||
else |
|||
{ |
|||
blobPath = Path.Combine(blobPath, "tenants", CurrentTenant.Id.Value.ToString("D")); |
|||
} |
|||
var containerName = BlobContainerNameAttribute.GetContainerName<FileSystemContainer>(); |
|||
|
|||
blobPath = Path.Combine(blobPath, containerName); |
|||
|
|||
if (!Directory.Exists(blobPath)) |
|||
{ |
|||
Directory.CreateDirectory(blobPath); |
|||
} |
|||
|
|||
return blobPath; |
|||
} |
|||
|
|||
protected virtual FileSystemBlobProviderConfiguration GetFileSystemBlobProviderConfiguration() |
|||
{ |
|||
var blobConfiguration = BlobContainerConfigurationProvider |
|||
.Get<FileSystemContainer>(); |
|||
return blobConfiguration.GetFileSystemConfiguration(); |
|||
} |
|||
|
|||
protected void CopyDirectory(string sourcePath, string copyToPath) |
|||
{ |
|||
var sourceDirectory = new DirectoryInfo(sourcePath); |
|||
var fileSystemInfos = sourceDirectory.GetFileSystemInfos(); |
|||
|
|||
foreach (var fileSystemInfo in fileSystemInfos) |
|||
{ |
|||
var copyToFilePath = Path.Combine(copyToPath, fileSystemInfo.Name); |
|||
if (fileSystemInfo is DirectoryInfo) |
|||
{ |
|||
if (!Directory.Exists(copyToFilePath)) |
|||
{ |
|||
Directory.CreateDirectory(copyToFilePath); |
|||
} |
|||
CopyDirectory(fileSystemInfo.FullName, copyToFilePath); |
|||
} |
|||
else |
|||
{ |
|||
File.Copy(fileSystemInfo.FullName, copyToFilePath, true); |
|||
} |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<None Remove="LINGYUN\Abp\FileManagement\Localization\Resources\en.json" /> |
|||
<None Remove="LINGYUN\Abp\FileManagement\Localization\Resources\zh-Hans.json" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<EmbeddedResource Include="LINGYUN\Abp\FileManagement\Localization\Resources\en.json" /> |
|||
<EmbeddedResource Include="LINGYUN\Abp\FileManagement\Localization\Resources\zh-Hans.json" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Validation" Version="3.0.0" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,30 @@ |
|||
using LINGYUN.Abp.FileManagement.Localization; |
|||
using Volo.Abp.Localization; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.Validation; |
|||
using Volo.Abp.Validation.Localization; |
|||
using Volo.Abp.VirtualFileSystem; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement |
|||
{ |
|||
[DependsOn(typeof(AbpValidationModule))] |
|||
public class AbpFileManagementDomainSharedModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpVirtualFileSystemOptions>(options => |
|||
{ |
|||
options.FileSets.AddEmbedded<AbpFileManagementDomainSharedModule>(); |
|||
}); |
|||
|
|||
Configure<AbpLocalizationOptions>(options => |
|||
{ |
|||
options.Resources |
|||
.Add<AbpFileManagementResource>("en") |
|||
.AddBaseTypes( |
|||
typeof(AbpValidationResource) |
|||
).AddVirtualJson("/LINGYUN/Abp/FileManagement/Localization/Resources"); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement.Localization |
|||
{ |
|||
[LocalizationResourceName("AbpFileManagement")] |
|||
public class AbpFileManagementResource |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
{ |
|||
"culture": "en", |
|||
"texts": { |
|||
"Permission:FileManagement": "File management", |
|||
"Permission:FileSystem": "File system", |
|||
"Permission:FileManager": "Files", |
|||
"Permission:CreateFolder": "Create directory", |
|||
"Permission:DeleteFolder": "Delete directory", |
|||
"Permission:UpdateFolder": "Edit directory", |
|||
"Permission:MoveFolder": "Change directory", |
|||
"Permission:CopyFolder": "Copy directory", |
|||
"Permission:AppendFile": "Add files", |
|||
"Permission:UpdateFile": "Change file", |
|||
"Permission:DeleteFile": "Delete file", |
|||
"Permission:CopyFile": "Copy file", |
|||
"Permission:MoveFile": "Move file", |
|||
"Permission:DownloadFile": "Download file", |
|||
"UploadFileSizeBeyondLimit": "Upload file size cannot exceed {0} MB!", |
|||
"NotAllowedFileExtensionName": "Not allowed file extension: {0}!", |
|||
"DisplayName:FileLimitLength": "File limit size", |
|||
"Description:FileLimitLength": "Limit size of uploaded file in MB", |
|||
"DisplayName:AllowFileExtensions": "File extension", |
|||
"Description:AllowFileExtensions": "List of allowed extensions to upload files, with multiple extensions separated by, don't need a notation" |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
{ |
|||
"culture": "zh-Hans", |
|||
"texts": { |
|||
"Permission:FileManagement": "文件管理", |
|||
"Permission:FileSystem": "文件系统", |
|||
"Permission:FileManager": "文件", |
|||
"Permission:CreateFolder": "创建目录", |
|||
"Permission:DeleteFolder": "删除目录", |
|||
"Permission:UpdateFolder": "修改目录", |
|||
"Permission:MoveFolder": "变更目录", |
|||
"Permission:CopyFolder": "复制目录", |
|||
"Permission:AppendFile": "添加文件", |
|||
"Permission:UpdateFile": "变更文件", |
|||
"Permission:DeleteFile": "删除文件", |
|||
"Permission:CopyFile": "复制文件", |
|||
"Permission:MoveFile": "移动文件", |
|||
"Permission:DownloadFile": "下载文件", |
|||
"UploadFileSizeBeyondLimit": "上传文件大小不能超过 {0} MB!", |
|||
"NotAllowedFileExtensionName": "不被允许的文件扩展名: {0}!", |
|||
"DisplayName:FileLimitLength": "文件限制大小", |
|||
"Description:FileLimitLength": "上传文件的限制大小,单位(MB)", |
|||
"DisplayName:AllowFileExtensions": "文件扩展名", |
|||
"Description:AllowFileExtensions": "允许的上传文件扩展名列表,多个扩展名以,分隔,无需输入.符号" |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
namespace LINGYUN.Abp.FileManagement.Settings |
|||
{ |
|||
public class AbpFileManagementSettingNames |
|||
{ |
|||
public const string GroupName = "Abp.FileManagement"; |
|||
/// <summary>
|
|||
/// 文件限制长度
|
|||
/// </summary>
|
|||
public const string FileLimitLength = GroupName + ".FileLimitLength"; |
|||
/// <summary>
|
|||
/// 允许的文件扩展名类型
|
|||
/// </summary>
|
|||
public const string AllowFileExtensions = GroupName + ".AllowFileExtensions"; |
|||
|
|||
public const int DefaultFileLimitLength = 100; |
|||
public const string DefaultAllowFileExtensions = "dll,zip,rar,txt,log,xml,config,json,jpeg,jpg,png,bmp,ico,xlsx,xltx,xls,xlt,docs,dots,doc,dot,pptx,potx,ppt,pot,chm"; |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.BlobStoring.FileSystem" Version="3.0.0" /> |
|||
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="3.0.0" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\LINGYUN.Abp.FileManagement.Domain.Shared\LINGYUN.Abp.FileManagement.Domain.Shared.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,15 @@ |
|||
using Volo.Abp.Domain; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.MultiTenancy; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpDddDomainModule), |
|||
typeof(AbpMultiTenancyModule), |
|||
typeof(AbpFileManagementDomainSharedModule) |
|||
)] |
|||
public class AbpFileManagementDomainModule : AbpModule |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
using Volo.Abp.BlobStoring; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement |
|||
{ |
|||
[BlobContainerName("abp-file-management")] |
|||
public class FileSystemContainer |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
using LINGYUN.Abp.FileManagement.Localization; |
|||
using Volo.Abp.Localization; |
|||
using Volo.Abp.Settings; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement.Settings |
|||
{ |
|||
public class AbpFileManagementSettingDefinitionProvider : SettingDefinitionProvider |
|||
{ |
|||
public override void Define(ISettingDefinitionContext context) |
|||
{ |
|||
context.Add(CreateFileSystemSettings()); |
|||
} |
|||
|
|||
protected SettingDefinition[] CreateFileSystemSettings() |
|||
{ |
|||
return new SettingDefinition[] |
|||
{ |
|||
new SettingDefinition( |
|||
name: AbpFileManagementSettingNames.FileLimitLength, |
|||
defaultValue: AbpFileManagementSettingNames.DefaultFileLimitLength.ToString(), |
|||
displayName: L("DisplayName:FileLimitLength"), |
|||
description: L("Description:FileLimitLength"), |
|||
isVisibleToClients: true) |
|||
.WithProviders( |
|||
GlobalSettingValueProvider.ProviderName, |
|||
TenantSettingValueProvider.ProviderName), |
|||
new SettingDefinition( |
|||
name: AbpFileManagementSettingNames.AllowFileExtensions, |
|||
defaultValue: AbpFileManagementSettingNames.DefaultAllowFileExtensions, |
|||
displayName: L("DisplayName:AllowFileExtensions"), |
|||
description: L("Description:AllowFileExtensions"), |
|||
isVisibleToClients: true) |
|||
.WithProviders( |
|||
GlobalSettingValueProvider.ProviderName, |
|||
TenantSettingValueProvider.ProviderName), |
|||
}; |
|||
} |
|||
|
|||
protected LocalizableString L(string name) |
|||
{ |
|||
return LocalizableString.Create<AbpFileManagementResource>(name); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp3.1</TargetFramework> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="3.0.0" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\LINGYUN.Abp.FileManagement.Application.Contracts\LINGYUN.Abp.FileManagement.Application.Contracts.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,21 @@ |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpFileManagementApplicationContractsModule), |
|||
typeof(AbpAspNetCoreMvcModule) |
|||
)] |
|||
public class AbpFileManagementHttpApiModule : AbpModule |
|||
{ |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
PreConfigure<IMvcBuilder>(mvcBuilder => |
|||
{ |
|||
mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpFileManagementHttpApiModule).Assembly); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,259 @@ |
|||
using LINGYUN.Abp.FileManagement.Settings; |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.AspNetCore.StaticFiles; |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.IO; |
|||
using Volo.Abp.Settings; |
|||
|
|||
namespace LINGYUN.Abp.FileManagement |
|||
{ |
|||
[Controller] |
|||
[RemoteService(Name = "AbpFileManagement")] |
|||
[Area("file-management")] |
|||
[Route("api/file-management/file-system")] |
|||
public class FileSystemController : AbpController |
|||
{ |
|||
protected ISettingProvider SettingProvider { get; } |
|||
protected IFileSystemAppService FileSystemAppService { get; } |
|||
|
|||
public FileSystemController( |
|||
ISettingProvider settingProvider, |
|||
IFileSystemAppService fileSystemAppService) |
|||
{ |
|||
SettingProvider = settingProvider; |
|||
FileSystemAppService = fileSystemAppService; |
|||
} |
|||
|
|||
[HttpPut] |
|||
[Route("files/copy")] |
|||
public virtual async Task CopyFileAsync(FileCopyOrMoveDto input) |
|||
{ |
|||
await FileSystemAppService.CopyFileAsync(input); |
|||
} |
|||
|
|||
[HttpPut] |
|||
[Route("folders/copy")] |
|||
public virtual async Task CopyFolderAsync([Required, StringLength(255)] string path, FolderCopyDto input) |
|||
{ |
|||
await FileSystemAppService.CopyFolderAsync(path, input); |
|||
} |
|||
|
|||
[HttpPost] |
|||
[Route("files")] |
|||
public virtual async Task CreateFileAsync([FromQuery] FileCreateDto input, IFormFile file) |
|||
{ |
|||
// 检查文件大小
|
|||
var fileSizeLimited = await SettingProvider |
|||
.GetAsync( |
|||
AbpFileManagementSettingNames.FileLimitLength, |
|||
AbpFileManagementSettingNames.DefaultFileLimitLength); |
|||
if (fileSizeLimited * 1024 * 1024 < input.TotalByte) |
|||
{ |
|||
throw new UserFriendlyException(L["UploadFileSizeBeyondLimit", fileSizeLimited]); |
|||
} |
|||
// 采用分块模式上传文件
|
|||
|
|||
// 保存分块到临时目录
|
|||
var fileName = input.Name; |
|||
// 文件扩展名
|
|||
var fileExtensionName = FileHelper.GetExtension(fileName); |
|||
var fileAllowExtension = await SettingProvider |
|||
.GetOrNullAsync(AbpFileManagementSettingNames.AllowFileExtensions); |
|||
if (fileAllowExtension.IsNullOrWhiteSpace()) |
|||
{ |
|||
fileAllowExtension = AbpFileManagementSettingNames.DefaultAllowFileExtensions; |
|||
} |
|||
// 检查文件扩展名
|
|||
if (!fileAllowExtension.Split(',') |
|||
.Any(fe => fe.Equals(fileExtensionName, StringComparison.CurrentCultureIgnoreCase))) |
|||
{ |
|||
throw new UserFriendlyException(L["NotAllowedFileExtensionName", fileExtensionName]); |
|||
} |
|||
// 以上传的文件名创建一个临时目录
|
|||
var tempFilePath = Path.Combine( |
|||
Path.GetTempPath(), |
|||
"lingyun-abp-file-management", |
|||
"upload", |
|||
string.Concat(input.Path ?? "", input.Name).ToMd5()); |
|||
DirectoryHelper.CreateIfNotExists(tempFilePath); |
|||
// 以上传的分片索引创建临时文件
|
|||
var tempSavedFile = Path.Combine(tempFilePath, $"{input.CurrentByte}.{fileExtensionName}"); |
|||
try |
|||
{ |
|||
if (HttpContext.RequestAborted.IsCancellationRequested) |
|||
{ |
|||
// 如果取消请求,删除临时目录
|
|||
Directory.Delete(tempFilePath, true); |
|||
return; |
|||
} |
|||
// 保存临时文件
|
|||
using (var fs = new FileStream(tempSavedFile, FileMode.Create, FileAccess.Write)) |
|||
{ |
|||
// 写入当前分片文件
|
|||
await file.CopyToAsync(fs); |
|||
} |
|||
|
|||
if (input.CurrentByte == input.TotalByte) |
|||
{ |
|||
// 合并文件
|
|||
var mergeSavedFile = Path.Combine(tempFilePath, $"{fileName}"); |
|||
// 获取并排序所有分片文件
|
|||
var mergeFiles = Directory.GetFiles(tempFilePath).OrderBy(f => f.Length).ThenBy(f => f); |
|||
// 创建临时合并文件
|
|||
using (var mergeSavedFileStream = new FileStream(mergeSavedFile, FileMode.Create)) |
|||
{ |
|||
foreach (var mergeFile in mergeFiles) |
|||
{ |
|||
// 读取当前文件字节
|
|||
var mergeFileBytes = await FileHelper.ReadAllBytesAsync(mergeFile); |
|||
// 写入到合并文件流
|
|||
await mergeSavedFileStream.WriteAsync(mergeFileBytes, 0, mergeFileBytes.Length); |
|||
// 删除已参与合并的临时文件分片
|
|||
FileHelper.DeleteIfExists(mergeFile); |
|||
} |
|||
// 读取文件数据
|
|||
var fileData = await mergeSavedFileStream.GetAllBytesAsync(); |
|||
input.Data = fileData; |
|||
} |
|||
await FileSystemAppService.CreateFileAsync(input); |
|||
// 文件保存之后删除临时文件目录
|
|||
Directory.Delete(tempFilePath, true); |
|||
} |
|||
} |
|||
catch |
|||
{ |
|||
// 发生异常删除临时文件目录
|
|||
Directory.Delete(tempFilePath, true); |
|||
throw; |
|||
} |
|||
} |
|||
|
|||
[HttpPost] |
|||
[Route("folders")] |
|||
public virtual async Task CreateFolderAsync(FolderCreateDto input) |
|||
{ |
|||
await FileSystemAppService.CreateFolderAsync(input); |
|||
} |
|||
|
|||
[HttpDelete] |
|||
[Route("files")] |
|||
public virtual async Task DeleteFileAsync(FileDeleteDto input) |
|||
{ |
|||
await FileSystemAppService.DeleteFileAsync(input); |
|||
} |
|||
|
|||
[HttpDelete] |
|||
[Route("folders")] |
|||
public virtual async Task DeleteFolderAsync([Required, StringLength(255)] string path) |
|||
{ |
|||
await FileSystemAppService.DeleteFolderAsync(path); |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("files")] |
|||
public virtual async Task<IActionResult> DownloadFileAsync(FileSystemDownloadDto input) |
|||
{ |
|||
var tempFileName = string.Concat(input.Path ?? "", input.Name); |
|||
tempFileName = tempFileName.ToMd5() + Path.GetExtension(input.Name); |
|||
// 以上传的文件名创建一个临时目录
|
|||
var tempFilePath = Path.Combine( |
|||
Path.GetTempPath(), |
|||
"lingyun-abp-file-management", |
|||
"download"); |
|||
DirectoryHelper.CreateIfNotExists(tempFilePath); |
|||
tempFilePath = Path.Combine(tempFilePath, tempFileName); |
|||
long contentLength = 0L; |
|||
// 单个分块大小 2MB
|
|||
int bufferSize = 2 * 1024 * 1024; |
|||
using (new DisposeAction(() => |
|||
{ |
|||
// 最终下载完毕后,删除临时文件
|
|||
if (bufferSize + input.CurrentByte > contentLength) |
|||
{ |
|||
FileHelper.DeleteIfExists(tempFilePath); |
|||
} |
|||
})) |
|||
{ |
|||
if (!System.IO.File.Exists(tempFilePath)) |
|||
{ |
|||
var blobStream = await FileSystemAppService.DownloadFileAsync(input); |
|||
using (var tempFileStream = new FileStream(tempFilePath, FileMode.Create, FileAccess.Write)) |
|||
{ |
|||
blobStream.Position = 0; |
|||
await blobStream.CopyToAsync(tempFileStream); |
|||
} |
|||
} |
|||
// 读取缓存文件
|
|||
using var fileStream = new FileStream(tempFilePath, FileMode.Open, FileAccess.Read); |
|||
// 得到文件扩展名
|
|||
var fileExt = Path.GetExtension(input.Name); |
|||
var provider = new FileExtensionContentTypeProvider(); |
|||
// Http响应标头的文件类型
|
|||
string memi = provider.Mappings[fileExt]; |
|||
// 文件大小
|
|||
contentLength = fileStream.Length; |
|||
if (bufferSize > contentLength) |
|||
{ |
|||
var currentTransferBytes = await fileStream.GetAllBytesAsync(); |
|||
// 写入响应流
|
|||
return File(currentTransferBytes, memi, input.Name); |
|||
} |
|||
else |
|||
{ |
|||
// 当前分页传输字节
|
|||
byte[] currentTransferBytes = new byte[bufferSize]; |
|||
if (input.CurrentByte + bufferSize >= contentLength) |
|||
{ |
|||
currentTransferBytes = new byte[contentLength - input.CurrentByte]; |
|||
} |
|||
// 读取文件流中的当前分块区段
|
|||
fileStream.Seek(input.CurrentByte, SeekOrigin.Begin); |
|||
await fileStream.ReadAsync(currentTransferBytes, 0, currentTransferBytes.Length); |
|||
// 写入响应流
|
|||
return File(currentTransferBytes, memi, input.Name); |
|||
} |
|||
} |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("profile")] |
|||
public virtual async Task<FileSystemDto> GetAsync(FileSystemGetDto input) |
|||
{ |
|||
return await FileSystemAppService.GetAsync(input); |
|||
} |
|||
|
|||
[HttpGet] |
|||
public virtual async Task<PagedResultDto<FileSystemDto>> GetListAsync(GetFileSystemListDto input) |
|||
{ |
|||
return await FileSystemAppService.GetListAsync(input); |
|||
} |
|||
|
|||
[HttpPut] |
|||
[Route("files/move")] |
|||
public virtual async Task MoveFileAsync(FileCopyOrMoveDto input) |
|||
{ |
|||
await FileSystemAppService.MoveFileAsync(input); |
|||
} |
|||
|
|||
[HttpPut] |
|||
[Route("folders/move")] |
|||
public virtual async Task MoveFolderAsync([Required, StringLength(255)] string path, FolderMoveDto input) |
|||
{ |
|||
await FileSystemAppService.MoveFolderAsync(path, input); |
|||
} |
|||
|
|||
[HttpPut] |
|||
public virtual async Task<FileSystemDto> UpdateAsync([Required, StringLength(255)] string name, FileSystemUpdateDto input) |
|||
{ |
|||
return await FileSystemAppService.UpdateAsync(name, input); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,116 @@ |
|||
import ApiService from './serviceBase' |
|||
import { PagedAndSortedResultRequestDto, PagedResultDto } from './types' |
|||
|
|||
const serviceUrl = process.env.VUE_APP_BASE_API |
|||
const baseUrl = '/api/file-management/file-system' |
|||
export const FileManagementUrl = serviceUrl + baseUrl |
|||
|
|||
export default class FileManagementService { |
|||
public static getFileSystem(name: string, path: string | undefined) { |
|||
let _url = baseUrl + '?name=' + name |
|||
if (path) { |
|||
_url += '&path=' + path |
|||
} |
|||
return ApiService.Get<FileSystem>(_url, serviceUrl) |
|||
} |
|||
|
|||
public static getFileSystemList(payload: FileSystemGetByPaged) { |
|||
let _url = baseUrl + '?skipCount=' + payload.skipCount |
|||
_url += '&maxResultCount=' + payload.maxResultCount |
|||
_url += '&sorting=' + payload.sorting |
|||
if (payload.filter) { |
|||
_url += '&filter=' + payload.filter |
|||
} |
|||
if (payload.parent) { |
|||
_url += '&parent=' + payload.parent |
|||
} |
|||
return ApiService.Get<PagedResultDto<FileSystem>>(_url, serviceUrl) |
|||
} |
|||
|
|||
public static editFileSystem(name: string, newName: string) { |
|||
const _payload = { newName } |
|||
return ApiService.Put<FileSystem>(baseUrl, _payload, serviceUrl) |
|||
} |
|||
|
|||
public static createFolder(path: string, parent: string | undefined) { |
|||
const _url = baseUrl + '/folders' |
|||
const _payload = { |
|||
path, |
|||
parent |
|||
} |
|||
return ApiService.Post<void>(_url, _payload, serviceUrl) |
|||
} |
|||
|
|||
public static deleteFolder(path: string) { |
|||
const _url = baseUrl + '/folders?path=' + path |
|||
return ApiService.Delete(_url, serviceUrl) |
|||
} |
|||
|
|||
public static moveFolder(path: string, toPath: string) { |
|||
const _url = baseUrl + '/folders/move?path=' + path |
|||
const _payload = { toPath } |
|||
return ApiService.Put<void>(_url, _payload, serviceUrl) |
|||
} |
|||
|
|||
public static copyFolder(path: string, toPath: string) { |
|||
const _url = baseUrl + '/folders/copy?path=' + path |
|||
const _payload = { toPath } |
|||
return ApiService.Put<void>(_url, _payload, serviceUrl) |
|||
} |
|||
|
|||
public static deleteFile(path: string, name: string) { |
|||
let _url = baseUrl + '/files?path=' + path |
|||
_url += '&name=' + name |
|||
return ApiService.Delete(_url, serviceUrl) |
|||
} |
|||
|
|||
public static moveFile(payload: FileCopyOrMove) { |
|||
const _url = baseUrl + '/files/move' |
|||
return ApiService.Put<void>(_url, payload, serviceUrl) |
|||
} |
|||
|
|||
public static copyFile(payload: FileCopyOrMove) { |
|||
const _url = baseUrl + '/files/copy' |
|||
return ApiService.Put<void>(_url, payload, serviceUrl) |
|||
} |
|||
|
|||
public static downlodFle(name: string, path: string | undefined, currentByte: number | undefined) { |
|||
let _url = baseUrl + '/files?name=' + name |
|||
if (path) { |
|||
_url += '&path=' + path |
|||
} |
|||
_url += '¤tByte=' + currentByte |
|||
return ApiService.HttpRequestWithOriginResponse(({ |
|||
url: _url, |
|||
method: 'GET', |
|||
responseType: 'blob' |
|||
})) |
|||
} |
|||
} |
|||
|
|||
export enum FileSystemType { |
|||
Folder = 0, |
|||
File = 1 |
|||
} |
|||
|
|||
export class FileSystem { |
|||
type!: FileSystemType |
|||
name!: string |
|||
parent?: string |
|||
size?: number |
|||
extension?: string |
|||
creationTime!: Date |
|||
lastModificationTime?: Date |
|||
} |
|||
|
|||
export class FileSystemGetByPaged extends PagedAndSortedResultRequestDto { |
|||
parent?: string |
|||
filter?: string |
|||
} |
|||
|
|||
export class FileCopyOrMove { |
|||
path!: string |
|||
name!: string |
|||
toPath!: string |
|||
toName?: string |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
/* eslint-disable */ |
|||
/* tslint:disable */ |
|||
// @ts-ignore
|
|||
import icon from 'vue-svgicon' |
|||
icon.register({ |
|||
'admin': { |
|||
width: 128, |
|||
height: 128, |
|||
viewBox: '0 0 1024 1024', |
|||
data: '<path pid="0" _fill="#333" d="M136.533 0h204.8c75.094 0 136.534 61.44 136.534 136.533v204.8c0 75.094-61.44 136.534-136.534 136.534h-204.8C61.44 477.867 0 416.427 0 341.333v-204.8C0 61.44 61.44 0 136.533 0zm0 68.267c-40.96 0-68.266 27.306-68.266 68.266v204.8c0 40.96 27.306 68.267 68.266 68.267h204.8c40.96 0 68.267-27.307 68.267-68.267v-204.8c0-40.96-27.307-68.266-68.267-68.266h-204.8zm0 477.866h204.8c75.094 0 136.534 61.44 136.534 136.534v204.8c0 75.093-61.44 136.533-136.534 136.533h-204.8C61.44 1024 0 962.56 0 887.467v-204.8c0-75.094 61.44-136.534 136.533-136.534zm0 68.267c-40.96 0-68.266 27.307-68.266 68.267v204.8c0 40.96 27.306 68.266 68.266 68.266h204.8c40.96 0 68.267-27.306 68.267-68.266v-204.8c0-40.96-27.307-68.267-68.267-68.267h-204.8zM682.667 0h204.8C962.56 0 1024 61.44 1024 136.533v204.8c0 75.094-61.44 136.534-136.533 136.534h-204.8c-75.094 0-136.534-61.44-136.534-136.534v-204.8C546.133 61.44 607.573 0 682.667 0zm0 68.267c-40.96 0-68.267 27.306-68.267 68.266v204.8c0 40.96 27.307 68.267 68.267 68.267h204.8c40.96 0 68.266-27.307 68.266-68.267v-204.8c0-40.96-27.306-68.266-68.266-68.266h-204.8zm0 477.866h204.8c75.093 0 136.533 61.44 136.533 136.534v204.8C1024 962.56 962.56 1024 887.467 1024h-204.8c-75.094 0-136.534-61.44-136.534-136.533v-204.8c0-75.094 61.44-136.534 136.534-136.534zm0 68.267c-40.96 0-68.267 27.307-68.267 68.267v204.8c0 40.96 27.307 68.266 68.267 68.266h204.8c40.96 0 68.266-27.306 68.266-68.266v-204.8c0-40.96-27.306-68.267-68.266-68.267h-204.8z"/>' |
|||
} |
|||
}) |
|||
@ -0,0 +1,12 @@ |
|||
/* eslint-disable */ |
|||
/* tslint:disable */ |
|||
// @ts-ignore
|
|||
import icon from 'vue-svgicon' |
|||
icon.register({ |
|||
'aggregate': { |
|||
width: 128, |
|||
height: 128, |
|||
viewBox: '0 0 1024 1024', |
|||
data: '<path pid="0" _fill="#333" d="M533.333 725.333a64 64 0 11-64 64 64 64 0 0164-64m0-85.333a149.333 149.333 0 10149.334 149.333A149.333 149.333 0 00533.333 640zM426.667 277.333a106.667 106.667 0 10213.333 0 106.667 106.667 0 10-213.333 0zM170.66700000000003 320A106.667 106.667 0 10384 320a106.667 106.667 0 10-213.333 0zM682.6669999999999 320A106.667 106.667 0 10896 320a106.667 106.667 0 10-213.333 0z"/><path pid="1" _fill="#333" d="M512 341.333h42.667v384H512z"/><path pid="2" _fill="#333" d="M741.29 357.504l30.166 30.165-225.067 225.067-30.165-30.165z"/><path pid="3" _fill="#333" d="M558.08 582.016l-30.165 30.165L299.22 383.488l30.166-30.165z"/>' |
|||
} |
|||
}) |
|||
@ -0,0 +1,12 @@ |
|||
/* eslint-disable */ |
|||
/* tslint:disable */ |
|||
// @ts-ignore
|
|||
import icon from 'vue-svgicon' |
|||
icon.register({ |
|||
'api-gateway': { |
|||
width: 128, |
|||
height: 128, |
|||
viewBox: '0 0 1024 1024', |
|||
data: '<path pid="0" _fill="#333" d="M523.776 430.592l-153.088 88.576 153.088 88.576 152.576-88.576-152.576-88.576zM357.888 539.136l.512 177.152L512 803.84l-1.024-176.64-153.088-88.064zm330.24 0l-153.6 87.552-1.024 176.64 153.6-87.552 1.024-176.64zM819.2 744.96L751.104 704l39.936-8.704-5.632-26.112-67.072 14.848-13.824 23.04L805.888 768l13.312-23.04zm-142.848 7.68l68.096 40.96-39.936 8.704 5.632 26.112 67.072-14.848 13.824-23.04L689.152 729.6l-12.8 23.04zM481.28 424.96h26.624V306.176H481.28v79.36l-27.648-29.696-19.456 18.432 47.104 50.688zm53.76-118.784V424.96h26.624v-79.872l27.648 29.696 19.456-18.432-47.104-50.176H535.04zm-190.464 401.92l-13.312-23.04-68.608 40.448 11.264-38.912-25.6-7.168-18.944 66.048 13.312 23.04 101.888-60.416zm-89.088 82.944l13.312 23.04 68.608-39.936-11.264 38.912 25.6 7.168 19.456-66.048-13.312-23.04-102.4 59.904zm622.08-45.056c-45.568 0-82.432 36.864-82.432 82.432 0 45.568 36.864 82.432 82.432 82.432 45.568 0 82.432-36.864 82.432-82.432 0-45.568-36.864-82.432-82.432-82.432zm0 122.88c-22.528 0-40.448-17.92-40.448-40.448s17.92-40.448 40.448-40.448 40.448 17.92 40.448 40.448-17.92 40.448-40.448 40.448zm-355.84-576c45.568 0 82.432-36.864 82.432-82.432 0-45.568-36.864-82.432-82.432-82.432-45.568 0-82.432 36.864-82.432 82.432 0 45.568 36.864 82.432 82.432 82.432zm0-122.88c22.528 0 40.448 17.92 40.448 40.448s-17.92 40.448-40.448 40.448-40.448-17.92-40.448-40.448 18.432-40.448 40.448-40.448zM167.936 749.056c-45.568 0-82.432 36.864-82.432 82.432 0 45.568 36.864 82.432 82.432 82.432 45.568 0 82.432-36.864 82.432-82.432 0-45.568-36.864-82.432-82.432-82.432zm0 122.88c-22.528 0-40.448-17.92-40.448-40.448s17.92-40.448 40.448-40.448 40.448 17.92 40.448 40.448-18.432 40.448-40.448 40.448z"/>' |
|||
} |
|||
}) |
|||
@ -0,0 +1,12 @@ |
|||
/* eslint-disable */ |
|||
/* tslint:disable */ |
|||
// @ts-ignore
|
|||
import icon from 'vue-svgicon' |
|||
icon.register({ |
|||
'api': { |
|||
width: 128, |
|||
height: 128, |
|||
viewBox: '0 0 1024 1024', |
|||
data: '<path pid="0" _fill="#333" d="M740.8 500.8H262.4l158.4-158.4H512c8 28.8 35.2 49.6 65.6 49.6 38.4 0 70.4-32 70.4-70.4s-32-70.4-70.4-70.4c-32 0-57.6 20.8-65.6 49.6H404.8l-198.4 200h-49.6v40h148.8L488 723.2h88v49.6h139.2V633.6H576v49.6h-70.4L363.2 540.8h379.2V616l168-94.4-168-94.4v73.6zm-161.6-208c16 0 30.4 12.8 30.4 30.4S595.2 352 579.2 352s-30.4-12.8-30.4-30.4 14.4-28.8 30.4-28.8zM616 673.6h59.2v59.2H616v-59.2zm164.8-179.2l46.4 27.2-46.4 27.2v-54.4z"/>' |
|||
} |
|||
}) |
|||
@ -0,0 +1,12 @@ |
|||
/* eslint-disable */ |
|||
/* tslint:disable */ |
|||
// @ts-ignore
|
|||
import icon from 'vue-svgicon' |
|||
icon.register({ |
|||
'client': { |
|||
width: 128, |
|||
height: 107.44, |
|||
viewBox: '0 0 1220 1024', |
|||
data: '<path pid="0" _fill="#333" d="M823.532 1024H397.391a19.692 19.692 0 010-39.385h426.141a19.692 19.692 0 010 39.385zm298.93-118.154h-1024A98.462 98.462 0 010 807.385V98.462A98.462 98.462 0 0198.462 0h1024a98.462 98.462 0 0198.461 98.462v708.923a98.462 98.462 0 01-98.461 98.461zm-1024-866.461a59.077 59.077 0 00-59.077 59.077v708.923a59.077 59.077 0 0059.077 59.077h1024a59.077 59.077 0 0059.076-59.077V98.462a59.077 59.077 0 00-59.076-59.077z"/>' |
|||
} |
|||
}) |
|||
@ -0,0 +1,12 @@ |
|||
/* eslint-disable */ |
|||
/* tslint:disable */ |
|||
// @ts-ignore
|
|||
import icon from 'vue-svgicon' |
|||
icon.register({ |
|||
'file-manager': { |
|||
width: 128, |
|||
height: 128, |
|||
viewBox: '0 0 1024 1024', |
|||
data: '<path pid="0" _fill="#333" d="M958.976 977.408H70.656S0 988.16 0 893.952V131.584s1.536-84.992 88.064-84.992H399.36s37.888-7.68 69.12 40.96c29.696 47.104 47.104 76.8 47.104 76.8s10.752 12.8 36.352 12.8h400.896s70.656-7.68 70.656 70.656V898.56s10.752 78.848-64.512 78.848zm-66.048-597.504c0-18.944-15.872-34.816-34.816-34.816H166.4c-20.48 0-36.352 15.872-36.352 34.816v3.072c0 20.48 15.872 36.352 36.352 36.352h691.712c18.944 0 34.816-15.872 34.816-36.352z"/>' |
|||
} |
|||
}) |
|||
@ -0,0 +1,12 @@ |
|||
/* eslint-disable */ |
|||
/* tslint:disable */ |
|||
// @ts-ignore
|
|||
import icon from 'vue-svgicon' |
|||
icon.register({ |
|||
'file-storage': { |
|||
width: 128, |
|||
height: 128, |
|||
viewBox: '0 0 1024 1024', |
|||
data: '<path pid="0" d="M938.354 610.58H85.678V128.3H128.3V64.35h255.8l42.638 63.95h511.616z" _fill="#F6BB42"/><path pid="1" d="M980.978 674.53H43.04V192.25h42.638V128.3h255.798l42.624 63.95h596.878z" _fill="#FFCE54"/><path pid="2" d="M.4 277.496h1023.2V959.65H.4z" _fill="#656D78"/><path pid="3" d="M661.226 554.624c-23.514 0-42.624 19.14-42.624 42.624v21.326H405.428v-21.326c0-23.482-19.126-42.624-42.638-42.624-23.498 0-42.638 19.14-42.638 42.624v63.95c0 23.514 19.14 42.654 42.638 42.654h298.438c23.514 0 42.624-19.14 42.624-42.654v-63.95c-.002-23.484-19.112-42.624-42.626-42.624z" _fill="#F5F7FA"/>' |
|||
} |
|||
}) |
|||
@ -0,0 +1,12 @@ |
|||
/* eslint-disable */ |
|||
/* tslint:disable */ |
|||
// @ts-ignore
|
|||
import icon from 'vue-svgicon' |
|||
icon.register({ |
|||
'file': { |
|||
width: 128, |
|||
height: 128, |
|||
viewBox: '0 0 1024 1024', |
|||
data: '<path pid="0" d="M853.333 960H170.667V64H640l213.333 213.333z" _fill="#90CAF9"/><path pid="1" d="M821.333 298.667H618.667V96z" _fill="#E1F5FE"/>' |
|||
} |
|||
}) |
|||
@ -0,0 +1,12 @@ |
|||
/* eslint-disable */ |
|||
/* tslint:disable */ |
|||
// @ts-ignore
|
|||
import icon from 'vue-svgicon' |
|||
icon.register({ |
|||
'folder': { |
|||
width: 128, |
|||
height: 128, |
|||
viewBox: '0 0 1024 1024', |
|||
data: '<path pid="0" d="M853.333 256h-384L384 170.667H170.667c-46.934 0-85.334 38.4-85.334 85.333v170.667h853.334v-85.334c0-46.933-38.4-85.333-85.334-85.333z" _fill="#FFA000"/><path pid="1" d="M853.333 256H170.667c-46.934 0-85.334 38.4-85.334 85.333V768c0 46.933 38.4 85.333 85.334 85.333h682.666c46.934 0 85.334-38.4 85.334-85.333V341.333c0-46.933-38.4-85.333-85.334-85.333z" _fill="#FFCA28"/>' |
|||
} |
|||
}) |
|||
@ -0,0 +1,12 @@ |
|||
/* eslint-disable */ |
|||
/* tslint:disable */ |
|||
// @ts-ignore
|
|||
import icon from 'vue-svgicon' |
|||
icon.register({ |
|||
'global-setting': { |
|||
width: 128, |
|||
height: 128, |
|||
viewBox: '0 0 1024 1024', |
|||
data: '<path pid="0" _fill="#333" d="M127.792 127.778h447.935v255.96h191.971v63.99h63.99v-127.98L575.727 63.788H127.792c-35.182 0-63.99 28.808-63.99 63.991v767.882c0 35.182 28.808 63.99 63.99 63.99h319.95v-63.99h-319.95V127.778zm515.925 67.99L769.01 321.06H643.717V195.768zm315.951 545.48V666.07l-66.113-13.374c-4.44-16.749-11.126-32.558-19.56-47.24l37.244-56.179-53.118-53.12-56.176 37.246c-14.685-8.44-30.434-15.123-47.244-19.562l-13.434-66.114h-75.116l-13.434 66.114c-16.81 4.44-32.558 11.122-47.305 19.562l-56.116-37.247-53.123 53.121 37.25 56.179c-8.5 14.682-15.186 30.491-19.621 47.24l-66.06 13.434v75.116l66.06 13.434c4.435 16.81 11.122 32.62 19.62 47.241l-37.249 56.179 53.123 53.118 56.116-37.245c14.746 8.5 30.496 15.186 47.305 19.56l13.434 66.114h75.116l13.434-66.113c16.81-4.375 32.559-11.062 47.244-19.56l56.176 37.244 53.118-53.118-37.245-56.179a190.766 190.766 0 0019.56-47.24l66.114-13.435zm-256.024 90.357c-70.673 0-127.917-57.24-127.917-127.979 0-70.676 57.243-127.98 127.917-127.98 70.74.064 128.044 57.367 128.044 127.98 0 70.74-57.304 127.98-128.044 127.98z"/>' |
|||
} |
|||
}) |
|||
@ -0,0 +1,12 @@ |
|||
/* eslint-disable */ |
|||
/* tslint:disable */ |
|||
// @ts-ignore
|
|||
import icon from 'vue-svgicon' |
|||
icon.register({ |
|||
'group': { |
|||
width: 128, |
|||
height: 128, |
|||
viewBox: '0 0 1024 1024', |
|||
data: '<path pid="0" _fill="#333" d="M512 704.1c-4.7 0-9.4-1-13.8-3.1l-352-168.1c-11.2-5.4-18.3-16.7-18.2-29.2.1-12.4 7.4-23.7 18.8-28.8l88-40c16.1-7.3 35.1-.2 42.4 15.9 7.3 16.1.2 35.1-15.9 42.4l-25.5 11.6L512 636.6l276.2-131.9-21.1-9.6c-16.1-7.3-23.2-26.3-15.9-42.4 7.3-16.1 26.3-23.2 42.4-15.9l83.7 38c11.3 5.1 18.6 16.4 18.8 28.8.1 12.4-7 23.8-18.2 29.2l-352 168.1c-4.5 2.1-9.2 3.2-13.9 3.2zm0 192c-4.7 0-9.4-1-13.8-3.1l-352-168.1c-11.2-5.4-18.3-16.7-18.2-29.2.1-12.4 7.4-23.7 18.8-28.8l88-40c16.1-7.3 35.1-.2 42.4 15.9 7.3 16.1.2 35.1-15.9 42.4l-25.5 11.6L512 828.6l276.2-131.9-21.1-9.6c-16.1-7.3-23.2-26.3-15.9-42.4 7.3-16.1 26.3-23.2 42.4-15.9l83.7 38c11.3 5.1 18.6 16.4 18.8 28.8.1 12.4-7 23.8-18.2 29.2l-352 168.1c-4.5 2.1-9.2 3.2-13.9 3.2zm.1-381.1c-4.5 0-9.1-1-13.3-2.9l-8.6-3.9c-.1-.1-.2-.1-.3-.2L146.4 346.5c-11.3-5.3-18.5-16.8-18.4-29.3.1-12.5 7.5-23.8 18.9-28.9l352-157.5c8.3-3.7 17.8-3.7 26.1 0l352 157.5c11.4 5.1 18.8 16.4 18.9 28.9.1 12.5-7.1 23.9-18.4 29.3L534.2 508c-.1 0-.1.1-.2.1l-8.5 3.9c-4.3 2-8.8 3-13.4 3zm8.5-35.9zM236.7 318.3L512 447.7l275.3-129.5L512 195.1 236.7 318.3z"/>' |
|||
} |
|||
}) |
|||
File diff suppressed because one or more lines are too long
@ -0,0 +1,12 @@ |
|||
/* eslint-disable */ |
|||
/* tslint:disable */ |
|||
// @ts-ignore
|
|||
import icon from 'vue-svgicon' |
|||
icon.register({ |
|||
'identity': { |
|||
width: 128, |
|||
height: 128, |
|||
viewBox: '0 0 1024 1024', |
|||
data: '<path pid="0" _fill="#333" d="M824.32 874.24H223.36c-64 0-115.84-51.84-115.84-115.84V314.24c0-64 51.84-115.84 115.84-115.84h600.96c64 0 115.84 51.84 115.84 115.84V758.4c-.64 63.36-52.48 115.84-115.84 115.84zM223.36 262.4c-28.8 0-51.84 23.04-51.84 51.84V758.4c0 28.8 23.04 51.84 51.84 51.84h600.96c28.8 0 51.84-23.04 51.84-51.84V314.24c0-28.8-23.04-51.84-51.84-51.84H223.36z"/><path pid="1" _fill="#333" d="M416 593.28H307.84c-48 0-86.4-39.04-86.4-86.4v-108.8c0-48 39.04-86.4 86.4-86.4H416c48 0 86.4 39.04 86.4 86.4v108.16c0 48-38.4 87.04-86.4 87.04zm-108.16-217.6c-12.8 0-22.4 10.24-22.4 22.4v108.16c0 12.8 10.24 22.4 22.4 22.4H416c12.8 0 22.4-10.24 22.4-22.4V398.08c0-12.8-10.24-22.4-22.4-22.4H307.84zm465.28 122.88h-172.8c-17.92 0-32-14.08-32-32s14.08-32 32-32h172.16c17.92 0 32 14.08 32 32s-14.08 32-31.36 32zm20.48 238.72H259.2c-17.92 0-32-14.08-32-32s14.08-32 32-32h534.4c17.92 0 32 14.08 32 32s-14.72 32-32 32z"/>' |
|||
} |
|||
}) |
|||
@ -0,0 +1,12 @@ |
|||
/* eslint-disable */ |
|||
/* tslint:disable */ |
|||
// @ts-ignore
|
|||
import icon from 'vue-svgicon' |
|||
icon.register({ |
|||
'organization-unit': { |
|||
width: 128, |
|||
height: 128, |
|||
viewBox: '0 0 1024 1024', |
|||
data: '<path pid="0" _fill="#333" d="M642.465 52.212c6.51 0 19.532 6.51 19.532 19.563V241.4c0 6.543-6.479 19.564-19.532 19.564H388.013c-6.51-6.51-13.053-13.053-13.053-26.074V65.265c0-6.575 6.543-19.564 19.596-19.564h247.91v6.51zm0-52.212H388.013c-39.159 0-65.232 32.584-65.232 65.265v169.592c0 32.584 26.073 65.264 65.232 65.264h254.452c39.127 0 65.201-32.68 65.201-65.264V65.265C707.666 32.616 681.56 0 642.466 0M224.93 815.44v163.178H61.818V815.441H224.93zm19.596-52.18H48.765c-19.563 0-32.584 12.99-32.584 32.585v195.762c0 19.595 13.052 32.648 32.584 32.648h195.73c19.563 0 32.584-13.053 32.584-32.648V795.845c.032-19.595-19.563-32.584-32.552-32.584m345.663 52.18v163.177H427.14V815.441h163.05zm13.117-52.18h-195.73c-19.564 0-32.585 12.989-32.585 32.584v195.762c0 19.595 13.053 32.648 32.585 32.648h195.73c19.563 0 32.584-13.053 32.584-32.648V795.845c.032-19.595-12.989-32.584-32.584-32.584m358.811 52.18v163.177H799.037V815.441h163.081zm13.085-52.18H779.41c-19.563 0-32.552 12.989-32.552 32.584v195.762c0 19.595 12.957 32.648 32.552 32.648h195.794c19.532 0 32.585-13.053 32.585-32.648V795.845c0-19.595-13.053-32.584-32.585-32.584M505.426 345.823c-13.053 0-19.532 6.446-19.532 19.563v326.163c0 12.99 6.479 19.532 19.532 19.532s19.563-6.542 19.563-19.532V365.386c6.543-13.117-6.51-19.563-19.563-19.563m352.3 110.838H140.168c-13.085 0-19.595 13.02-19.595 19.563 0 6.606 6.51 26.17 19.595 26.17h717.56c13.02 0 19.531-13.053 19.531-19.564 0-6.606-6.51-26.17-19.531-26.17zm-717.559 0c-13.085 0-19.595 13.02-19.595 19.563v182.741c0 13.053 13.053 19.532 19.595 19.532 6.479 0 19.564-13.053 19.564-19.532V482.83c-.032-13.148-6.575-26.17-19.564-26.17zm717.56 0c-13.053 0-19.564 13.02-19.564 19.563v182.741c0 13.053 13.053 19.532 19.564 19.532s19.531-13.053 19.531-19.532V482.83c0-13.148-6.51-26.17-19.531-26.17z"/>' |
|||
} |
|||
}) |
|||
@ -0,0 +1,12 @@ |
|||
/* eslint-disable */ |
|||
/* tslint:disable */ |
|||
// @ts-ignore
|
|||
import icon from 'vue-svgicon' |
|||
icon.register({ |
|||
'route': { |
|||
width: 128, |
|||
height: 120.47, |
|||
viewBox: '0 0 1088 1024', |
|||
data: '<path pid="0" _fill="#333" d="M896 576H608v384a64 64 0 01-64 64H384a64 64 0 01-64-64V576H64a64 64 0 01-64-64V192a64 64 0 0164-64h256V64a64 64 0 0164-64h160a64 64 0 0164 64v64h288l192 192v64zM384 960h160V576H384v384zM544 64H384v64h160V64zm320 128H64v320h800l160-160z"/>' |
|||
} |
|||
}) |
|||
@ -0,0 +1,12 @@ |
|||
/* eslint-disable */ |
|||
/* tslint:disable */ |
|||
// @ts-ignore
|
|||
import icon from 'vue-svgicon' |
|||
icon.register({ |
|||
'tenant': { |
|||
width: 128, |
|||
height: 117.34, |
|||
viewBox: '0 0 1117 1024', |
|||
data: '<path pid="0" _fill="#333" d="M897.536 979.55h-18.432c-25.786 0-49.431-17.549-58.694-42.264-4.189-1.955-9.402-4.096-13.405-6.098a73.542 73.542 0 01-25.88 5.027c-16.662.233-32.628-6.516-44.124-18.525l-13.498-13.312a63.86 63.86 0 01-13.312-70.05c-2.095-4.19-4.143-8.146-6.238-13.266-25.832-9.31-44.264-33.047-44.264-58.834V742.68c0-25.74 18.432-49.431 43.24-58.694l6.144-12.427s0-.931 1.118-.931a69.818 69.818 0 01-5.12-25.833c0-16.43 6.19-32.907 18.478-44.265l13.498-13.498c11.544-11.869 27.462-18.525 44.079-18.432 9.309 0 17.687 2.141 25.88 5.167 4.049-2.095 9.262-4.143 12.334-5.167a63.209 63.209 0 0158.693-41.146h18.526c25.786 0 49.43 17.455 58.74 42.263 4.096 1.955 9.216 4.096 13.265 6.144 8.1-3.723 16.99-5.492 25.926-5.027 16.43 0 32.861 6.051 44.125 18.386l13.498 13.405c18.246 18.432 23.506 46.08 13.312 69.911 2.142 4.143 4.19 8.378 6.191 13.498 24.576 9.123 40.96 32.443 41.193 58.648v18.525c0 26.81-17.455 49.431-42.264 58.74-2.001 4.19-4.096 9.31-6.237 13.405 3.259 8.239 5.26 16.43 5.26 25.786 0 16.431-6.237 32.955-18.525 44.265l-12.428 12.381a61.454 61.454 0 01-44.125 18.525c-9.402 0-17.547-2.048-25.926-5.073-4.142 2.048-8.145 4.142-13.265 6.097a61.905 61.905 0 01-57.716 42.217m-83.038-96.023c1.77 0 4.655.93 6.517 1.769l5.632 2.792c5.539 2.886 11.17 5.586 15.825 7.54 4.655 1.77 8.425 5.586 9.356 10.194a29.556 29.556 0 0027.927 24.204h16.85a29.556 29.556 0 0027.927-24.204 14.662 14.662 0 019.309-10.24c6.563-1.862 13.964-5.585 21.41-9.356a15.267 15.267 0 0114.058.931c9.309 6.517 26.065 5.632 35.42-4.654l12.103-12.195a28.44 28.44 0 008.47-20.434 33.187 33.187 0 00-4.654-15.965c-2.792-3.584-2.792-9.17-.977-13.87l1.862-2.746c2.792-6.563 6.516-13.126 8.378-18.712a14.895 14.895 0 0110.24-9.309 29.79 29.79 0 0023.273-27.927v-17.687a29.65 29.65 0 00-23.273-28.02 14.522 14.522 0 01-10.24-9.403c-2.793-7.447-5.586-14.894-9.31-21.364a14.895 14.895 0 01.932-14.057 29.556 29.556 0 00-3.77-36.305l-13.033-12.102c-9.402-9.402-25.135-11.171-35.375-3.724a15.127 15.127 0 01-14.103.838 94.301 94.301 0 00-21.411-9.31 14.988 14.988 0 01-9.31-10.24 29.696 29.696 0 00-27.926-23.272h-16.85a29.556 29.556 0 00-27.927 23.273 14.708 14.708 0 01-9.31 10.24c-6.516 1.862-13.078 4.654-21.503 9.309a14.801 14.801 0 01-13.964-.884c-10.24-7.448-26.065-5.632-36.352 3.723l-12.195 12.195a28.858 28.858 0 00-3.677 36.306c2.793 3.863 2.793 9.448.931 14.01-1.862 2.84-2.793 5.678-4.608 8.425a58.175 58.175 0 00-6.516 12.94 15.034 15.034 0 01-10.287 9.401c-12.148 2.7-25.134 13.964-25.134 27.974v16.757c0 13.963 12.986 25.18 25.134 27.927 4.655.93 8.378 4.654 10.333 9.402 1.769 5.539 4.515 11.264 7.448 16.756l2.7 4.562a15.174 15.174 0 01-.932 14.103 28.719 28.719 0 004.562 36.352l12.148 12.102c9.775 9.542 24.855 11.078 36.399 3.724a18.804 18.804 0 017.493-1.77m71.68-52.084a77.545 77.545 0 01-77.824-77.963c0-43.24 34.444-77.87 77.824-77.87 43.38 0 77.871 34.583 77.871 77.87 0 42.542-35.375 77.963-77.87 77.963zm0-123.67a45.056 45.056 0 00-44.87 44.916c0 24.715 20.201 44.962 44.87 44.962 24.716 0 44.963-20.247 44.963-44.962a45.103 45.103 0 00-44.963-44.917zM517.12 500.875a246.086 246.086 0 01-245.9-245.807A246.086 246.086 0 01517.073 9.263a246.132 246.132 0 01245.9 245.806 246.225 246.225 0 01-245.9 245.807zm0-432.082a186.415 186.415 0 00-186.275 186.182A186.415 186.415 0 00517.12 441.251a186.415 186.415 0 00186.228-186.228A186.415 186.415 0 00517.167 68.794zM62.045 988.393c-.652-9.449-14.801-232.681 125.021-382.744 80.198-86.016 193.63-129.675 337.455-129.675 226.024 0 275.549 93.742 280.39 104.355l-54.226 24.762c-.046 0-39.377-69.446-226.21-69.446-126.325 0-225.095 37.143-293.516 110.313C108.823 776.75 121.39 982.156 121.437 984.204l-59.392 4.189zm5.586-293.935H8.052c0-86.342 105.565-189.812 194.095-261.446 1.862-1.443.698-4.747-.466-6.423-130.7-190.836 26.066-366.173 27.742-367.942l43.985 40.169c-5.167 5.772-126.278 142.708-22.528 294.12 19.41 28.533 14.522 65.63-11.31 86.482C133.538 565.155 67.63 647.54 67.63 694.458z"/>' |
|||
} |
|||
}) |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue