diff options
author | Tiago Conceição <Tiago_caza@hotmail.com> | 2021-08-13 18:18:03 +0300 |
---|---|---|
committer | Tiago Conceição <Tiago_caza@hotmail.com> | 2021-08-13 18:18:03 +0300 |
commit | 4beb2af96196e96cccadf7f2d901878dec7c5855 (patch) | |
tree | 79224ac233802040161735e77f79fd8bf6c72061 /UVtools.Core | |
parent | 12ce4d75aaaad3a9c563e51d888006b68cb76ada (diff) |
Add explicit type for FileExtension
https://github.com/tslater2006/UVtools/commit/38a49a764c12712ed2fbf12c069090b7ec3814f7
Diffstat (limited to 'UVtools.Core')
22 files changed, 65 insertions, 47 deletions
diff --git a/UVtools.Core/FileFormats/CWSFile.cs b/UVtools.Core/FileFormats/CWSFile.cs index 0145ba4..1dae648 100644 --- a/UVtools.Core/FileFormats/CWSFile.cs +++ b/UVtools.Core/FileFormats/CWSFile.cs @@ -301,9 +301,9 @@ namespace UVtools.Core.FileFormats public PrinterType Printer { get; set; } = PrinterType.Unknown; public override FileExtension[] FileExtensions { get; } = { - new ("cws", "NovaMaker CWS"), - new ("rgb.cws", "NovaMaker Bene4 Mono / Elfin2 Mono SE (CWS)"), - new ("xml.cws", "Creation Workshop X (CWS)"), + new (typeof(CWSFile), "cws", "NovaMaker CWS"), + new (typeof(CWSFile), "rgb.cws", "NovaMaker Bene4 Mono / Elfin2 Mono SE (CWS)"), + new (typeof(CWSFile), "xml.cws", "Creation Workshop X (CWS)"), }; public override PrintParameterModifier[] PrintParameterModifiers { get; } = { diff --git a/UVtools.Core/FileFormats/CXDLPFile.cs b/UVtools.Core/FileFormats/CXDLPFile.cs index 0d8b5f0..a81ad75 100644 --- a/UVtools.Core/FileFormats/CXDLPFile.cs +++ b/UVtools.Core/FileFormats/CXDLPFile.cs @@ -360,7 +360,7 @@ namespace UVtools.Core.FileFormats public override FileFormatType FileType => FileFormatType.Binary; public override FileExtension[] FileExtensions { get; } = { - new("cxdlp", "Creality CXDLP"), + new(typeof(CXDLPFile), "cxdlp", "Creality CXDLP"), }; public override PrintParameterModifier[] PrintParameterModifiers { get; } = diff --git a/UVtools.Core/FileFormats/CXDLPv1File.cs b/UVtools.Core/FileFormats/CXDLPv1File.cs index 81a845f..137f839 100644 --- a/UVtools.Core/FileFormats/CXDLPv1File.cs +++ b/UVtools.Core/FileFormats/CXDLPv1File.cs @@ -312,7 +312,7 @@ namespace UVtools.Core.FileFormats public override FileFormatType FileType => FileFormatType.Binary; public override FileExtension[] FileExtensions { get; } = { - new("v1.cxdlp", "Creality CXDLP v1"), + new(typeof(CXDLPv1File), "v1.cxdlp", "Creality CXDLP v1"), }; public override PrintParameterModifier[] PrintParameterModifiers { get; } = diff --git a/UVtools.Core/FileFormats/ChituboxFile.cs b/UVtools.Core/FileFormats/ChituboxFile.cs index 9c4d346..0915d02 100644 --- a/UVtools.Core/FileFormats/ChituboxFile.cs +++ b/UVtools.Core/FileFormats/ChituboxFile.cs @@ -1085,13 +1085,13 @@ namespace UVtools.Core.FileFormats public override FileFormatType FileType => FileFormatType.Binary; public override FileExtension[] FileExtensions { get; } = { - new("ctb", $"Chitubox CTBv{USED_VERSION}"), - //new("v2.ctb", "Chitubox CTBv2"), - //new("v3.ctb", "Chitubox CTBv3"), - new("v4.ctb", "Chitubox CTBv4"), - //new("encrypted.ctb", "Chitubox encrypted CTB"), - new("cbddlp", "Chitubox CBDDLP"), - new("photon", "Chitubox Photon"), + new(typeof(ChituboxFile), "ctb", $"Chitubox CTBv{USED_VERSION}"), + //new(typeof(ChituboxFile), "v2.ctb", "Chitubox CTBv2"), + //new(typeof(ChituboxFile), "v3.ctb", "Chitubox CTBv3"), + new(typeof(ChituboxFile), "v4.ctb", "Chitubox CTBv4"), + //new(typeof(ChituboxFile), "encrypted.ctb", "Chitubox encrypted CTB"), + new(typeof(ChituboxFile), "cbddlp", "Chitubox CBDDLP"), + new(typeof(ChituboxFile), "photon", "Chitubox Photon"), }; public override PrintParameterModifier[] PrintParameterModifiers diff --git a/UVtools.Core/FileFormats/ChituboxZipFile.cs b/UVtools.Core/FileFormats/ChituboxZipFile.cs index 1039758..cc1da56 100644 --- a/UVtools.Core/FileFormats/ChituboxZipFile.cs +++ b/UVtools.Core/FileFormats/ChituboxZipFile.cs @@ -76,7 +76,7 @@ namespace UVtools.Core.FileFormats public override FileFormatType FileType => FileFormatType.Archive; public override FileExtension[] FileExtensions { get; } = { - new("zip", "Chitubox Zip") + new(typeof(ChituboxZipFile), "zip", "Chitubox Zip") }; public override PrintParameterModifier[] PrintParameterModifiers { get; } = { diff --git a/UVtools.Core/FileFormats/FDGFile.cs b/UVtools.Core/FileFormats/FDGFile.cs index 2d601d2..b67cc0e 100644 --- a/UVtools.Core/FileFormats/FDGFile.cs +++ b/UVtools.Core/FileFormats/FDGFile.cs @@ -671,7 +671,7 @@ namespace UVtools.Core.FileFormats public override FileFormatType FileType => FileFormatType.Binary; public override FileExtension[] FileExtensions { get; } = { - new("fdg", "Voxelab FDG"), + new(typeof(FDGFile), "fdg", "Voxelab FDG"), }; public override PrintParameterModifier[] PrintParameterModifiers { get; } = diff --git a/UVtools.Core/FileFormats/FileExtension.cs b/UVtools.Core/FileFormats/FileExtension.cs index fe05b52..fdd2ce8 100644 --- a/UVtools.Core/FileFormats/FileExtension.cs +++ b/UVtools.Core/FileFormats/FileExtension.cs @@ -18,6 +18,11 @@ namespace UVtools.Core.FileFormats { #region Properties /// <summary> + /// Stores a specific Type that should be used to create this FileExtension instance + /// </summary> + public Type FileFormatType { get; } + + /// <summary> /// Gets the extension name without the dot (.) /// </summary> public string Extension { get; } @@ -27,6 +32,8 @@ namespace UVtools.Core.FileFormats /// </summary> public string Description { get; } + public bool IsVisible { get; } + /// <summary> /// Gets a tag object /// </summary> @@ -43,13 +50,17 @@ namespace UVtools.Core.FileFormats /// <summary> /// Constructor /// </summary> + /// <param name="fileFormatType">The exact <see cref="FileFormat"/> type</param> /// <param name="extension">The extension name without the dot (.)</param> /// <param name="description">The extension description</param> + /// <param name="isVisible">True if this extension is visible on open dialog filters</param> /// <param name="tag">Tag object</param> - public FileExtension(string extension, string description, object tag = null) + public FileExtension(Type fileFormatType, string extension, string description, bool isVisible = true, object tag = null) { + FileFormatType = fileFormatType; Extension = extension; Description = description; + IsVisible = isVisible; Tag = tag; } #endregion diff --git a/UVtools.Core/FileFormats/GR1File.cs b/UVtools.Core/FileFormats/GR1File.cs index 4e977eb..c0a6441 100644 --- a/UVtools.Core/FileFormats/GR1File.cs +++ b/UVtools.Core/FileFormats/GR1File.cs @@ -148,7 +148,7 @@ namespace UVtools.Core.FileFormats public override FileFormatType FileType => FileFormatType.Binary; public override FileExtension[] FileExtensions { get; } = { - new ("gr1", "GR1 Workshop") + new (typeof(GR1File), "gr1", "GR1 Workshop") }; public override PrintParameterModifier[] PrintParameterModifiers { get; } = diff --git a/UVtools.Core/FileFormats/ImageFile.cs b/UVtools.Core/FileFormats/ImageFile.cs index 07f5139..45f69fb 100644 --- a/UVtools.Core/FileFormats/ImageFile.cs +++ b/UVtools.Core/FileFormats/ImageFile.cs @@ -8,19 +8,26 @@ namespace UVtools.Core.FileFormats { public class ImageFile : FileFormat { - public override FileFormatType FileType { get; } = FileFormatType.Binary; + public override FileFormatType FileType => FileFormatType.Binary; public override FileExtension[] FileExtensions { get; } = { - new ("jpg", "JPG"), - new ("jpeg", "JPEG"), - new ("png", "PNG"), - new ("bmp", "BMP"), - new ("gif", "GIF"), - new ("tga", "TGA"), + new (typeof(ImageFile), "png", "PNG: Portable Network Graphics"), + new (typeof(ImageFile), "jpg", "JPG: Joint Photographic Experts Group"), + new (typeof(ImageFile), "jpeg", "JPEG: Joint Photographic Experts Group"), + new (typeof(ImageFile), "jp2", "JP2: Joint Photographic Experts Group (JPEG 2000)"), + //new (typeof(ImageFile), "tga", "TGA: Truevision"), + new (typeof(ImageFile), "tif", "TIF: Tag Image File Format"), + new (typeof(ImageFile), "tiff", "TIFF: Tag Image File Format"), + new (typeof(ImageFile), "bmp", "BMP: Bitmap"), + new (typeof(ImageFile), "pbm", "PBM: Portable Bitmap"), + new (typeof(ImageFile), "pgm", "PGM: Portable Greymap"), + //new (typeof(ImageFile), "gif", "GIF"), + new (typeof(ImageFile), "sr", "SR: Sun raster"), + new (typeof(ImageFile), "RAS", "RAS: Sun raster"), }; - public override PrintParameterModifier[] PrintParameterModifiers { get; } = null; - + public override PrintParameterModifier[] PrintParameterModifiers => null; + public override Size[] ThumbnailsOriginalSize { get; } = { Size.Empty, Size.Empty, diff --git a/UVtools.Core/FileFormats/LGSFile.cs b/UVtools.Core/FileFormats/LGSFile.cs index 78e09b1..71fb3a4 100644 --- a/UVtools.Core/FileFormats/LGSFile.cs +++ b/UVtools.Core/FileFormats/LGSFile.cs @@ -261,10 +261,10 @@ namespace UVtools.Core.FileFormats public override FileFormatType FileType => FileFormatType.Binary; public override FileExtension[] FileExtensions { get; } = { - new ("lgs", "Longer Orange 10"), - new ("lgs30", "Longer Orange 30"), - new ("lgs120", "Longer Orange 120"), - new ("lgs4k", "Longer Orange 4k"), + new (typeof(LGSFile), "lgs", "Longer Orange 10"), + new (typeof(LGSFile), "lgs30", "Longer Orange 30"), + new (typeof(LGSFile), "lgs120", "Longer Orange 120"), + new (typeof(LGSFile), "lgs4k", "Longer Orange 4k"), }; public override PrintParameterModifier[] PrintParameterModifiers { get; } = diff --git a/UVtools.Core/FileFormats/MDLPFile.cs b/UVtools.Core/FileFormats/MDLPFile.cs index babe25b..86da4af 100644 --- a/UVtools.Core/FileFormats/MDLPFile.cs +++ b/UVtools.Core/FileFormats/MDLPFile.cs @@ -151,7 +151,7 @@ namespace UVtools.Core.FileFormats public override FileFormatType FileType => FileFormatType.Binary; public override FileExtension[] FileExtensions { get; } = { - new ("mdlp", "Makerbase MDLP v1"), + new (typeof(MDLPFile), "mdlp", "Makerbase MDLP v1"), }; public override PrintParameterModifier[] PrintParameterModifiers { get; } = diff --git a/UVtools.Core/FileFormats/OSLAFile.cs b/UVtools.Core/FileFormats/OSLAFile.cs index d513036..0ddd9a8 100644 --- a/UVtools.Core/FileFormats/OSLAFile.cs +++ b/UVtools.Core/FileFormats/OSLAFile.cs @@ -252,7 +252,7 @@ namespace UVtools.Core.FileFormats public override FileFormatType FileType => FileFormatType.Binary; public override FileExtension[] FileExtensions { get; } = { - new ("osla", "Open SLA universal binary file"), + new (typeof(OSLAFile), "osla", "Open SLA universal binary file"), //new ("omsla", "Open mSLA universal binary file"), //new ("odlp", "Open DLP universal binary file"), }; diff --git a/UVtools.Core/FileFormats/PHZFile.cs b/UVtools.Core/FileFormats/PHZFile.cs index 9f7f063..fc507d3 100644 --- a/UVtools.Core/FileFormats/PHZFile.cs +++ b/UVtools.Core/FileFormats/PHZFile.cs @@ -689,7 +689,7 @@ namespace UVtools.Core.FileFormats public override FileFormatType FileType => FileFormatType.Binary; public override FileExtension[] FileExtensions { get; } = { - new ("phz", "Chitubox PHZ"), + new (typeof(PHZFile), "phz", "Chitubox PHZ"), }; public override PrintParameterModifier[] PrintParameterModifiers { get; } = diff --git a/UVtools.Core/FileFormats/PhotonSFile.cs b/UVtools.Core/FileFormats/PhotonSFile.cs index 429cdf2..9e4fb9d 100644 --- a/UVtools.Core/FileFormats/PhotonSFile.cs +++ b/UVtools.Core/FileFormats/PhotonSFile.cs @@ -233,7 +233,7 @@ namespace UVtools.Core.FileFormats public override FileFormatType FileType => FileFormatType.Binary; public override FileExtension[] FileExtensions { get; } = { - new("photons", "Chitubox PhotonS"), + new(typeof(PhotonSFile), "photons", "Chitubox PhotonS"), }; public override PrintParameterModifier[] PrintParameterModifiers { get; } = diff --git a/UVtools.Core/FileFormats/PhotonWorkshopFile.cs b/UVtools.Core/FileFormats/PhotonWorkshopFile.cs index 5fcf0bb..0663d91 100644 --- a/UVtools.Core/FileFormats/PhotonWorkshopFile.cs +++ b/UVtools.Core/FileFormats/PhotonWorkshopFile.cs @@ -913,12 +913,12 @@ namespace UVtools.Core.FileFormats public override FileExtension[] FileExtensions { get; } = { - new("pwmx", "Photon Mono X (PWMX)"), - new("pwms", "Photon Mono SE (PWMS)"), - new("pwmo", "Photon Mono (PWMO)"), - new("pwx", "Photon X (PWX)"), - new("pws", "Photon / Photon S (PWS)"), - new("pw0", "Photon Zero (PW0)"), + new(typeof(PhotonWorkshopFile), "pwmx", "Photon Mono X (PWMX)"), + new(typeof(PhotonWorkshopFile), "pwms", "Photon Mono SE (PWMS)"), + new(typeof(PhotonWorkshopFile), "pwmo", "Photon Mono (PWMO)"), + new(typeof(PhotonWorkshopFile), "pwx", "Photon X (PWX)"), + new(typeof(PhotonWorkshopFile), "pws", "Photon / Photon S (PWS)"), + new(typeof(PhotonWorkshopFile), "pw0", "Photon Zero (PW0)"), }; diff --git a/UVtools.Core/FileFormats/SL1File.cs b/UVtools.Core/FileFormats/SL1File.cs index 4481200..1d58802 100644 --- a/UVtools.Core/FileFormats/SL1File.cs +++ b/UVtools.Core/FileFormats/SL1File.cs @@ -310,8 +310,8 @@ namespace UVtools.Core.FileFormats public override FileFormatType FileType => FileFormatType.Archive; public override FileExtension[] FileExtensions { get; } = { - new("sl1", "PrusaSlicer SL1"), - new("sl1s", "PrusaSlicer SL1S Speed") + new(typeof(SL1File), "sl1", "PrusaSlicer SL1"), + new(typeof(SL1File), "sl1s", "PrusaSlicer SL1S Speed") }; public override PrintParameterModifier[] PrintParameterModifiers { get; } = { PrintParameterModifier.BottomLayerCount, diff --git a/UVtools.Core/FileFormats/UVJFile.cs b/UVtools.Core/FileFormats/UVJFile.cs index b7cefd5..c97c286 100644 --- a/UVtools.Core/FileFormats/UVJFile.cs +++ b/UVtools.Core/FileFormats/UVJFile.cs @@ -130,7 +130,7 @@ namespace UVtools.Core.FileFormats public override FileFormatType FileType => FileFormatType.Archive; public override FileExtension[] FileExtensions { get; } = { - new("uvj", "UVJ") + new(typeof(UVJFile), "uvj", "UVJ") }; public override PrintParameterModifier[] PrintParameterModifiers { get; } = { diff --git a/UVtools.Core/FileFormats/VDAFile.cs b/UVtools.Core/FileFormats/VDAFile.cs index ab4a0fd..bba398b 100644 --- a/UVtools.Core/FileFormats/VDAFile.cs +++ b/UVtools.Core/FileFormats/VDAFile.cs @@ -152,7 +152,7 @@ namespace UVtools.Core.FileFormats public override FileFormatType FileType => FileFormatType.Archive; public override FileExtension[] FileExtensions { get; } = { - new("vda.zip", "Voxeldance Additive Zip") + new(typeof(VDAFile), "vda.zip", "Voxeldance Additive Zip") }; public override uint ResolutionX diff --git a/UVtools.Core/FileFormats/VDTFile.cs b/UVtools.Core/FileFormats/VDTFile.cs index ae4c366..2b3790d 100644 --- a/UVtools.Core/FileFormats/VDTFile.cs +++ b/UVtools.Core/FileFormats/VDTFile.cs @@ -158,7 +158,7 @@ namespace UVtools.Core.FileFormats public override FileFormatType FileType => FileFormatType.Archive; public override FileExtension[] FileExtensions { get; } = { - new("vdt", "Voxeldance Tango VDT") + new(typeof(VDTFile), "vdt", "Voxeldance Tango VDT") }; public override PrintParameterModifier[] PrintParameterModifiers { get; } = { diff --git a/UVtools.Core/FileFormats/ZCodeFile.cs b/UVtools.Core/FileFormats/ZCodeFile.cs index f0cb407..db06f9e 100644 --- a/UVtools.Core/FileFormats/ZCodeFile.cs +++ b/UVtools.Core/FileFormats/ZCodeFile.cs @@ -188,7 +188,7 @@ namespace UVtools.Core.FileFormats public override FileFormatType FileType => FileFormatType.Archive; public override FileExtension[] FileExtensions { get; } = { - new("zcode", "UnizMaker ZCode") + new(typeof(ZCodeFile), "zcode", "UnizMaker ZCode") }; public override PrintParameterModifier[] PrintParameterModifiers { get; } = { diff --git a/UVtools.Core/FileFormats/ZCodexFile.cs b/UVtools.Core/FileFormats/ZCodexFile.cs index 56ec300..9a397df 100644 --- a/UVtools.Core/FileFormats/ZCodexFile.cs +++ b/UVtools.Core/FileFormats/ZCodexFile.cs @@ -158,7 +158,7 @@ namespace UVtools.Core.FileFormats public override FileFormatType FileType => FileFormatType.Archive; public override FileExtension[] FileExtensions { get; } = { - new("zcodex", "Z-Suite ZCodex") + new(typeof(ZCodexFile), "zcodex", "Z-Suite ZCodex") }; public override PrintParameterModifier[] PrintParameterModifiers { get; } = { diff --git a/UVtools.Core/UVtools.Core.csproj b/UVtools.Core/UVtools.Core.csproj index 42df498..dfd68ff 100644 --- a/UVtools.Core/UVtools.Core.csproj +++ b/UVtools.Core/UVtools.Core.csproj @@ -10,7 +10,7 @@ <RepositoryUrl>https://github.com/sn4k3/UVtools</RepositoryUrl> <PackageProjectUrl>https://github.com/sn4k3/UVtools</PackageProjectUrl> <Description>MSLA/DLP, file analysis, calibration, repair, conversion and manipulation</Description> - <Version>2.18.0</Version> + <Version>2.18.1</Version> <Copyright>Copyright © 2020 PTRTECH</Copyright> <PackageIcon>UVtools.png</PackageIcon> <Platforms>AnyCPU;x64</Platforms> |