Compare commits

..
10 Commits
Author SHA1 Message Date
saherelm 6e701376df last ... 2026-07-26 21:20:28 +03:30
saherelm 41f220d145 last ... 2026-06-12 23:50:11 +03:30
saherelm c3b9b3e43a Update Lang Version to 12 ... 2026-06-12 02:13:53 +03:30
saherelm 8a66b8b7e9 last ... 2026-05-28 19:15:14 +03:30
saherelm 7e08427539 last ... 2026-05-22 20:24:17 +03:30
saherelm b26767e126 refactor csproj ... 2026-04-14 17:00:25 +03:30
saherelm 83b907988b resolve dependencies ... 2025-12-22 01:36:11 +03:30
saherelm dd23ed4f64 Fix Dependencies for Local Development ... 2025-12-07 12:46:48 +03:30
saherelm 330a3958f3 update FileProvider and downgrade it for resolving publish issues ... 2025-07-13 02:30:04 +03:30
saherelm d85dbcfdf7 Add ConvertToFileUrl in IXStorageProvider ... 2025-07-12 11:12:16 +03:30
4 changed files with 482 additions and 307 deletions
+61 -42
View File
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.FileProviders;
@@ -11,7 +12,8 @@ using xStorageService.Models;
namespace xStorageService.Interfaces
{
public partial interface IXStorageProvider {
public partial interface IXStorageProvider
{
XStorageConfiguration Configuration { get; }
XStorageHelper StorageHelper { get; }
IFileProvider FileProvider { get; }
@@ -19,84 +21,101 @@ namespace xStorageService.Interfaces
//
#region Special Folders Path Getter (s) ...
string GetStorageFolderPath ();
string GetTempFolderPath ();
string GetThumbFolderPath ();
string GetUploadsFolderPath ();
string GetWidgetsFolderPath ();
string GetImageFolderPath ();
string GetAudioFolderPath ();
string GetVideoFolderPath ();
string GetDocumentFolderPath ();
string FilePathResolver (string fullPath);
string GetStorageFolderPath();
string GetTempFolderPath();
string GetThumbFolderPath();
string GetUploadsFolderPath();
string GetWidgetsFolderPath();
string GetImageFolderPath();
string GetAudioFolderPath();
string GetVideoFolderPath();
string GetDocumentFolderPath();
string FilePathResolver(string fullPath);
string ConvertToFileUrl(string fullPath);
#endregion
//
#region Prepare Storage Structure ...
void Prepare ();
void Prepare();
#endregion
//
#region Validators ...
bool IsFolderExists (string path);
bool IsFileExists (string filePath);
bool IsSupportThumb (string fileName);
bool IsSupportThumb (XFileType type);
void ValidateFileExists (string filePath);
void ValidateFileModel (XFileDto file);
void ValidateFile (IFormFile file);
void ValidateProfileImage (IFormFile file);
bool IsFolderExists(string path);
bool IsFileExists(string filePath);
bool IsSupportThumb(string fileName);
bool IsSupportThumb(XFileType type);
void ValidateFileExists(string filePath);
void ValidateFileModel(XFileDto file);
void ValidateFile(IFormFile file);
void ValidateProfileImage(IFormFile file);
#endregion
//
#region Generators ...
string NewFileName ();
string GenerateThumbName (string fileName);
string GetNewFileName (string fileName);
string NewFileName();
string GenerateThumbName(string fileName);
string GetNewFileName(string fileName);
#endregion
//
#region Tools Actions ...
string GetFileExtension (string fileName);
string GetFileNameWithoutExtension (string fileName);
FileExtensions GetFileExtensionType (string fileName);
XFileType GetFileType (string fileName);
XFileType GetFileType (FileExtensions fileExtension);
string GetThumbnailFileFullPath (string thumFileName);
string GetRelatedThumbnailFullPath (string fileName);
string GetFileTypeFolderPath (XFileType type);
string GetFileFolderPath (
string GetFileExtension(string fileName);
string GetFileNameWithoutExtension(string fileName);
FileExtensions GetFileExtensionType(string fileName);
XFileType GetFileType(string fileName);
XFileType GetFileType(FileExtensions fileExtension);
string GetThumbnailFileFullPath(string thumFileName);
string GetRelatedThumbnailFullPath(string fileName);
string GetFileTypeFolderPath(XFileType type);
string GetFileFolderPath(
string fileName,
bool isTemp = false,
bool isWidget = false
);
string GetFileFullPath (
string GetFileFullPath(
string fileName,
bool isTemp = false,
bool isWidget = false
);
Task<string> SaveFileAsync (
Task<string> SaveFileAsync(
IFormFile file,
bool isTemp = false,
bool isWidget = false
bool isWidget = false,
CancellationToken cancellationToken = default
);
void DeleteFile (
void DeleteFile(
string fileFullPath,
bool forceFileExists = true,
Exception exception = null
);
ICollection<string> DeleteFiles (
ICollection<string> DeleteFiles(
ICollection<string> fileFullPaths,
bool forceFileExists = true,
Exception exception = null
);
// Task CreateThumbnail (XFile file);
Task CreateThumbnail (XFileDto file);
Task CreateThumbnail (string fileName);
Task<XFileResult> HandleProfileImageSave (IFormFile file);
Task<XFileResult> HandleFileSave (IFormFile file);
Task<IEnumerable<XFileResult>> HandleFilesSave (IFormFileCollection files);
Task CreateThumbnail(
XFileDto file,
CancellationToken cancellationToken = default
);
Task CreateThumbnail(
string fileName,
CancellationToken cancellationToken = default
);
Task<XFileResult> HandleProfileImageSave(
IFormFile file,
CancellationToken cancellationToken = default
);
Task<XFileResult> HandleFileSave(
IFormFile file,
CancellationToken cancellationToken = default
);
Task<IEnumerable<XFileResult>> HandleFilesSave(
IFormFileCollection files,
CancellationToken cancellationToken = default
);
#endregion
}
}
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!-- <add key="megan" value="https://hub.megan.ir/nuget/index.json" /> -->
<add key="nuget" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="liget" value="https://nuget.saherelmhub.ir/v3/index.json" protocolVersion="3" />
<add key="baget" value="https://nuget.saherelmhub.ir/v3/index.json" protocolVersion="3" disableTLSCertificateValidation="true" />
</packageSources>
</configuration>
+19 -6
View File
@@ -2,11 +2,13 @@
<!-- Runtime Definition -->
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageId>xDashboard.xStorageService</PackageId>
<Version>1.0.0</Version>
<LangVersion>12.0</LangVersion>
<Authors>Hadi Khazaee Asl</Authors>
<Company>SaherElm IT Center</Company>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageId>xDashboard.xStorageService</PackageId>
<Description>
provide File Storage/Validating/Handling and etc tools to xDashboard project.
</Description>
@@ -17,19 +19,30 @@
<!-- Icon Handling -->
<ItemGroup>
<None Include="../../Resources/Images/favicon.png" Link="icon.png" Pack="true" PackagePath="\icon.png" />
<None Include="../../Resources/Images/favicon.png" Link="icon.png" Pack="true"
PackagePath="\icon.png" />
</ItemGroup>
<!-- Local Modules -->
<ItemGroup>
<PackageReference Include="xDashboard.xModels" Version="1.0.0" />
<!-- <ProjectReference Include="../xModels/xModels.csproj" /> -->
</ItemGroup>
<!-- Local Dependencies -->
<ItemGroup>
<ProjectReference Include="../xModels/xModels.csproj" />
</ItemGroup>
<!-- Dependencies -->
<ItemGroup>
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="7.23.1" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="3.1.32.0" />
</ItemGroup>
<!-- For XML Documentation Support -->
<PropertyGroup>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>
</Project>