Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sn4k3/UVtools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Conceição <Tiago_caza@hotmail.com>2021-08-13 18:30:41 +0300
committerTiago Conceição <Tiago_caza@hotmail.com>2021-08-13 18:30:41 +0300
commit1bd5963b2f863261d2177ce9e609862a5a3edaf1 (patch)
tree75a1cd987387f801436e86d507c29e3ce479b76d /UVtools.Core
parent729daca5c5a2f4148b91794108522ac306029439 (diff)
Update FileFormat.cs
Diffstat (limited to 'UVtools.Core')
-rw-r--r--UVtools.Core/FileFormats/FileFormat.cs7
1 files changed, 6 insertions, 1 deletions
diff --git a/UVtools.Core/FileFormats/FileFormat.cs b/UVtools.Core/FileFormats/FileFormat.cs
index 4b49fb0..0024761 100644
--- a/UVtools.Core/FileFormats/FileFormat.cs
+++ b/UVtools.Core/FileFormats/FileFormat.cs
@@ -364,7 +364,12 @@ namespace UVtools.Core.FileFormats
/// <returns><see cref="FileFormat"/> object or null if not found</returns>
public static FileFormat FindByType(Type type, bool createNewInstance = false)
{
- return (from t in AvailableFormats where type == t.GetType() select createNewInstance ? (FileFormat) Activator.CreateInstance(type) : t).FirstOrDefault();
+ var fileFormat = AvailableFormats.FirstOrDefault(format => format.GetType() == type);
+ if (fileFormat is null) return null;
+ return createNewInstance
+ ? (FileFormat)Activator.CreateInstance(type)
+ : fileFormat;
+ //return (from t in AvailableFormats where type == t.GetType() select createNewInstance ? (FileFormat) Activator.CreateInstance(type) : t).FirstOrDefault();
}
public static string GetFileNameStripExtensions(string filepath)