mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Moved disc image plugins to a separate library.
This commit is contained in:
61
DiscImageChef/DetectImageFormat.cs
Normal file
61
DiscImageChef/DetectImageFormat.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
|
||||
namespace DiscImageChef.ImagePlugins
|
||||
{
|
||||
public static class ImageFormat
|
||||
{
|
||||
public static ImagePlugin Detect(string imagePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
ImagePlugin _imageFormat;
|
||||
PluginBase plugins = new PluginBase();
|
||||
plugins.RegisterAllPlugins();
|
||||
|
||||
_imageFormat = null;
|
||||
|
||||
// Check all but RAW plugin
|
||||
foreach (ImagePlugin _imageplugin in plugins.ImagePluginsList.Values)
|
||||
{
|
||||
if(_imageplugin.PluginUUID != new Guid("12345678-AAAA-BBBB-CCCC-123456789000"))
|
||||
{
|
||||
if (_imageplugin.IdentifyImage(imagePath))
|
||||
{
|
||||
_imageFormat = _imageplugin;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check only RAW plugin
|
||||
if (_imageFormat == null)
|
||||
{
|
||||
foreach (ImagePlugin _imageplugin in plugins.ImagePluginsList.Values)
|
||||
{
|
||||
if(_imageplugin.PluginUUID == new Guid("12345678-AAAA-BBBB-CCCC-123456789000"))
|
||||
{
|
||||
if (_imageplugin.IdentifyImage(imagePath))
|
||||
{
|
||||
_imageFormat = _imageplugin;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Still not recognized
|
||||
if (_imageFormat == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return _imageFormat;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user