From d0234fef2ca41f0021a6a6802558fdff96881675 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Thu, 22 Oct 2026 23:30:09 +0330 Subject: [PATCH] Update ... --- Constants/FileExtensions.cs | 140 -------------------------------- Helpers/XStorageHelper.cs | 7 +- Interfaces/IXStorageProvider.cs | 5 +- Providers/XStorageProvider.cs | 11 ++- 4 files changed, 10 insertions(+), 153 deletions(-) delete mode 100644 Constants/FileExtensions.cs diff --git a/Constants/FileExtensions.cs b/Constants/FileExtensions.cs deleted file mode 100644 index 6b2df94..0000000 --- a/Constants/FileExtensions.cs +++ /dev/null @@ -1,140 +0,0 @@ -using xExceptions.Attributes; - -namespace xStorageService.Constants { - public enum FileExtensions { - // - // Document - [StringValue (".txt")] - TEXT = 100, - - [StringValue (".pdf")] - PDF = 101, - - [StringValue (".ppt")] - PPT = 102, - - [StringValue (".pptx")] - PPTX = 103, - - [StringValue (".odp")] - ODP = 104, - - [StringValue (".pps")] - PPS = 105, - - [StringValue (".ods")] - ODS = 106, - - [StringValue (".xlr")] - XLR = 107, - - [StringValue (".xls")] - XLS = 108, - - [StringValue (".xlsx")] - XLSX = 109, - - [StringValue (".xml")] - XML = 110, - - [StringValue (".doc")] - DOC = 111, - - [StringValue (".docx")] - DOCX = 112, - - [StringValue (".odt")] - ODT = 113, - - [StringValue (".rtf")] - RTF = 114, - - [StringValue (".tex")] - TEX = 115, - - [StringValue (".wpd")] - WPD = 116, - - [StringValue (".md")] - MD = 117, - - // - // Archive - [StringValue (".zip")] - ZIP = 200, - - // - // Internal Supports - [StringValue (".ttf")] - TTF = 300, - - [StringValue (".js")] - JAVASCRIPT = 301, - - [StringValue (".css")] - CSS = 302, - - [StringValue (".htm")] - HTM = 303, - - [StringValue (".html")] - HTML = 304, - - [StringValue (".sdw")] - SAHER_DASHBOARD_WIDGET = 305, - - [StringValue (".sdwmanifest")] - SAHER_DASHBOARD_WIDGET_MANIFEST = 306, - - // - // Video - [StringValue (".mp4")] - MP4 = 400, - - [StringValue (".avi")] - AVI = 401, - - [StringValue (".mpg")] - MPG = 402, - - [StringValue (".mpeg")] - MPEG = 403, - - [StringValue (".wmv")] - WMV = 404, - - // - // Audio - [StringValue (".mp3")] - MP3 = 500, - - [StringValue (".ogg")] - OGG = 501, - - [StringValue (".wav")] - WAV = 502, - - [StringValue (".wma")] - WMA = 503, - - // - // Image - [StringValue (".png")] - PNG = 600, - - [StringValue (".jpeg")] - JPEG = 601, - - [StringValue (".jpg")] - JPG = 602, - - // [StringValue (".ico")] - // ICON = 603, - - [StringValue (".gif")] - GIF = 604, - - [StringValue (".bmp")] - BITMAP = 605, - } -} \ No newline at end of file diff --git a/Helpers/XStorageHelper.cs b/Helpers/XStorageHelper.cs index 743e887..f6c0f09 100644 --- a/Helpers/XStorageHelper.cs +++ b/Helpers/XStorageHelper.cs @@ -4,7 +4,6 @@ using System.Linq; using xCommons.Constants; using xCommons.Extensions; using xExceptions.Constants; -using xStorageService.Constants; namespace xStorageService.Helpers { public partial class XStorageHelper { @@ -63,7 +62,7 @@ namespace xStorageService.Helpers { /// an string array public string[] GetAllowedExtensionsForWidgetUpload () { return new [] { - FileExtensions.SAHER_DASHBOARD_WIDGET.GetStringValue () + XFileExtensions.SAHER_DASHBOARD_WIDGET.GetStringValue () }; } @@ -120,8 +119,8 @@ namespace xStorageService.Helpers { public int GetExtensionType (string fileExtension) { // foreach (var extItem in Enum - .GetValues (typeof (FileExtensions)) - .Cast ()) { + .GetValues (typeof (XFileExtensions)) + .Cast ()) { if (extItem.GetStringValue () .Contains (fileExtension.ToLower ())) { return (int) extItem; diff --git a/Interfaces/IXStorageProvider.cs b/Interfaces/IXStorageProvider.cs index 7d32721..2b5f7a5 100644 --- a/Interfaces/IXStorageProvider.cs +++ b/Interfaces/IXStorageProvider.cs @@ -6,7 +6,6 @@ using System.Threading.Tasks; using xStorageService.Models; using xStorageService.Helpers; using Microsoft.AspNetCore.Http; -using xStorageService.Constants; using System.Collections.Generic; using Microsoft.Extensions.FileProviders; @@ -63,9 +62,9 @@ namespace xStorageService.Interfaces string GetFileExtension(string fileName); string GetFileNameWithoutExtension(string fileName); - FileExtensions GetFileExtensionType(string fileName); + XFileExtensions GetFileExtensionType(string fileName); XFileType GetFileType(string fileName); - XFileType GetFileType(FileExtensions fileExtension); + XFileType GetFileType(XFileExtensions fileExtension); string GetThumbnailFileFullPath(string thumFileName); string GetRelatedThumbnailFullPath(string fileName); string GetFileTypeFolderPath(XFileType type); diff --git a/Providers/XStorageProvider.cs b/Providers/XStorageProvider.cs index b973bff..16ad9eb 100644 --- a/Providers/XStorageProvider.cs +++ b/Providers/XStorageProvider.cs @@ -10,7 +10,6 @@ using System.Threading.Tasks; using xStorageService.Models; using xStorageService.Helpers; using Microsoft.AspNetCore.Http; -using xStorageService.Constants; using System.Collections.Generic; using xStorageService.Interfaces; using System.Collections.ObjectModel; @@ -522,7 +521,7 @@ namespace xStorageService.Providers /// /// /// - public FileExtensions GetFileExtensionType(string fileName) + public XFileExtensions GetFileExtensionType(string fileName) { // var fileExt = GetFileExtension(fileName); @@ -539,7 +538,7 @@ namespace xStorageService.Providers } // - return (FileExtensions)result; + return (XFileExtensions)result; } /// @@ -559,7 +558,7 @@ namespace xStorageService.Providers /// /// /// - public XFileType GetFileType(FileExtensions fileExtension) + public XFileType GetFileType(XFileExtensions fileExtension) { return StorageHelper.GetType((int)fileExtension); } @@ -1020,8 +1019,8 @@ namespace xStorageService.Providers { // var savedFileName = await SaveFileAsync( - file, - isTemp: false, + file, + isTemp: false, isWidget: false, cancellationToken: cancellationToken );