Add File Type and Detectors and Mime Type tools and Refactor Grouping ...

This commit is contained in:
2026-10-23 00:14:00 +03:30
parent caeb6ae7f3
commit 6f6ba825d6
14 changed files with 1427 additions and 8 deletions
+1
View File
@@ -2,6 +2,7 @@ namespace xCommons.Constants {
public partial struct ConfigurationNodeNames {
public const string CERTIFICATES_NODE = "Certificates";
public const string SWAGGER_NODE = "SwaggerConfiguration";
public const string FILE_TYPE_DETECTOR_NODE = "FileTypeDetectorConfiguration";
public const string MESSAGE_RESOURCE_TITLES_NODE = "MessageResourceTitles";
}
}
+221
View File
@@ -0,0 +1,221 @@
using xExceptions.Attributes;
namespace xCommons.Constants
{
/// <summary>
/// File Extensions Enumerable ...
///
/// Document: 100–133
/// Archive: 200–202
/// Internal Supports: 300–302
/// Video: 400–405
/// Audio: 500–505
/// Image: 600–609
/// </summary>
public enum XFileExtensions
{
//
#region 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,
[StringValue(".cs")]
CSHARP = 118,
[StringValue(".py")]
PYTHON = 119,
[StringValue(".js")]
JAVASCRIPT = 120,
[StringValue(".ts")]
TYPESCRIPT = 121,
[StringValue(".java")]
JAVA = 122,
[StringValue(".go")]
GO = 123,
[StringValue(".rs")]
RUST = 124,
[StringValue(".rb")]
RUBY = 125,
[StringValue(".php")]
PHP = 126,
[StringValue(".csv")]
CSV = 127,
[StringValue(".json")]
JSON = 128,
[StringValue(".yml")]
YML = 129,
[StringValue(".yaml")]
YAML = 130,
[StringValue(".css")]
CSS = 131,
[StringValue(".htm")]
HTM = 132,
[StringValue(".html")]
HTML = 133,
#endregion
//
#region Archive ...
[StringValue(".zip")]
ZIP = 200,
[StringValue(".rar")]
RAR = 201,
[StringValue(".7z")]
SEVENZIP = 202,
#endregion
//
#region Internal Supports ...
[StringValue(".ttf")]
TTF = 300,
[StringValue(".sdw")]
SAHER_DASHBOARD_WIDGET = 301,
[StringValue(".sdwmanifest")]
SAHER_DASHBOARD_WIDGET_MANIFEST = 302,
#endregion
//
#region Video ...
[StringValue(".mp4")]
MP4 = 400,
[StringValue(".avi")]
AVI = 401,
[StringValue(".mpg")]
MPG = 402,
[StringValue(".mpeg")]
MPEG = 403,
[StringValue(".wmv")]
WMV = 404,
[StringValue(".webm")]
WEBM = 405,
#endregion
//
#region Audio ...
[StringValue(".mp3")]
MP3 = 500,
[StringValue(".ogg")]
OGG = 501,
[StringValue(".wav")]
WAV = 502,
[StringValue(".wma")]
WMA = 503,
[StringValue(".aac")]
AAC = 504,
[StringValue(".m4a")]
M4A = 505,
#endregion
//
#region 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,
[StringValue(".webp")]
WEBP = 606,
[StringValue(".tif")]
TIF = 607,
[StringValue(".tiff")]
TIFF = 608,
[StringValue(".svg")]
SVG = 609,
#endregion
}
}
+221
View File
@@ -0,0 +1,221 @@
using xExceptions.Attributes;
namespace xCommons.Constants
{
/// <summary>
/// MIME Types mapped to XFileExtensions ...
///
/// Document: 100–133
/// Archive: 200–202
/// Internal Supports: 300–302
/// Video: 400–405
/// Audio: 500–505
/// Image: 600–609
/// </summary>
public enum XFileMimeTypes
{
//
#region Document ...
[StringValue("text/plain")]
TEXT = 100,
[StringValue("application/pdf")]
PDF = 101,
[StringValue("application/vnd.ms-powerpoint")]
PPT = 102,
[StringValue("application/vnd.openxmlformats-officedocument.presentationml.presentation")]
PPTX = 103,
[StringValue("application/vnd.oasis.opendocument.presentation")]
ODP = 104,
[StringValue("application/vnd.ms-powerpoint")]
PPS = 105,
[StringValue("application/vnd.oasis.opendocument.spreadsheet")]
ODS = 106,
[StringValue("application/vnd.ms-excel")]
XLR = 107,
[StringValue("application/vnd.ms-excel")]
XLS = 108,
[StringValue("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")]
XLSX = 109,
[StringValue("text/xml")]
XML = 110,
[StringValue("application/msword")]
DOC = 111,
[StringValue("application/vnd.openxmlformats-officedocument.wordprocessingml.document")]
DOCX = 112,
[StringValue("application/vnd.oasis.opendocument.text")]
ODT = 113,
[StringValue("application/rtf")]
RTF = 114,
[StringValue("application/x-tex")]
TEX = 115,
[StringValue("application/vnd.wordperfect")]
WPD = 116,
[StringValue("text/markdown")]
MD = 117,
[StringValue("text/x-csharp")]
CSHARP = 118,
[StringValue("text/x-python")]
PYTHON = 119,
[StringValue("application/javascript")]
JAVASCRIPT = 120,
[StringValue("application/typescript")]
TYPESCRIPT = 121,
[StringValue("text/x-java")]
JAVA = 122,
[StringValue("text/x-go")]
GO = 123,
[StringValue("text/x-rust")]
RUST = 124,
[StringValue("text/x-ruby")]
RUBY = 125,
[StringValue("text/x-php")]
PHP = 126,
[StringValue("text/csv")]
CSV = 127,
[StringValue("application/json")]
JSON = 128,
[StringValue("application/x-yaml")]
YML = 129,
[StringValue("application/x-yaml")]
YAML = 130,
[StringValue("text/css")]
CSS = 131,
[StringValue("text/html")]
HTM = 132,
[StringValue("text/html")]
HTML = 133,
#endregion
//
#region Archive ...
[StringValue("application/zip")]
ZIP = 200,
[StringValue("application/x-rar-compressed")]
RAR = 201,
[StringValue("application/x-7z-compressed")]
SEVENZIP = 202,
#endregion
//
#region Internal Supports ...
[StringValue("font/ttf")]
TTF = 300,
[StringValue("application/x-sdw")]
SAHER_DASHBOARD_WIDGET = 301,
[StringValue("application/x-sdwmanifest")]
SAHER_DASHBOARD_WIDGET_MANIFEST = 302,
#endregion
//
#region Video ...
[StringValue("video/mp4")]
MP4 = 400,
[StringValue("video/x-msvideo")]
AVI = 401,
[StringValue("video/mpeg")]
MPG = 402,
[StringValue("video/mpeg")]
MPEG = 403,
[StringValue("video/x-ms-wmv")]
WMV = 404,
[StringValue("video/webm")]
WEBM = 405,
#endregion
//
#region Audio ...
[StringValue("audio/mpeg")]
MP3 = 500,
[StringValue("audio/ogg")]
OGG = 501,
[StringValue("audio/wav")]
WAV = 502,
[StringValue("audio/x-ms-wma")]
WMA = 503,
[StringValue("audio/aac")]
AAC = 504,
[StringValue("audio/mp4")]
M4A = 505,
#endregion
//
#region Image ...
[StringValue("image/png")]
PNG = 600,
[StringValue("image/jpeg")]
JPEG = 601,
[StringValue("image/jpeg")]
JPG = 602,
[StringValue("image/x-icon")]
ICON = 603,
[StringValue("image/gif")]
GIF = 604,
[StringValue("image/bmp")]
BITMAP = 605,
[StringValue("image/webp")]
WEBP = 606,
[StringValue("image/tiff")]
TIF = 607,
[StringValue("image/tiff")]
TIFF = 608,
[StringValue("image/svg+xml")]
SVG = 609,
#endregion
}
}
+27 -2
View File
@@ -1,5 +1,9 @@
namespace xCommons.Constants {
public enum XFileType {
using xExceptions.Attributes;
namespace xCommons.Constants
{
public enum XFileType
{
Image,
ProfileImasge,
CoverImage,
@@ -7,4 +11,25 @@ namespace xCommons.Constants {
Video,
Document
}
public enum XFileCategory
{
[StringValue("Document")]
Document = 100,
[StringValue("Archive")]
Archive = 200,
[StringValue("Internal")]
Internal = 300,
[StringValue("Video")]
Video = 400,
[StringValue("Audio")]
Audio = 500,
[StringValue("Image")]
Image = 600
}
}
+25
View File
@@ -0,0 +1,25 @@
using xExceptions.Attributes;
namespace xCommons.Constants
{
/// <summary>
/// File Type Detection Source ...
/// </summary>
public enum XFileTypeDetectionSource
{
[StringValue("None")]
None = 0,
[StringValue("MagicBytes")]
MagicBytes = 1,
[StringValue("Extension")]
Extension = 2,
[StringValue("ProvidedMime")]
ProvidedMime = 3,
[StringValue("Fallback")]
Fallback = 4
}
}