Add explicit type for FileExtension

https://github.com/tslater2006/UVtools/commit/38a49a764c12712ed2fbf12c069090b7ec3814f7
This commit is contained in:
Tiago Conceição
2021-08-13 16:18:03 +01:00
parent 12ce4d75aa
commit 4beb2af961
23 changed files with 66 additions and 48 deletions
+3 -3
View File
@@ -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; } = {
+1 -1
View File
@@ -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; } =
+1 -1
View File
@@ -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; } =
+7 -7
View File
@@ -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
+1 -1
View File
@@ -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; } = {
+1 -1
View File
@@ -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; } =
+12 -1
View File
@@ -17,6 +17,11 @@ namespace UVtools.Core.FileFormats
public sealed class FileExtension : IEquatable<FileExtension>, IEquatable<string>
{
#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>
@@ -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
+1 -1
View File
@@ -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; } =
+16 -9
View File
@@ -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,
+4 -4
View File
@@ -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; } =
+1 -1
View File
@@ -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; } =
+1 -1
View File
@@ -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"),
};
+1 -1
View File
@@ -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; } =
+1 -1
View File
@@ -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; } =
@@ -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)"),
};
+2 -2
View File
@@ -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,
+1 -1
View File
@@ -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; } = {
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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; } = {
+1 -1
View File
@@ -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; } = {
+1 -1
View File
@@ -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; } = {
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -12,7 +12,7 @@
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<RepositoryUrl>https://github.com/sn4k3/UVtools</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<Version>2.18.0</Version>
<Version>2.18.1</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">