🎨Converted all plugin types to interfaces.

This commit is contained in:
2017-12-26 06:05:12 +00:00
parent a002253fa4
commit f66a0bdd42
295 changed files with 9499 additions and 10414 deletions

View File

@@ -53,7 +53,7 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Analyze command", "--partitions={0}", options.SearchForPartitions);
FiltersList filtersList = new FiltersList();
Filter inputFilter = filtersList.GetFilter(options.InputFile);
IFilter inputFilter = filtersList.GetFilter(options.InputFile);
if(inputFilter == null)
{
@@ -76,13 +76,12 @@ namespace DiscImageChef.Commands
}
PluginBase plugins = new PluginBase();
plugins.RegisterAllPlugins(encoding);
bool checkraw = false;
try
{
ImagePlugin imageFormat = ImageFormat.Detect(inputFilter);
IMediaImage imageFormat = ImageFormat.Detect(inputFilter);
if(imageFormat == null)
{
@@ -92,7 +91,7 @@ namespace DiscImageChef.Commands
if(options.Verbose)
DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", imageFormat.Name,
imageFormat.PluginUuid);
imageFormat.Id);
else DicConsole.WriteLine("Image format identified by {0}.", imageFormat.Name);
try
@@ -106,13 +105,13 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Analyze command", "Correctly opened image file.");
DicConsole.DebugWriteLine("Analyze command", "Image without headers is {0} bytes.",
imageFormat.ImageInfo.ImageSize);
DicConsole.DebugWriteLine("Analyze command", "Image has {0} sectors.", imageFormat.ImageInfo.Sectors);
imageFormat.Info.ImageSize);
DicConsole.DebugWriteLine("Analyze command", "Image has {0} sectors.", imageFormat.Info.Sectors);
DicConsole.DebugWriteLine("Analyze command", "Image identifies disk type as {0}.",
imageFormat.ImageInfo.MediaType);
imageFormat.Info.MediaType);
Core.Statistics.AddMediaFormat(imageFormat.ImageFormat);
Core.Statistics.AddMedia(imageFormat.ImageInfo.MediaType, false);
Core.Statistics.AddMedia(imageFormat.Info.MediaType, false);
Core.Statistics.AddFilter(inputFilter.Name);
}
catch(Exception ex)
@@ -124,7 +123,7 @@ namespace DiscImageChef.Commands
}
List<string> idPlugins;
Filesystem plugin;
IFilesystem plugin;
string information;
if(options.SearchForPartitions)
{
@@ -174,9 +173,9 @@ namespace DiscImageChef.Commands
if(plugins.PluginsList.TryGetValue(pluginName, out plugin))
{
DicConsole.WriteLine($"As identified by {plugin.Name}.");
plugin.GetInformation(imageFormat, partitions[i], out information);
plugin.GetInformation(imageFormat, partitions[i], out information, encoding);
DicConsole.Write(information);
Core.Statistics.AddFilesystem(plugin.XmlFSType.Type);
Core.Statistics.AddFilesystem(plugin.XmlFsType.Type);
}
}
else
@@ -185,9 +184,9 @@ namespace DiscImageChef.Commands
if(plugin == null) continue;
DicConsole.WriteLine($"Identified by {plugin.Name}.");
plugin.GetInformation(imageFormat, partitions[i], out information);
plugin.GetInformation(imageFormat, partitions[i], out information, encoding);
DicConsole.Write(information);
Core.Statistics.AddFilesystem(plugin.XmlFSType.Type);
Core.Statistics.AddFilesystem(plugin.XmlFsType.Type);
}
}
}
@@ -198,8 +197,8 @@ namespace DiscImageChef.Commands
Partition wholePart = new Partition
{
Name = "Whole device",
Length = imageFormat.ImageInfo.Sectors,
Size = imageFormat.ImageInfo.Sectors * imageFormat.ImageInfo.SectorSize
Length = imageFormat.Info.Sectors,
Size = imageFormat.Info.Sectors * imageFormat.Info.SectorSize
};
Core.Filesystems.Identify(imageFormat, out idPlugins, wholePart);
@@ -212,9 +211,9 @@ namespace DiscImageChef.Commands
if(plugins.PluginsList.TryGetValue(pluginName, out plugin))
{
DicConsole.WriteLine($"As identified by {plugin.Name}.");
plugin.GetInformation(imageFormat, wholePart, out information);
plugin.GetInformation(imageFormat, wholePart, out information, encoding);
DicConsole.Write(information);
Core.Statistics.AddFilesystem(plugin.XmlFSType.Type);
Core.Statistics.AddFilesystem(plugin.XmlFsType.Type);
}
}
else
@@ -223,9 +222,9 @@ namespace DiscImageChef.Commands
if(plugin != null)
{
DicConsole.WriteLine($"Identified by {plugin.Name}.");
plugin.GetInformation(imageFormat, wholePart, out information);
plugin.GetInformation(imageFormat, wholePart, out information, encoding);
DicConsole.Write(information);
Core.Statistics.AddFilesystem(plugin.XmlFSType.Type);
Core.Statistics.AddFilesystem(plugin.XmlFsType.Type);
}
}
}

View File

@@ -65,7 +65,7 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Checksum command", "--spamsum={0}", options.DoSpamSum);
FiltersList filtersList = new FiltersList();
Filter inputFilter = filtersList.GetFilter(options.InputFile);
IFilter inputFilter = filtersList.GetFilter(options.InputFile);
if(inputFilter == null)
{
@@ -73,7 +73,7 @@ namespace DiscImageChef.Commands
return;
}
ImagePlugin inputFormat = ImageFormat.Detect(inputFilter);
IMediaImage inputFormat = ImageFormat.Detect(inputFilter);
if(inputFormat == null)
{
@@ -83,7 +83,7 @@ namespace DiscImageChef.Commands
inputFormat.OpenImage(inputFilter);
Core.Statistics.AddMediaFormat(inputFormat.ImageFormat);
Core.Statistics.AddMedia(inputFormat.ImageInfo.MediaType, false);
Core.Statistics.AddMedia(inputFormat.Info.MediaType, false);
Core.Statistics.AddFilter(inputFilter.Name);
EnableChecksum enabledChecksums = new EnableChecksum();
@@ -101,7 +101,7 @@ namespace DiscImageChef.Commands
Core.Checksum mediaChecksum = null;
if(inputFormat.ImageInfo.HasPartitions)
if(inputFormat.Info.HasPartitions)
try
{
Core.Checksum trackChecksum = null;
@@ -171,8 +171,8 @@ namespace DiscImageChef.Commands
previousTrackEnd = currentTrack.TrackEndSector;
}
if(inputFormat.ImageInfo.Sectors - previousTrackEnd != 0 && options.WholeDisc)
for(ulong i = previousTrackEnd + 1; i < inputFormat.ImageInfo.Sectors; i++)
if(inputFormat.Info.Sectors - previousTrackEnd != 0 && options.WholeDisc)
for(ulong i = previousTrackEnd + 1; i < inputFormat.Info.Sectors; i++)
{
DicConsole.Write("\rHashing track-less sector {0}", i);
@@ -194,7 +194,7 @@ namespace DiscImageChef.Commands
{
mediaChecksum = new Core.Checksum(enabledChecksums);
ulong sectors = inputFormat.ImageInfo.Sectors;
ulong sectors = inputFormat.Info.Sectors;
DicConsole.WriteLine("Sectors {0}", sectors);
ulong doneSectors = 0;

View File

@@ -50,9 +50,9 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Compare command", "--input2={0}", options.InputFile2);
FiltersList filtersList = new FiltersList();
Filter inputFilter1 = filtersList.GetFilter(options.InputFile1);
IFilter inputFilter1 = filtersList.GetFilter(options.InputFile1);
filtersList = new FiltersList();
Filter inputFilter2 = filtersList.GetFilter(options.InputFile2);
IFilter inputFilter2 = filtersList.GetFilter(options.InputFile2);
if(inputFilter1 == null)
{
@@ -66,8 +66,8 @@ namespace DiscImageChef.Commands
return;
}
ImagePlugin input1Format = ImageFormat.Detect(inputFilter1);
ImagePlugin input2Format = ImageFormat.Detect(inputFilter2);
IMediaImage input1Format = ImageFormat.Detect(inputFilter1);
IMediaImage input2Format = ImageFormat.Detect(inputFilter2);
if(input1Format == null)
{
@@ -77,7 +77,7 @@ namespace DiscImageChef.Commands
if(options.Verbose)
DicConsole.VerboseWriteLine("Input file 1 format identified by {0} ({1}).", input1Format.Name,
input1Format.PluginUuid);
input1Format.Id);
else DicConsole.WriteLine("Input file 1 format identified by {0}.", input1Format.Name);
if(input2Format == null)
@@ -88,7 +88,7 @@ namespace DiscImageChef.Commands
if(options.Verbose)
DicConsole.VerboseWriteLine("Input file 2 format identified by {0} ({1}).", input2Format.Name,
input2Format.PluginUuid);
input2Format.Id);
else DicConsole.WriteLine("Input file 2 format identified by {0}.", input2Format.Name);
input1Format.OpenImage(inputFilter1);
@@ -96,8 +96,8 @@ namespace DiscImageChef.Commands
Core.Statistics.AddMediaFormat(input1Format.ImageFormat);
Core.Statistics.AddMediaFormat(input2Format.ImageFormat);
Core.Statistics.AddMedia(input1Format.ImageInfo.MediaType, false);
Core.Statistics.AddMedia(input2Format.ImageInfo.MediaType, false);
Core.Statistics.AddMedia(input1Format.Info.MediaType, false);
Core.Statistics.AddMedia(input2Format.Info.MediaType, false);
Core.Statistics.AddFilter(inputFilter1.Name);
Core.Statistics.AddFilter(inputFilter2.Name);
@@ -125,7 +125,7 @@ namespace DiscImageChef.Commands
Dictionary<MediaTagType, byte[]> image1DiskTags = new Dictionary<MediaTagType, byte[]>();
Dictionary<MediaTagType, byte[]> image2DiskTags = new Dictionary<MediaTagType, byte[]>();
image1Info.HasPartitions = input1Format.ImageInfo.HasPartitions;
image1Info.HasPartitions = input1Format.Info.HasPartitions;
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
try { image1Sessions = input1Format.Sessions; }
catch
@@ -134,29 +134,29 @@ namespace DiscImageChef.Commands
}
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
image1Info.HasSessions |= image1Sessions.Count > 0;
image1Info.ImageSize = input1Format.ImageInfo.ImageSize;
image1Info.Sectors = input1Format.ImageInfo.Sectors;
image1Info.SectorSize = input1Format.ImageInfo.SectorSize;
image1Info.CreationTime = input1Format.ImageInfo.CreationTime;
image1Info.LastModificationTime = input1Format.ImageInfo.LastModificationTime;
image1Info.MediaType = input1Format.ImageInfo.MediaType;
image1Info.Version = input1Format.ImageInfo.Version;
image1Info.Application = input1Format.ImageInfo.Application;
image1Info.ApplicationVersion = input1Format.ImageInfo.ApplicationVersion;
image1Info.Creator = input1Format.ImageInfo.Creator;
image1Info.MediaTitle = input1Format.ImageInfo.MediaTitle;
image1Info.Comments = input1Format.ImageInfo.Comments;
image1Info.MediaManufacturer = input1Format.ImageInfo.MediaManufacturer;
image1Info.MediaModel = input1Format.ImageInfo.MediaModel;
image1Info.MediaSerialNumber = input1Format.ImageInfo.MediaSerialNumber;
image1Info.MediaBarcode = input1Format.ImageInfo.MediaBarcode;
image1Info.MediaPartNumber = input1Format.ImageInfo.MediaPartNumber;
image1Info.MediaSequence = input1Format.ImageInfo.MediaSequence;
image1Info.LastMediaSequence = input1Format.ImageInfo.LastMediaSequence;
image1Info.DriveManufacturer = input1Format.ImageInfo.DriveManufacturer;
image1Info.DriveModel = input1Format.ImageInfo.DriveModel;
image1Info.DriveSerialNumber = input1Format.ImageInfo.DriveSerialNumber;
image1Info.DriveFirmwareRevision = input1Format.ImageInfo.DriveFirmwareRevision;
image1Info.ImageSize = input1Format.Info.ImageSize;
image1Info.Sectors = input1Format.Info.Sectors;
image1Info.SectorSize = input1Format.Info.SectorSize;
image1Info.CreationTime = input1Format.Info.CreationTime;
image1Info.LastModificationTime = input1Format.Info.LastModificationTime;
image1Info.MediaType = input1Format.Info.MediaType;
image1Info.Version = input1Format.Info.Version;
image1Info.Application = input1Format.Info.Application;
image1Info.ApplicationVersion = input1Format.Info.ApplicationVersion;
image1Info.Creator = input1Format.Info.Creator;
image1Info.MediaTitle = input1Format.Info.MediaTitle;
image1Info.Comments = input1Format.Info.Comments;
image1Info.MediaManufacturer = input1Format.Info.MediaManufacturer;
image1Info.MediaModel = input1Format.Info.MediaModel;
image1Info.MediaSerialNumber = input1Format.Info.MediaSerialNumber;
image1Info.MediaBarcode = input1Format.Info.MediaBarcode;
image1Info.MediaPartNumber = input1Format.Info.MediaPartNumber;
image1Info.MediaSequence = input1Format.Info.MediaSequence;
image1Info.LastMediaSequence = input1Format.Info.LastMediaSequence;
image1Info.DriveManufacturer = input1Format.Info.DriveManufacturer;
image1Info.DriveModel = input1Format.Info.DriveModel;
image1Info.DriveSerialNumber = input1Format.Info.DriveSerialNumber;
image1Info.DriveFirmwareRevision = input1Format.Info.DriveFirmwareRevision;
foreach(MediaTagType disktag in Enum.GetValues(typeof(MediaTagType)))
{
try
@@ -172,7 +172,7 @@ namespace DiscImageChef.Commands
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
}
image2Info.HasPartitions = input2Format.ImageInfo.HasPartitions;
image2Info.HasPartitions = input2Format.Info.HasPartitions;
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
try { image2Sessions = input2Format.Sessions; }
catch
@@ -181,29 +181,29 @@ namespace DiscImageChef.Commands
}
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
image2Info.HasSessions |= image2Sessions.Count > 0;
image2Info.ImageSize = input2Format.ImageInfo.ImageSize;
image2Info.Sectors = input2Format.ImageInfo.Sectors;
image2Info.SectorSize = input2Format.ImageInfo.SectorSize;
image2Info.CreationTime = input2Format.ImageInfo.CreationTime;
image2Info.LastModificationTime = input2Format.ImageInfo.LastModificationTime;
image2Info.MediaType = input2Format.ImageInfo.MediaType;
image2Info.Version = input2Format.ImageInfo.Version;
image2Info.Application = input2Format.ImageInfo.Application;
image2Info.ApplicationVersion = input2Format.ImageInfo.ApplicationVersion;
image2Info.Creator = input2Format.ImageInfo.Creator;
image2Info.MediaTitle = input2Format.ImageInfo.MediaTitle;
image2Info.Comments = input2Format.ImageInfo.Comments;
image2Info.MediaManufacturer = input2Format.ImageInfo.MediaManufacturer;
image2Info.MediaModel = input2Format.ImageInfo.MediaModel;
image2Info.MediaSerialNumber = input2Format.ImageInfo.MediaSerialNumber;
image2Info.MediaBarcode = input2Format.ImageInfo.MediaBarcode;
image2Info.MediaPartNumber = input2Format.ImageInfo.MediaPartNumber;
image2Info.MediaSequence = input2Format.ImageInfo.MediaSequence;
image2Info.LastMediaSequence = input2Format.ImageInfo.LastMediaSequence;
image2Info.DriveManufacturer = input2Format.ImageInfo.DriveManufacturer;
image2Info.DriveModel = input2Format.ImageInfo.DriveModel;
image2Info.DriveSerialNumber = input2Format.ImageInfo.DriveSerialNumber;
image2Info.DriveFirmwareRevision = input2Format.ImageInfo.DriveFirmwareRevision;
image2Info.ImageSize = input2Format.Info.ImageSize;
image2Info.Sectors = input2Format.Info.Sectors;
image2Info.SectorSize = input2Format.Info.SectorSize;
image2Info.CreationTime = input2Format.Info.CreationTime;
image2Info.LastModificationTime = input2Format.Info.LastModificationTime;
image2Info.MediaType = input2Format.Info.MediaType;
image2Info.Version = input2Format.Info.Version;
image2Info.Application = input2Format.Info.Application;
image2Info.ApplicationVersion = input2Format.Info.ApplicationVersion;
image2Info.Creator = input2Format.Info.Creator;
image2Info.MediaTitle = input2Format.Info.MediaTitle;
image2Info.Comments = input2Format.Info.Comments;
image2Info.MediaManufacturer = input2Format.Info.MediaManufacturer;
image2Info.MediaModel = input2Format.Info.MediaModel;
image2Info.MediaSerialNumber = input2Format.Info.MediaSerialNumber;
image2Info.MediaBarcode = input2Format.Info.MediaBarcode;
image2Info.MediaPartNumber = input2Format.Info.MediaPartNumber;
image2Info.MediaSequence = input2Format.Info.MediaSequence;
image2Info.LastMediaSequence = input2Format.Info.LastMediaSequence;
image2Info.DriveManufacturer = input2Format.Info.DriveManufacturer;
image2Info.DriveModel = input2Format.Info.DriveModel;
image2Info.DriveSerialNumber = input2Format.Info.DriveSerialNumber;
image2Info.DriveFirmwareRevision = input2Format.Info.DriveFirmwareRevision;
foreach(MediaTagType disktag in Enum.GetValues(typeof(MediaTagType)))
{
try

View File

@@ -79,7 +79,7 @@ namespace DiscImageChef.Commands
}
FiltersList filtersList = new FiltersList();
Filter inputFilter = filtersList.GetFilter(options.InputFile);
IFilter inputFilter = filtersList.GetFilter(options.InputFile);
if(inputFilter == null)
{
@@ -89,7 +89,7 @@ namespace DiscImageChef.Commands
try
{
ImagePlugin imageFormat = ImageFormat.Detect(inputFilter);
IMediaImage imageFormat = ImageFormat.Detect(inputFilter);
if(imageFormat == null)
{
@@ -99,7 +99,7 @@ namespace DiscImageChef.Commands
if(options.Verbose)
DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", imageFormat.Name,
imageFormat.PluginUuid);
imageFormat.Id);
else DicConsole.WriteLine("Image format identified by {0}.", imageFormat.Name);
try
@@ -124,7 +124,7 @@ namespace DiscImageChef.Commands
Core.Statistics.AddFilter(inputFilter.Name);
CICMMetadataType sidecar =
Sidecar.Create(imageFormat, options.InputFile, inputFilter.UUID, encoding);
Sidecar.Create(imageFormat, options.InputFile, inputFilter.Id, encoding);
DicConsole.WriteLine("Writing metadata sidecar");

View File

@@ -54,7 +54,7 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Decode command", "--sector-tags={0}", options.SectorTags);
FiltersList filtersList = new FiltersList();
Filter inputFilter = filtersList.GetFilter(options.InputFile);
IFilter inputFilter = filtersList.GetFilter(options.InputFile);
if(inputFilter == null)
{
@@ -62,7 +62,7 @@ namespace DiscImageChef.Commands
return;
}
ImagePlugin inputFormat = ImageFormat.Detect(inputFilter);
IMediaImage inputFormat = ImageFormat.Detect(inputFilter);
if(inputFormat == null)
{
@@ -72,14 +72,14 @@ namespace DiscImageChef.Commands
inputFormat.OpenImage(inputFilter);
Core.Statistics.AddMediaFormat(inputFormat.ImageFormat);
Core.Statistics.AddMedia(inputFormat.ImageInfo.MediaType, false);
Core.Statistics.AddMedia(inputFormat.Info.MediaType, false);
Core.Statistics.AddFilter(inputFilter.Name);
if(options.DiskTags)
if(inputFormat.ImageInfo.ReadableMediaTags.Count == 0)
if(inputFormat.Info.ReadableMediaTags.Count == 0)
DicConsole.WriteLine("There are no disk tags in chosen disc image.");
else
foreach(MediaTagType tag in inputFormat.ImageInfo.ReadableMediaTags)
foreach(MediaTagType tag in inputFormat.Info.ReadableMediaTags)
switch(tag)
{
case MediaTagType.SCSI_INQUIRY:
@@ -232,7 +232,7 @@ namespace DiscImageChef.Commands
{
ulong length;
if(options.Length.ToLowerInvariant() == "all") length = inputFormat.ImageInfo.Sectors - 1;
if(options.Length.ToLowerInvariant() == "all") length = inputFormat.Info.Sectors - 1;
else
{
if(!ulong.TryParse(options.Length, out length))
@@ -243,10 +243,10 @@ namespace DiscImageChef.Commands
}
}
if(inputFormat.ImageInfo.ReadableSectorTags.Count == 0)
if(inputFormat.Info.ReadableSectorTags.Count == 0)
DicConsole.WriteLine("There are no sector tags in chosen disc image.");
else
foreach(SectorTagType tag in inputFormat.ImageInfo.ReadableSectorTags)
foreach(SectorTagType tag in inputFormat.Info.ReadableSectorTags)
switch(tag)
{
default:

View File

@@ -53,7 +53,7 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Entropy command", "--duplicated-sectors={0}", options.DuplicatedSectors);
FiltersList filtersList = new FiltersList();
Filter inputFilter = filtersList.GetFilter(options.InputFile);
IFilter inputFilter = filtersList.GetFilter(options.InputFile);
if(inputFilter == null)
{
@@ -61,7 +61,7 @@ namespace DiscImageChef.Commands
return;
}
ImagePlugin inputFormat = ImageFormat.Detect(inputFilter);
IMediaImage inputFormat = ImageFormat.Detect(inputFilter);
if(inputFormat == null)
{
@@ -71,7 +71,7 @@ namespace DiscImageChef.Commands
inputFormat.OpenImage(inputFilter);
Core.Statistics.AddMediaFormat(inputFormat.ImageFormat);
Core.Statistics.AddMedia(inputFormat.ImageInfo.MediaType, false);
Core.Statistics.AddMedia(inputFormat.Info.MediaType, false);
Core.Statistics.AddFilter(inputFilter.Name);
double entropy = 0;
ulong[] entTable;
@@ -134,7 +134,7 @@ namespace DiscImageChef.Commands
ulong diskSize = 0;
List<string> uniqueSectors = new List<string>();
sectors = inputFormat.ImageInfo.Sectors;
sectors = inputFormat.Info.Sectors;
DicConsole.WriteLine("Sectors {0}", sectors);
sha1Ctx.Init();

View File

@@ -55,7 +55,7 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Extract-Files command", "--output={0}", options.OutputDir);
FiltersList filtersList = new FiltersList();
Filter inputFilter = filtersList.GetFilter(options.InputFile);
IFilter inputFilter = filtersList.GetFilter(options.InputFile);
if(inputFilter == null)
{
@@ -78,11 +78,11 @@ namespace DiscImageChef.Commands
}
PluginBase plugins = new PluginBase();
plugins.RegisterAllPlugins(encoding);
plugins.RegisterAllPlugins();
try
{
ImagePlugin imageFormat = ImageFormat.Detect(inputFilter);
IMediaImage imageFormat = ImageFormat.Detect(inputFilter);
if(imageFormat == null)
{
@@ -92,7 +92,7 @@ namespace DiscImageChef.Commands
if(options.Verbose)
DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", imageFormat.Name,
imageFormat.PluginUuid);
imageFormat.Id);
else DicConsole.WriteLine("Image format identified by {0}.", imageFormat.Name);
if(Directory.Exists(options.OutputDir) || File.Exists(options.OutputDir))
@@ -114,14 +114,14 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Extract-Files command", "Correctly opened image file.");
DicConsole.DebugWriteLine("Extract-Files command", "Image without headers is {0} bytes.",
imageFormat.ImageInfo.ImageSize);
imageFormat.Info.ImageSize);
DicConsole.DebugWriteLine("Extract-Files command", "Image has {0} sectors.",
imageFormat.ImageInfo.Sectors);
imageFormat.Info.Sectors);
DicConsole.DebugWriteLine("Extract-Files command", "Image identifies disk type as {0}.",
imageFormat.ImageInfo.MediaType);
imageFormat.Info.MediaType);
Core.Statistics.AddMediaFormat(imageFormat.ImageFormat);
Core.Statistics.AddMedia(imageFormat.ImageInfo.MediaType, false);
Core.Statistics.AddMedia(imageFormat.Info.MediaType, false);
Core.Statistics.AddFilter(inputFilter.Name);
}
catch(Exception ex)
@@ -135,7 +135,7 @@ namespace DiscImageChef.Commands
Core.Partitions.AddSchemesToStats(partitions);
List<string> idPlugins;
Filesystem plugin;
IFilesystem plugin;
Errno error;
if(partitions.Count == 0) DicConsole.DebugWriteLine("Extract-Files command", "No partitions found");
else
@@ -159,13 +159,10 @@ namespace DiscImageChef.Commands
if(plugins.PluginsList.TryGetValue(pluginName, out plugin))
{
DicConsole.WriteLine($"As identified by {plugin.Name}.");
Filesystem fs = (Filesystem)plugin
.GetType().GetConstructor(new[]
{
typeof(ImagePlugin), typeof(Partition), typeof(Encoding)
}).Invoke(new object[] {imageFormat, partitions[i], null});
IFilesystem fs = (IFilesystem)plugin
.GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { });
error = fs.Mount(options.Debug);
error = fs.Mount(imageFormat, partitions[i], encoding, options.Debug);
if(error == Errno.NoError)
{
List<string> rootDir = new List<string>();
@@ -176,9 +173,9 @@ namespace DiscImageChef.Commands
FileEntryInfo stat = new FileEntryInfo();
string volumeName =
string.IsNullOrEmpty(fs.XmlFSType.VolumeName)
string.IsNullOrEmpty(fs.XmlFsType.VolumeName)
? "NO NAME"
: fs.XmlFSType.VolumeName;
: fs.XmlFsType.VolumeName;
error = fs.Stat(entry, ref stat);
if(error == Errno.NoError)
@@ -199,12 +196,12 @@ namespace DiscImageChef.Commands
Directory
.CreateDirectory(Path.Combine(options.OutputDir,
fs.XmlFSType.Type,
fs.XmlFsType.Type,
volumeName, ".xattrs",
xattr));
outputPath =
Path.Combine(options.OutputDir, fs.XmlFSType.Type,
Path.Combine(options.OutputDir, fs.XmlFsType.Type,
volumeName, ".xattrs", xattr, entry);
if(!File.Exists(outputPath))
@@ -246,11 +243,11 @@ namespace DiscImageChef.Commands
}
Directory.CreateDirectory(Path.Combine(options.OutputDir,
fs.XmlFSType.Type,
fs.XmlFsType.Type,
volumeName));
outputPath =
Path.Combine(options.OutputDir, fs.XmlFSType.Type, volumeName,
Path.Combine(options.OutputDir, fs.XmlFsType.Type, volumeName,
entry);
if(!File.Exists(outputPath))
@@ -302,7 +299,7 @@ namespace DiscImageChef.Commands
DicConsole.ErrorWriteLine("Error {0} reading root directory {0}",
error.ToString());
Core.Statistics.AddFilesystem(fs.XmlFSType.Type);
Core.Statistics.AddFilesystem(fs.XmlFsType.Type);
}
else
DicConsole.ErrorWriteLine("Unable to mount device, error {0}",
@@ -313,12 +310,9 @@ namespace DiscImageChef.Commands
{
plugins.PluginsList.TryGetValue(idPlugins[0], out plugin);
DicConsole.WriteLine($"Identified by {plugin.Name}.");
Filesystem fs = (Filesystem)plugin
.GetType().GetConstructor(new[]
{
typeof(ImagePlugin), typeof(Partition), typeof(Encoding)
}).Invoke(new object[] {imageFormat, partitions[i], null});
error = fs.Mount(options.Debug);
IFilesystem fs = (IFilesystem)plugin
.GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { });
error = fs.Mount(imageFormat, partitions[i], encoding, options.Debug);
if(error == Errno.NoError)
{
List<string> rootDir = new List<string>();
@@ -329,9 +323,9 @@ namespace DiscImageChef.Commands
FileEntryInfo stat = new FileEntryInfo();
string volumeName =
string.IsNullOrEmpty(fs.XmlFSType.VolumeName)
string.IsNullOrEmpty(fs.XmlFsType.VolumeName)
? "NO NAME"
: fs.XmlFSType.VolumeName;
: fs.XmlFsType.VolumeName;
error = fs.Stat(entry, ref stat);
if(error == Errno.NoError)
@@ -351,12 +345,12 @@ namespace DiscImageChef.Commands
if(error != Errno.NoError) continue;
Directory.CreateDirectory(Path.Combine(options.OutputDir,
fs.XmlFSType.Type,
fs.XmlFsType.Type,
volumeName, ".xattrs",
xattr));
outputPath =
Path.Combine(options.OutputDir, fs.XmlFSType.Type,
Path.Combine(options.OutputDir, fs.XmlFsType.Type,
volumeName, ".xattrs", xattr, entry);
if(!File.Exists(outputPath))
@@ -395,11 +389,11 @@ namespace DiscImageChef.Commands
}
}
Directory.CreateDirectory(Path.Combine(options.OutputDir, fs.XmlFSType.Type,
Directory.CreateDirectory(Path.Combine(options.OutputDir, fs.XmlFsType.Type,
volumeName));
outputPath =
Path.Combine(options.OutputDir, fs.XmlFSType.Type, volumeName, entry);
Path.Combine(options.OutputDir, fs.XmlFsType.Type, volumeName, entry);
if(!File.Exists(outputPath))
{
@@ -448,7 +442,7 @@ namespace DiscImageChef.Commands
else
DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", error.ToString());
Core.Statistics.AddFilesystem(fs.XmlFSType.Type);
Core.Statistics.AddFilesystem(fs.XmlFsType.Type);
}
else DicConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString());
}
@@ -458,8 +452,8 @@ namespace DiscImageChef.Commands
Partition wholePart = new Partition
{
Name = "Whole device",
Length = imageFormat.ImageInfo.Sectors,
Size = imageFormat.ImageInfo.Sectors * imageFormat.ImageInfo.SectorSize
Length = imageFormat.Info.Sectors,
Size = imageFormat.Info.Sectors * imageFormat.Info.SectorSize
};
Core.Filesystems.Identify(imageFormat, out idPlugins, wholePart);
@@ -472,12 +466,9 @@ namespace DiscImageChef.Commands
if(plugins.PluginsList.TryGetValue(pluginName, out plugin))
{
DicConsole.WriteLine($"As identified by {plugin.Name}.");
Filesystem fs = (Filesystem)plugin
.GetType().GetConstructor(new[]
{
typeof(ImagePlugin), typeof(Partition), typeof(Encoding)
}).Invoke(new object[] {imageFormat, wholePart, null});
error = fs.Mount(options.Debug);
IFilesystem fs = (IFilesystem)plugin
.GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { });
error = fs.Mount(imageFormat, wholePart, encoding, options.Debug);
if(error == Errno.NoError)
{
List<string> rootDir = new List<string>();
@@ -488,9 +479,9 @@ namespace DiscImageChef.Commands
FileEntryInfo stat = new FileEntryInfo();
string volumeName =
string.IsNullOrEmpty(fs.XmlFSType.VolumeName)
string.IsNullOrEmpty(fs.XmlFsType.VolumeName)
? "NO NAME"
: fs.XmlFSType.VolumeName;
: fs.XmlFsType.VolumeName;
error = fs.Stat(entry, ref stat);
if(error == Errno.NoError)
@@ -510,12 +501,12 @@ namespace DiscImageChef.Commands
if(error != Errno.NoError) continue;
Directory.CreateDirectory(Path.Combine(options.OutputDir,
fs.XmlFSType.Type,
fs.XmlFsType.Type,
volumeName, ".xattrs",
xattr));
outputPath =
Path.Combine(options.OutputDir, fs.XmlFSType.Type,
Path.Combine(options.OutputDir, fs.XmlFsType.Type,
volumeName, ".xattrs", xattr, entry);
if(!File.Exists(outputPath))
@@ -554,11 +545,11 @@ namespace DiscImageChef.Commands
}
}
Directory.CreateDirectory(Path.Combine(options.OutputDir, fs.XmlFSType.Type,
Directory.CreateDirectory(Path.Combine(options.OutputDir, fs.XmlFsType.Type,
volumeName));
outputPath =
Path.Combine(options.OutputDir, fs.XmlFSType.Type, volumeName, entry);
Path.Combine(options.OutputDir, fs.XmlFsType.Type, volumeName, entry);
if(!File.Exists(outputPath))
{
@@ -607,7 +598,7 @@ namespace DiscImageChef.Commands
else
DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", error.ToString());
Core.Statistics.AddFilesystem(fs.XmlFSType.Type);
Core.Statistics.AddFilesystem(fs.XmlFsType.Type);
}
else DicConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString());
}
@@ -616,10 +607,9 @@ namespace DiscImageChef.Commands
{
plugins.PluginsList.TryGetValue(idPlugins[0], out plugin);
DicConsole.WriteLine($"Identified by {plugin.Name}.");
Filesystem fs = (Filesystem)plugin
.GetType().GetConstructor(new[] {typeof(ImagePlugin), typeof(Partition), typeof(Encoding)})
.Invoke(new object[] {imageFormat, wholePart, null});
error = fs.Mount(options.Debug);
IFilesystem fs = (IFilesystem)plugin
.GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { });
error = fs.Mount(imageFormat, wholePart, encoding, options.Debug);
if(error == Errno.NoError)
{
List<string> rootDir = new List<string>();
@@ -629,9 +619,9 @@ namespace DiscImageChef.Commands
{
FileEntryInfo stat = new FileEntryInfo();
string volumeName = string.IsNullOrEmpty(fs.XmlFSType.VolumeName)
string volumeName = string.IsNullOrEmpty(fs.XmlFsType.VolumeName)
? "NO NAME"
: fs.XmlFSType.VolumeName;
: fs.XmlFsType.VolumeName;
error = fs.Stat(entry, ref stat);
if(error == Errno.NoError)
@@ -651,11 +641,11 @@ namespace DiscImageChef.Commands
if(error != Errno.NoError) continue;
Directory.CreateDirectory(Path.Combine(options.OutputDir,
fs.XmlFSType.Type, volumeName,
fs.XmlFsType.Type, volumeName,
".xattrs", xattr));
outputPath =
Path.Combine(options.OutputDir, fs.XmlFSType.Type, volumeName,
Path.Combine(options.OutputDir, fs.XmlFsType.Type, volumeName,
".xattrs", xattr, entry);
if(!File.Exists(outputPath))
@@ -694,10 +684,10 @@ namespace DiscImageChef.Commands
}
}
Directory.CreateDirectory(Path.Combine(options.OutputDir, fs.XmlFSType.Type,
Directory.CreateDirectory(Path.Combine(options.OutputDir, fs.XmlFsType.Type,
volumeName));
outputPath = Path.Combine(options.OutputDir, fs.XmlFSType.Type, volumeName, entry);
outputPath = Path.Combine(options.OutputDir, fs.XmlFsType.Type, volumeName, entry);
if(!File.Exists(outputPath))
{
@@ -740,7 +730,7 @@ namespace DiscImageChef.Commands
}
else DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", error.ToString());
Core.Statistics.AddFilesystem(fs.XmlFSType.Type);
Core.Statistics.AddFilesystem(fs.XmlFsType.Type);
}
else DicConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString());
}

View File

@@ -50,32 +50,32 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Supported filters:");
if(formatsOptions.Verbose) DicConsole.VerboseWriteLine("GUID\t\t\t\t\tFilter");
foreach(KeyValuePair<string, Filter> kvp in filtersList.Filters)
if(formatsOptions.Verbose) DicConsole.VerboseWriteLine("{0}\t{1}", kvp.Value.UUID, kvp.Value.Name);
foreach(KeyValuePair<string, IFilter> kvp in filtersList.Filters)
if(formatsOptions.Verbose) DicConsole.VerboseWriteLine("{0}\t{1}", kvp.Value.Id, kvp.Value.Name);
else DicConsole.WriteLine(kvp.Value.Name);
DicConsole.WriteLine();
DicConsole.WriteLine("Supported disc image formats:");
if(formatsOptions.Verbose) DicConsole.VerboseWriteLine("GUID\t\t\t\t\tPlugin");
foreach(KeyValuePair<string, ImagePlugin> kvp in plugins.ImagePluginsList)
foreach(KeyValuePair<string, IMediaImage> kvp in plugins.ImagePluginsList)
if(formatsOptions.Verbose)
DicConsole.VerboseWriteLine("{0}\t{1}", kvp.Value.PluginUuid, kvp.Value.Name);
DicConsole.VerboseWriteLine("{0}\t{1}", kvp.Value.Id, kvp.Value.Name);
else DicConsole.WriteLine(kvp.Value.Name);
DicConsole.WriteLine();
DicConsole.WriteLine("Supported filesystems:");
if(formatsOptions.Verbose) DicConsole.VerboseWriteLine("GUID\t\t\t\t\tPlugin");
foreach(KeyValuePair<string, Filesystem> kvp in plugins.PluginsList)
foreach(KeyValuePair<string, IFilesystem> kvp in plugins.PluginsList)
if(formatsOptions.Verbose)
DicConsole.VerboseWriteLine("{0}\t{1}", kvp.Value.PluginUuid, kvp.Value.Name);
DicConsole.VerboseWriteLine("{0}\t{1}", kvp.Value.Id, kvp.Value.Name);
else DicConsole.WriteLine(kvp.Value.Name);
DicConsole.WriteLine();
DicConsole.WriteLine("Supported partitioning schemes:");
if(formatsOptions.Verbose) DicConsole.VerboseWriteLine("GUID\t\t\t\t\tPlugin");
foreach(KeyValuePair<string, PartitionPlugin> kvp in plugins.PartPluginsList)
foreach(KeyValuePair<string, IPartition> kvp in plugins.PartPluginsList)
if(formatsOptions.Verbose)
DicConsole.VerboseWriteLine("{0}\t{1}", kvp.Value.PluginUuid, kvp.Value.Name);
DicConsole.VerboseWriteLine("{0}\t{1}", kvp.Value.Id, kvp.Value.Name);
else DicConsole.WriteLine(kvp.Value.Name);
Core.Statistics.AddCommand("formats");

View File

@@ -51,7 +51,7 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Ls command", "--input={0}", options.InputFile);
FiltersList filtersList = new FiltersList();
Filter inputFilter = filtersList.GetFilter(options.InputFile);
IFilter inputFilter = filtersList.GetFilter(options.InputFile);
if(inputFilter == null)
{
@@ -74,11 +74,11 @@ namespace DiscImageChef.Commands
}
PluginBase plugins = new PluginBase();
plugins.RegisterAllPlugins(encoding);
plugins.RegisterAllPlugins();
try
{
ImagePlugin imageFormat = ImageFormat.Detect(inputFilter);
IMediaImage imageFormat = ImageFormat.Detect(inputFilter);
if(imageFormat == null)
{
@@ -88,7 +88,7 @@ namespace DiscImageChef.Commands
if(options.Verbose)
DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", imageFormat.Name,
imageFormat.PluginUuid);
imageFormat.Id);
else DicConsole.WriteLine("Image format identified by {0}.", imageFormat.Name);
try
@@ -102,13 +102,13 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Ls command", "Correctly opened image file.");
DicConsole.DebugWriteLine("Ls command", "Image without headers is {0} bytes.",
imageFormat.ImageInfo.ImageSize);
DicConsole.DebugWriteLine("Ls command", "Image has {0} sectors.", imageFormat.ImageInfo.Sectors);
imageFormat.Info.ImageSize);
DicConsole.DebugWriteLine("Ls command", "Image has {0} sectors.", imageFormat.Info.Sectors);
DicConsole.DebugWriteLine("Ls command", "Image identifies disk type as {0}.",
imageFormat.ImageInfo.MediaType);
imageFormat.Info.MediaType);
Core.Statistics.AddMediaFormat(imageFormat.ImageFormat);
Core.Statistics.AddMedia(imageFormat.ImageInfo.MediaType, false);
Core.Statistics.AddMedia(imageFormat.Info.MediaType, false);
Core.Statistics.AddFilter(inputFilter.Name);
}
catch(Exception ex)
@@ -122,7 +122,7 @@ namespace DiscImageChef.Commands
Core.Partitions.AddSchemesToStats(partitions);
List<string> idPlugins;
Filesystem plugin;
IFilesystem plugin;
Errno error;
if(partitions.Count == 0) DicConsole.DebugWriteLine("Ls command", "No partitions found");
else
@@ -146,15 +146,12 @@ namespace DiscImageChef.Commands
if(plugins.PluginsList.TryGetValue(pluginName, out plugin))
{
DicConsole.WriteLine($"As identified by {plugin.Name}.");
Filesystem fs = (Filesystem)plugin
.GetType().GetConstructor(new[]
{
typeof(ImagePlugin), typeof(Partition), typeof(Encoding)
})?.Invoke(new object[] {imageFormat, partitions[i], null});
IFilesystem fs = (IFilesystem)plugin
.GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { });
if(fs == null) continue;
error = fs.Mount(options.Debug);
error = fs.Mount(imageFormat, partitions[i], encoding, options.Debug);
if(error == Errno.NoError)
{
List<string> rootDir = new List<string>();
@@ -165,7 +162,7 @@ namespace DiscImageChef.Commands
DicConsole.ErrorWriteLine("Error {0} reading root directory {0}",
error.ToString());
Core.Statistics.AddFilesystem(fs.XmlFSType.Type);
Core.Statistics.AddFilesystem(fs.XmlFsType.Type);
}
else
DicConsole.ErrorWriteLine("Unable to mount device, error {0}",
@@ -178,14 +175,11 @@ namespace DiscImageChef.Commands
if(plugin == null) continue;
DicConsole.WriteLine($"Identified by {plugin.Name}.");
Filesystem fs = (Filesystem)plugin
.GetType().GetConstructor(new[]
{
typeof(ImagePlugin), typeof(Partition), typeof(Encoding)
})?.Invoke(new object[] {imageFormat, partitions[i], null});
IFilesystem fs = (IFilesystem)plugin
.GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { });
if(fs == null) continue;
error = fs.Mount(options.Debug);
error = fs.Mount(imageFormat, partitions[i], encoding, options.Debug);
if(error == Errno.NoError)
{
List<string> rootDir = new List<string>();
@@ -195,7 +189,7 @@ namespace DiscImageChef.Commands
else
DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", error.ToString());
Core.Statistics.AddFilesystem(fs.XmlFSType.Type);
Core.Statistics.AddFilesystem(fs.XmlFsType.Type);
}
else DicConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString());
}
@@ -205,8 +199,8 @@ namespace DiscImageChef.Commands
Partition wholePart = new Partition
{
Name = "Whole device",
Length = imageFormat.ImageInfo.Sectors,
Size = imageFormat.ImageInfo.Sectors * imageFormat.ImageInfo.SectorSize
Length = imageFormat.Info.Sectors,
Size = imageFormat.Info.Sectors * imageFormat.Info.SectorSize
};
Core.Filesystems.Identify(imageFormat, out idPlugins, wholePart);
@@ -219,14 +213,11 @@ namespace DiscImageChef.Commands
if(plugins.PluginsList.TryGetValue(pluginName, out plugin))
{
DicConsole.WriteLine($"As identified by {plugin.Name}.");
Filesystem fs = (Filesystem)plugin
.GetType().GetConstructor(new[]
{
typeof(ImagePlugin), typeof(Partition), typeof(Encoding)
})?.Invoke(new object[] {imageFormat, wholePart, null});
IFilesystem fs = (IFilesystem)plugin
.GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { });
if(fs == null) continue;
error = fs.Mount(options.Debug);
error = fs.Mount(imageFormat, wholePart, encoding, options.Debug);
if(error == Errno.NoError)
{
List<string> rootDir = new List<string>();
@@ -236,7 +227,7 @@ namespace DiscImageChef.Commands
else
DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", error.ToString());
Core.Statistics.AddFilesystem(fs.XmlFSType.Type);
Core.Statistics.AddFilesystem(fs.XmlFsType.Type);
}
else DicConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString());
}
@@ -247,12 +238,11 @@ namespace DiscImageChef.Commands
if(plugin != null)
{
DicConsole.WriteLine($"Identified by {plugin.Name}.");
Filesystem fs = (Filesystem)plugin
.GetType().GetConstructor(new[] {typeof(ImagePlugin), typeof(Partition), typeof(Encoding)})
?.Invoke(new object[] {imageFormat, wholePart, null});
IFilesystem fs = (IFilesystem)plugin
.GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { });
if(fs != null)
{
error = fs.Mount(options.Debug);
error = fs.Mount(imageFormat, wholePart, encoding, options.Debug);
if(error == Errno.NoError)
{
List<string> rootDir = new List<string>();
@@ -288,7 +278,7 @@ namespace DiscImageChef.Commands
else
DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", error.ToString());
Core.Statistics.AddFilesystem(fs.XmlFSType.Type);
Core.Statistics.AddFilesystem(fs.XmlFsType.Type);
}
else DicConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString());
}

View File

@@ -50,7 +50,7 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("PrintHex command", "--WidthBytes={0}", options.WidthBytes);
FiltersList filtersList = new FiltersList();
Filter inputFilter = filtersList.GetFilter(options.InputFile);
IFilter inputFilter = filtersList.GetFilter(options.InputFile);
if(inputFilter == null)
{
@@ -58,7 +58,7 @@ namespace DiscImageChef.Commands
return;
}
ImagePlugin inputFormat = ImageFormat.Detect(inputFilter);
IMediaImage inputFormat = ImageFormat.Detect(inputFilter);
if(inputFormat == null)
{
@@ -72,7 +72,7 @@ namespace DiscImageChef.Commands
{
DicConsole.WriteLine("Sector {0}", options.StartSector + i);
if(inputFormat.ImageInfo.ReadableSectorTags == null)
if(inputFormat.Info.ReadableSectorTags == null)
{
DicConsole
.WriteLine("Requested sectors with tags, unsupported by underlying image format, printing only user data.");
@@ -80,7 +80,7 @@ namespace DiscImageChef.Commands
}
else
{
if(inputFormat.ImageInfo.ReadableSectorTags.Count == 0)
if(inputFormat.Info.ReadableSectorTags.Count == 0)
{
DicConsole
.WriteLine("Requested sectors with tags, unsupported by underlying image format, printing only user data.");

View File

@@ -50,7 +50,7 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Verify command", "--verify-sectors={0}", options.VerifySectors);
FiltersList filtersList = new FiltersList();
Filter inputFilter = filtersList.GetFilter(options.InputFile);
IFilter inputFilter = filtersList.GetFilter(options.InputFile);
if(inputFilter == null)
{
@@ -58,7 +58,7 @@ namespace DiscImageChef.Commands
return;
}
ImagePlugin inputFormat = ImageFormat.Detect(inputFilter);
IMediaImage inputFormat = ImageFormat.Detect(inputFilter);
if(inputFormat == null)
{
@@ -68,7 +68,7 @@ namespace DiscImageChef.Commands
inputFormat.OpenImage(inputFilter);
Core.Statistics.AddMediaFormat(inputFormat.ImageFormat);
Core.Statistics.AddMedia(inputFormat.ImageInfo.MediaType, false);
Core.Statistics.AddMedia(inputFormat.Info.MediaType, false);
Core.Statistics.AddFilter(inputFilter.Name);
bool? correctDisc = null;
@@ -132,7 +132,7 @@ namespace DiscImageChef.Commands
while(remainingSectors > 0)
{
DicConsole.Write("\rChecking sector {0} of {1}, on track {2}", currentSectorAll,
inputFormat.ImageInfo.Sectors, currentTrack.TrackSequence);
inputFormat.Info.Sectors, currentTrack.TrackSequence);
List<ulong> tempfailingLbas;
List<ulong> tempunknownLbas;
@@ -174,13 +174,13 @@ namespace DiscImageChef.Commands
}
else
{
ulong remainingSectors = inputFormat.ImageInfo.Sectors;
ulong remainingSectors = inputFormat.Info.Sectors;
ulong currentSector = 0;
startCheck = DateTime.UtcNow;
while(remainingSectors > 0)
{
DicConsole.Write("\rChecking sector {0} of {1}", currentSector, inputFormat.ImageInfo.Sectors);
DicConsole.Write("\rChecking sector {0} of {1}", currentSector, inputFormat.Info.Sectors);
List<ulong> tempfailingLbas;
List<ulong> tempunknownLbas;
@@ -239,22 +239,22 @@ namespace DiscImageChef.Commands
if(options.Verbose)
{
DicConsole.VerboseWriteLine("LBAs with error:");
if(failingLbas.Count == (int)inputFormat.ImageInfo.Sectors)
if(failingLbas.Count == (int)inputFormat.Info.Sectors)
DicConsole.VerboseWriteLine("\tall sectors.");
else foreach(ulong t in failingLbas) DicConsole.VerboseWriteLine("\t{0}", t);
DicConsole.WriteLine("LBAs without checksum:");
if(unknownLbas.Count == (int)inputFormat.ImageInfo.Sectors)
if(unknownLbas.Count == (int)inputFormat.Info.Sectors)
DicConsole.VerboseWriteLine("\tall sectors.");
else foreach(ulong t in unknownLbas) DicConsole.VerboseWriteLine("\t{0}", t);
}
DicConsole.WriteLine("Total sectors........... {0}", inputFormat.ImageInfo.Sectors);
DicConsole.WriteLine("Total sectors........... {0}", inputFormat.Info.Sectors);
DicConsole.WriteLine("Total errors............ {0}", failingLbas.Count);
DicConsole.WriteLine("Total unknowns.......... {0}", unknownLbas.Count);
DicConsole.WriteLine("Total errors+unknowns... {0}", failingLbas.Count + unknownLbas.Count);
totalSectors = (long)inputFormat.ImageInfo.Sectors;
totalSectors = (long)inputFormat.Info.Sectors;
errorSectors = failingLbas.Count;
unknownSectors = unknownLbas.Count;
correctSectors = totalSectors - errorSectors - unknownSectors;