2014-04-17 19:58:14 +00:00
|
|
|
/***************************************************************************
|
2014-06-15 23:39:34 +01:00
|
|
|
The Disc Image Chef
|
2014-04-17 19:58:14 +00:00
|
|
|
----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
Filename : Main.cs
|
|
|
|
|
Version : 1.0
|
|
|
|
|
Author(s) : Natalia Portillo
|
|
|
|
|
|
|
|
|
|
Component : Main program loop.
|
|
|
|
|
|
|
|
|
|
Revision : $Revision$
|
|
|
|
|
Last change by : $Author$
|
|
|
|
|
Date : $Date$
|
|
|
|
|
|
|
|
|
|
--[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
Contains the main program loop.
|
|
|
|
|
|
|
|
|
|
--[ License ] --------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
2014-04-19 18:23:00 +01:00
|
|
|
it under the terms of the GNU General Public License as
|
2014-04-17 19:58:14 +00:00
|
|
|
published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2014-04-19 18:23:00 +01:00
|
|
|
GNU General Public License for more details.
|
2014-04-17 19:58:14 +00:00
|
|
|
|
2014-04-19 18:23:00 +01:00
|
|
|
You should have received a copy of the GNU General Public License
|
2014-04-17 19:58:14 +00:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
----------------------------------------------------------------------------
|
|
|
|
|
Copyright (C) 2011-2014 Claunia.com
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
//$Id$
|
|
|
|
|
|
2011-03-03 18:34:33 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2014-06-15 23:39:34 +01:00
|
|
|
using DiscImageChef.ImagePlugins;
|
|
|
|
|
using DiscImageChef.PartPlugins;
|
|
|
|
|
using DiscImageChef.Plugins;
|
2014-06-16 00:41:47 +01:00
|
|
|
using System.Reflection;
|
2011-03-03 18:34:33 +00:00
|
|
|
|
2014-06-15 23:39:34 +01:00
|
|
|
namespace DiscImageChef
|
2011-03-03 18:34:33 +00:00
|
|
|
{
|
2014-04-14 02:29:13 +00:00
|
|
|
class MainClass
|
|
|
|
|
{
|
|
|
|
|
static PluginBase plugins;
|
|
|
|
|
public static bool isDebug;
|
2014-06-16 00:41:47 +01:00
|
|
|
public static bool isVerbose;
|
2014-04-14 02:29:13 +00:00
|
|
|
|
|
|
|
|
public static void Main(string[] args)
|
|
|
|
|
{
|
|
|
|
|
plugins = new PluginBase();
|
2014-06-16 00:41:47 +01:00
|
|
|
|
|
|
|
|
string invokedVerb = "";
|
|
|
|
|
object invokedVerbInstance = null;
|
|
|
|
|
|
|
|
|
|
var options = new Options();
|
|
|
|
|
if (!CommandLine.Parser.Default.ParseArguments(args, options,
|
|
|
|
|
(verb, subOptions) =>
|
|
|
|
|
{
|
|
|
|
|
// if parsing succeeds the verb name and correct instance
|
|
|
|
|
// will be passed to onVerbCommand delegate (string,object)
|
|
|
|
|
invokedVerb = verb;
|
|
|
|
|
invokedVerbInstance = subOptions;
|
|
|
|
|
}))
|
|
|
|
|
{
|
|
|
|
|
Environment.Exit(CommandLine.Parser.DefaultExitCodeFail);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
object[] attributes = typeof(MainClass).Assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
|
|
|
|
|
string AssemblyTitle = ((AssemblyTitleAttribute) attributes[0]).Title;
|
|
|
|
|
attributes = typeof(MainClass).Assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
|
|
|
|
|
Version AssemblyVersion = typeof(MainClass).Assembly.GetName().Version;
|
|
|
|
|
string AssemblyCopyright = ((AssemblyCopyrightAttribute) attributes[0]).Copyright;
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("{0} {1}", AssemblyTitle, AssemblyVersion);
|
|
|
|
|
Console.WriteLine("{0}", AssemblyCopyright);
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
|
|
|
|
|
switch (invokedVerb)
|
|
|
|
|
{
|
|
|
|
|
case "analyze":
|
|
|
|
|
AnalyzeSubOptions AnalyzeOptions = (AnalyzeSubOptions)invokedVerbInstance;
|
|
|
|
|
isDebug = AnalyzeOptions.Debug;
|
|
|
|
|
isVerbose = AnalyzeOptions.Verbose;
|
|
|
|
|
Analyze(AnalyzeOptions);
|
|
|
|
|
break;
|
|
|
|
|
case "compare":
|
|
|
|
|
CompareSubOptions CompareOptions = (CompareSubOptions)invokedVerbInstance;
|
|
|
|
|
isDebug = CompareOptions.Debug;
|
|
|
|
|
isVerbose = CompareOptions.Verbose;
|
|
|
|
|
Compare(CompareOptions);
|
|
|
|
|
break;
|
|
|
|
|
case "checksum":
|
|
|
|
|
ChecksumSubOptions ChecksumOptions = (ChecksumSubOptions)invokedVerbInstance;
|
|
|
|
|
isDebug = ChecksumOptions.Debug;
|
|
|
|
|
isVerbose = ChecksumOptions.Verbose;
|
|
|
|
|
Checksum(ChecksumOptions);
|
|
|
|
|
break;
|
|
|
|
|
case "verify":
|
|
|
|
|
VerifySubOptions VerifyOptions = (VerifySubOptions)invokedVerbInstance;
|
|
|
|
|
isDebug = VerifyOptions.Debug;
|
|
|
|
|
isVerbose = VerifyOptions.Verbose;
|
|
|
|
|
Verify(VerifyOptions);
|
|
|
|
|
break;
|
|
|
|
|
case "formats":
|
|
|
|
|
ListFormats();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
throw new ArgumentException("Should never arrive here!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void ListFormats()
|
|
|
|
|
{
|
|
|
|
|
plugins.RegisterAllPlugins();
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("Supported images:");
|
|
|
|
|
foreach (KeyValuePair<string, ImagePlugin> kvp in plugins.ImagePluginsList)
|
|
|
|
|
Console.WriteLine(kvp.Value.Name);
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
Console.WriteLine("Supported filesystems:");
|
|
|
|
|
foreach (KeyValuePair<string, Plugin> kvp in plugins.PluginsList)
|
|
|
|
|
Console.WriteLine(kvp.Value.Name);
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
Console.WriteLine("Supported partitions:");
|
|
|
|
|
foreach (KeyValuePair<string, PartPlugin> kvp in plugins.PartPluginsList)
|
|
|
|
|
Console.WriteLine(kvp.Value.Name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void Compare(CompareSubOptions options)
|
|
|
|
|
{
|
2014-04-14 01:14:20 +00:00
|
|
|
if (isDebug)
|
|
|
|
|
{
|
2014-06-16 00:41:47 +01:00
|
|
|
Console.WriteLine("--debug={0}", options.Debug);
|
|
|
|
|
Console.WriteLine("--verbose={0}", options.Verbose);
|
|
|
|
|
Console.WriteLine("--input1={0}", options.InputFile1);
|
|
|
|
|
Console.WriteLine("--input2={0}", options.InputFile2);
|
2014-04-14 01:14:20 +00:00
|
|
|
}
|
2014-06-16 00:41:47 +01:00
|
|
|
throw new NotImplementedException("Comparing not yet implemented.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void Checksum(ChecksumSubOptions options)
|
|
|
|
|
{
|
|
|
|
|
if (isDebug)
|
2014-04-14 01:14:20 +00:00
|
|
|
{
|
2014-06-16 00:41:47 +01:00
|
|
|
Console.WriteLine("--debug={0}", options.Debug);
|
|
|
|
|
Console.WriteLine("--verbose={0}", options.Verbose);
|
|
|
|
|
Console.WriteLine("--separated-tracks={0}", options.SeparatedTracks);
|
|
|
|
|
Console.WriteLine("--whole-disc={0}", options.WholeDisc);
|
|
|
|
|
Console.WriteLine("--input={0}", options.InputFile);
|
|
|
|
|
Console.WriteLine("--crc32={0}", options.DoCRC32);
|
|
|
|
|
Console.WriteLine("--md5={0}", options.DoMD5);
|
|
|
|
|
Console.WriteLine("--sha1={0}", options.DoSHA1);
|
|
|
|
|
Console.WriteLine("--fuzzy={0}", options.DoFuzzy);
|
|
|
|
|
}
|
|
|
|
|
throw new NotImplementedException("Checksumming not yet implemented.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void Verify(VerifySubOptions options)
|
|
|
|
|
{
|
|
|
|
|
if (isDebug)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("--debug={0}", options.Debug);
|
|
|
|
|
Console.WriteLine("--verbose={0}", options.Verbose);
|
|
|
|
|
Console.WriteLine("--input={0}", options.InputFile);
|
|
|
|
|
Console.WriteLine("--verify-disc={0}", options.VerifyDisc);
|
|
|
|
|
Console.WriteLine("--verify-sectors={0}", options.VerifySectors);
|
2014-04-14 01:14:20 +00:00
|
|
|
}
|
2014-06-16 00:41:47 +01:00
|
|
|
throw new NotImplementedException("Verifying not yet implemented.");
|
2014-04-14 02:29:13 +00:00
|
|
|
}
|
2011-03-03 18:34:33 +00:00
|
|
|
|
2014-06-16 00:41:47 +01:00
|
|
|
static void Analyze(AnalyzeSubOptions options)
|
2014-04-14 02:29:13 +00:00
|
|
|
{
|
2014-06-16 00:41:47 +01:00
|
|
|
if (isDebug)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("--debug={0}", options.Debug);
|
|
|
|
|
Console.WriteLine("--verbose={0}", options.Verbose);
|
|
|
|
|
Console.WriteLine("--input={0}", options.InputFile);
|
|
|
|
|
Console.WriteLine("--filesystems={0}", options.SearchForFilesystems);
|
|
|
|
|
Console.WriteLine("--partitions={0}", options.SearchForPartitions);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
plugins.RegisterAllPlugins();
|
|
|
|
|
|
2014-04-14 02:29:13 +00:00
|
|
|
List<string> id_plugins;
|
|
|
|
|
Plugin _plugin;
|
|
|
|
|
string information;
|
|
|
|
|
bool checkraw = false;
|
2013-12-16 01:04:17 +00:00
|
|
|
ImagePlugin _imageFormat;
|
2011-03-03 18:34:33 +00:00
|
|
|
|
2014-04-14 02:29:13 +00:00
|
|
|
try
|
|
|
|
|
{
|
2013-12-16 01:04:17 +00:00
|
|
|
_imageFormat = null;
|
|
|
|
|
|
2014-06-07 23:32:59 +01:00
|
|
|
// Check all but RAW plugin
|
2014-04-14 02:29:13 +00:00
|
|
|
foreach (ImagePlugin _imageplugin in plugins.ImagePluginsList.Values)
|
2013-12-16 01:04:17 +00:00
|
|
|
{
|
2014-06-07 23:32:59 +01:00
|
|
|
if(_imageplugin.PluginUUID != new Guid("12345678-AAAA-BBBB-CCCC-123456789000"))
|
2013-12-16 01:04:17 +00:00
|
|
|
{
|
2014-06-16 00:41:47 +01:00
|
|
|
if (_imageplugin.IdentifyImage(options.InputFile))
|
2014-06-07 23:32:59 +01:00
|
|
|
{
|
|
|
|
|
_imageFormat = _imageplugin;
|
|
|
|
|
Console.WriteLine("Image format identified by {0}.", _imageplugin.Name);
|
|
|
|
|
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"))
|
|
|
|
|
{
|
2014-06-16 00:41:47 +01:00
|
|
|
if (_imageplugin.IdentifyImage(options.InputFile))
|
2014-06-07 23:32:59 +01:00
|
|
|
{
|
|
|
|
|
_imageFormat = _imageplugin;
|
|
|
|
|
Console.WriteLine("Image format identified by {0}.", _imageplugin.Name);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-12-16 01:04:17 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-07 23:32:59 +01:00
|
|
|
// Still not recognized
|
2014-04-14 02:29:13 +00:00
|
|
|
if (_imageFormat == null)
|
2013-12-16 01:04:17 +00:00
|
|
|
{
|
|
|
|
|
Console.WriteLine("Image format not identified, not proceeding.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
2014-06-16 00:41:47 +01:00
|
|
|
if (!_imageFormat.OpenImage(options.InputFile))
|
2013-12-16 01:04:17 +00:00
|
|
|
{
|
|
|
|
|
Console.WriteLine("Unable to open image format");
|
|
|
|
|
Console.WriteLine("No error given");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2014-04-14 01:31:32 +00:00
|
|
|
|
2014-04-14 02:29:13 +00:00
|
|
|
if (isDebug)
|
2014-04-14 01:31:32 +00:00
|
|
|
{
|
|
|
|
|
Console.WriteLine("DEBUG: Correctly opened image file.");
|
|
|
|
|
Console.WriteLine("DEBUG: Image without headers is {0} bytes.", _imageFormat.GetImageSize());
|
|
|
|
|
Console.WriteLine("DEBUG: Image has {0} sectors.", _imageFormat.GetSectors());
|
* FileSystemIDandChk/ArrayFill.cs:
* FileSystemIDandChk/FileSystemIDandChk.csproj:
Added array filling class from mykohsu.
* FileSystemIDandChk/Main.cs:
Print disk type as identified by image plugin
* FileSystemIDandChk/ImagePlugins/ImagePlugin.cs:
Added more disk types
* FileSystemIDandChk/ImagePlugins/TeleDisk.cs:
Added link to Dave's document.
Completely implemented OpenImage() for standard
(non-compressed) teledisk images.
Implemented GetImageSize(), GetSectors(), GetSectorSize(),
ReadSectors(), GetImageVersion(),
GetImageApplicationVersion(), GetImageCreationTime(),
GetImageLastModificationtime(), GetImageName(),
GetDiskType(), data sector decoders.
* FileSystemIDandChk/TODO:
Discovered a filesystem specification present on ECMA-67.
Dunno if CP/M, FAT or a different one, must check.
Teledisk plugin is working, but lacks "advanced compression"
and variable sectors per track support.
2014-06-07 04:54:15 +01:00
|
|
|
Console.WriteLine("DEBUG: Image identifies disk type as {0}.", _imageFormat.GetDiskType());
|
2014-04-14 01:31:32 +00:00
|
|
|
}
|
2013-12-16 01:04:17 +00:00
|
|
|
}
|
2014-04-14 02:29:13 +00:00
|
|
|
catch (Exception ex)
|
2013-12-16 01:04:17 +00:00
|
|
|
{
|
|
|
|
|
Console.WriteLine("Unable to open image format");
|
|
|
|
|
Console.WriteLine("Error: {0}", ex.Message);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-14 01:14:20 +00:00
|
|
|
Console.WriteLine("Image identified as {0}.", _imageFormat.GetImageFormat());
|
|
|
|
|
|
2014-06-16 00:41:47 +01:00
|
|
|
if (options.SearchForPartitions)
|
2014-04-14 02:29:13 +00:00
|
|
|
{
|
|
|
|
|
List<Partition> partitions = new List<Partition>();
|
|
|
|
|
string partition_scheme = "";
|
2011-03-03 18:34:33 +00:00
|
|
|
|
2014-04-14 01:14:20 +00:00
|
|
|
// TODO: Solve possibility of multiple partition schemes (CUE + MBR, MBR + RDB, CUE + APM, etc)
|
2014-04-14 02:29:13 +00:00
|
|
|
foreach (PartPlugin _partplugin in plugins.PartPluginsList.Values)
|
|
|
|
|
{
|
|
|
|
|
List<Partition> _partitions;
|
2011-03-03 18:34:33 +00:00
|
|
|
|
2014-04-14 01:14:20 +00:00
|
|
|
if (_partplugin.GetInformation(_imageFormat, out _partitions))
|
2014-04-14 02:29:13 +00:00
|
|
|
{
|
|
|
|
|
partition_scheme = _partplugin.Name;
|
|
|
|
|
partitions = _partitions;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-04-14 01:14:20 +00:00
|
|
|
|
2014-04-14 02:29:13 +00:00
|
|
|
if (_imageFormat.ImageHasPartitions())
|
2014-04-14 01:14:20 +00:00
|
|
|
{
|
|
|
|
|
partition_scheme = _imageFormat.GetImageFormat();
|
|
|
|
|
partitions = _imageFormat.GetPartitions();
|
|
|
|
|
}
|
2011-03-03 18:34:33 +00:00
|
|
|
|
2014-04-14 02:29:13 +00:00
|
|
|
if (partition_scheme == "")
|
|
|
|
|
{
|
2014-06-07 17:32:14 +01:00
|
|
|
if(MainClass.isDebug)
|
|
|
|
|
Console.WriteLine("DEBUG: No partitions found");
|
2014-06-16 00:41:47 +01:00
|
|
|
if (!options.SearchForFilesystems)
|
2014-04-14 02:29:13 +00:00
|
|
|
{
|
|
|
|
|
Console.WriteLine("No partitions founds, not searching for filesystems");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
checkraw = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Partition scheme identified as {0}", partition_scheme);
|
|
|
|
|
Console.WriteLine("{0} partitions found.", partitions.Count);
|
2011-03-03 18:34:33 +00:00
|
|
|
|
2014-04-14 02:29:13 +00:00
|
|
|
for (int i = 0; i < partitions.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
Console.WriteLine("Partition {0}:", partitions[i].PartitionSequence);
|
|
|
|
|
Console.WriteLine("Partition name: {0}", partitions[i].PartitionName);
|
|
|
|
|
Console.WriteLine("Partition type: {0}", partitions[i].PartitionType);
|
2014-06-08 00:43:49 +01:00
|
|
|
Console.WriteLine("Partition start: sector {0}, byte {1}", partitions[i].PartitionStartSector, partitions[i].PartitionStart);
|
|
|
|
|
Console.WriteLine("Partition length: {0} sectors, {1} bytes", partitions[i].PartitionSectors, partitions[i].PartitionLength);
|
2014-04-14 02:29:13 +00:00
|
|
|
Console.WriteLine("Partition description:");
|
|
|
|
|
Console.WriteLine(partitions[i].PartitionDescription);
|
2011-03-03 18:34:33 +00:00
|
|
|
|
2014-06-16 00:41:47 +01:00
|
|
|
if (options.SearchForFilesystems)
|
2014-04-14 02:29:13 +00:00
|
|
|
{
|
|
|
|
|
Console.WriteLine("Identifying filesystem on partition");
|
2011-03-03 18:34:33 +00:00
|
|
|
|
2014-06-08 00:43:49 +01:00
|
|
|
Identify(_imageFormat, out id_plugins, partitions[i].PartitionStartSector);
|
2014-04-14 02:29:13 +00:00
|
|
|
if (id_plugins.Count == 0)
|
|
|
|
|
Console.WriteLine("Filesystem not identified");
|
|
|
|
|
else if (id_plugins.Count > 1)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(String.Format("Identified by {0} plugins", id_plugins.Count));
|
2011-03-03 18:34:33 +00:00
|
|
|
|
2014-04-14 02:29:13 +00:00
|
|
|
foreach (string plugin_name in id_plugins)
|
|
|
|
|
{
|
|
|
|
|
if (plugins.PluginsList.TryGetValue(plugin_name, out _plugin))
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(String.Format("As identified by {0}.", _plugin.Name));
|
2014-06-08 00:43:49 +01:00
|
|
|
_plugin.GetInformation(_imageFormat, partitions[i].PartitionStartSector, out information);
|
2014-04-14 02:29:13 +00:00
|
|
|
Console.Write(information);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
plugins.PluginsList.TryGetValue(id_plugins[0], out _plugin);
|
|
|
|
|
Console.WriteLine(String.Format("Identified by {0}.", _plugin.Name));
|
2014-06-08 00:43:49 +01:00
|
|
|
_plugin.GetInformation(_imageFormat, partitions[i].PartitionStartSector, out information);
|
2014-04-14 02:29:13 +00:00
|
|
|
Console.Write(information);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-03-03 18:34:33 +00:00
|
|
|
|
2014-04-14 02:29:13 +00:00
|
|
|
if (checkraw)
|
|
|
|
|
{
|
2014-04-14 01:14:20 +00:00
|
|
|
Identify(_imageFormat, out id_plugins, 0);
|
2014-04-14 02:29:13 +00:00
|
|
|
if (id_plugins.Count == 0)
|
|
|
|
|
Console.WriteLine("Filesystem not identified");
|
|
|
|
|
else if (id_plugins.Count > 1)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(String.Format("Identified by {0} plugins", id_plugins.Count));
|
2011-03-03 18:34:33 +00:00
|
|
|
|
2014-04-14 02:29:13 +00:00
|
|
|
foreach (string plugin_name in id_plugins)
|
|
|
|
|
{
|
|
|
|
|
if (plugins.PluginsList.TryGetValue(plugin_name, out _plugin))
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(String.Format("As identified by {0}.", _plugin.Name));
|
2014-04-14 01:14:20 +00:00
|
|
|
_plugin.GetInformation(_imageFormat, 0, out information);
|
2014-04-14 02:29:13 +00:00
|
|
|
Console.Write(information);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
plugins.PluginsList.TryGetValue(id_plugins[0], out _plugin);
|
|
|
|
|
Console.WriteLine(String.Format("Identified by {0}.", _plugin.Name));
|
2014-04-14 01:14:20 +00:00
|
|
|
_plugin.GetInformation(_imageFormat, 0, out information);
|
2014-04-14 02:29:13 +00:00
|
|
|
Console.Write(information);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(String.Format("Error reading file: {0}", ex.Message));
|
|
|
|
|
if (isDebug)
|
|
|
|
|
Console.WriteLine(ex.StackTrace);
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-03-03 18:34:33 +00:00
|
|
|
|
2014-04-14 02:29:13 +00:00
|
|
|
static void Identify(ImagePlugin imagePlugin, out List<string> id_plugins, ulong partitionOffset)
|
|
|
|
|
{
|
|
|
|
|
id_plugins = new List<string>();
|
2011-03-03 18:34:33 +00:00
|
|
|
|
2014-04-14 02:29:13 +00:00
|
|
|
foreach (Plugin _plugin in plugins.PluginsList.Values)
|
2011-03-03 18:34:33 +00:00
|
|
|
{
|
2014-04-14 01:14:20 +00:00
|
|
|
if (_plugin.Identify(imagePlugin, partitionOffset))
|
2014-04-14 02:29:13 +00:00
|
|
|
id_plugins.Add(_plugin.Name.ToLower());
|
2011-03-03 18:34:33 +00:00
|
|
|
}
|
2014-04-14 02:29:13 +00:00
|
|
|
}
|
|
|
|
|
}
|
2011-03-03 18:34:33 +00:00
|
|
|
}
|
|
|
|
|
|