Add 'image-info' verb.

This commit is contained in:
2018-01-28 16:05:54 +00:00
parent 4d49c40aad
commit 7ecdd1ae4e
19 changed files with 1166 additions and 496 deletions

View File

@@ -31,6 +31,7 @@
<e p="Entropy.cs" t="Include" /> <e p="Entropy.cs" t="Include" />
<e p="ExtractFiles.cs" t="Include" /> <e p="ExtractFiles.cs" t="Include" />
<e p="Formats.cs" t="Include" /> <e p="Formats.cs" t="Include" />
<e p="ImageInfo.cs" t="Include" />
<e p="ListDevices.cs" t="Include" /> <e p="ListDevices.cs" t="Include" />
<e p="ListEncodings.cs" t="Include" /> <e p="ListEncodings.cs" t="Include" />
<e p="ListOptions.cs" t="Include" /> <e p="ListOptions.cs" t="Include" />
@@ -155,6 +156,7 @@
<e p="DiscImageChef.Core.csproj" t="IncludeRecursive" /> <e p="DiscImageChef.Core.csproj" t="IncludeRecursive" />
<e p="Filesystems.cs" t="Include" /> <e p="Filesystems.cs" t="Include" />
<e p="ImageFormat.cs" t="Include" /> <e p="ImageFormat.cs" t="Include" />
<e p="ImageInfo.cs" t="Include" />
<e p="Logging" t="Include"> <e p="Logging" t="Include">
<e p="DumpLog.cs" t="Include" /> <e p="DumpLog.cs" t="Include" />
<e p="IBGLog.cs" t="Include" /> <e p="IBGLog.cs" t="Include" />
@@ -163,6 +165,7 @@
<e p="Options.cs" t="Include" /> <e p="Options.cs" t="Include" />
<e p="Partitions.cs" t="Include" /> <e p="Partitions.cs" t="Include" />
<e p="PluginBase.cs" t="Include" /> <e p="PluginBase.cs" t="Include" />
<e p="PrintScsiModePages.cs" t="Include" />
<e p="Properties" t="Include"> <e p="Properties" t="Include">
<e p="AssemblyInfo.cs" t="Include" /> <e p="AssemblyInfo.cs" t="Include" />
</e> </e>

View File

@@ -37,9 +37,11 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ImageInfo.cs" />
<Compile Include="Options.cs" /> <Compile Include="Options.cs" />
<Compile Include="PluginBase.cs" /> <Compile Include="PluginBase.cs" />
<Compile Include="ImageFormat.cs" /> <Compile Include="ImageFormat.cs" />
<Compile Include="PrintScsiModePages.cs" />
<Compile Include="Statistics.cs" /> <Compile Include="Statistics.cs" />
<Compile Include="Checksum.cs" /> <Compile Include="Checksum.cs" />
<Compile Include="Logging\IBGLog.cs" /> <Compile Include="Logging\IBGLog.cs" />

View File

@@ -0,0 +1,497 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : ImageInfo.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Core algorithms.
//
// --[ Description ] ----------------------------------------------------------
//
// Prints image information to console.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General public License as
// 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
// GNU General public License for more details.
//
// You should have received a copy of the GNU General public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
using System;
using System.Linq;
using System.Text;
using DiscImageChef.Console;
using DiscImageChef.Decoders.ATA;
using DiscImageChef.Decoders.Bluray;
using DiscImageChef.Decoders.CD;
using DiscImageChef.Decoders.DVD;
using DiscImageChef.Decoders.PCMCIA;
using DiscImageChef.Decoders.SCSI;
using DiscImageChef.Decoders.Xbox;
using DiscImageChef.DiscImages;
using DDS = DiscImageChef.Decoders.DVD.DDS;
using DMI = DiscImageChef.Decoders.Xbox.DMI;
using Tuple = DiscImageChef.Decoders.PCMCIA.Tuple;
namespace DiscImageChef.Core
{
public static class ImageInfo
{
public static void PrintImageInfo(IMediaImage imageFormat)
{
DicConsole.WriteLine("Image information:");
if(!string.IsNullOrWhiteSpace(imageFormat.Info.Version))
DicConsole.WriteLine("Format: {0} version {1}", imageFormat.Format, imageFormat.Info.Version);
else DicConsole.WriteLine("Format: {0}", imageFormat.Format);
if(!string.IsNullOrWhiteSpace(imageFormat.Info.Application) &&
!string.IsNullOrWhiteSpace(imageFormat.Info.ApplicationVersion))
DicConsole.WriteLine("Was created with {0} version {1}", imageFormat.Info.Application,
imageFormat.Info.ApplicationVersion);
else if(!string.IsNullOrWhiteSpace(imageFormat.Info.Application))
DicConsole.WriteLine("Was created with {0}", imageFormat.Info.Application);
DicConsole.WriteLine("Image without headers is {0} bytes long", imageFormat.Info.ImageSize);
DicConsole.WriteLine("Contains a media of {0} sectors with a maximum sector size of {1} bytes (if all sectors are of the same size this would be {2} bytes)",
imageFormat.Info.Sectors, imageFormat.Info.SectorSize,
imageFormat.Info.Sectors * imageFormat.Info.SectorSize);
if(!string.IsNullOrWhiteSpace(imageFormat.Info.Creator))
DicConsole.WriteLine("Created by: {0}", imageFormat.Info.Creator);
if(imageFormat.Info.CreationTime != DateTime.MinValue)
DicConsole.WriteLine("Created on {0}", imageFormat.Info.CreationTime);
if(imageFormat.Info.LastModificationTime != DateTime.MinValue)
DicConsole.WriteLine("Last modified on {0}", imageFormat.Info.LastModificationTime);
DicConsole.WriteLine("Contains a media of type {0} and XML type {1}", imageFormat.Info.MediaType,
imageFormat.Info.XmlMediaType);
DicConsole.WriteLine("{0} partitions", imageFormat.Info.HasPartitions ? "Has" : "Doesn't have");
DicConsole.WriteLine("{0} sessions", imageFormat.Info.HasSessions ? "Has" : "Doesn't have");
if(!string.IsNullOrWhiteSpace(imageFormat.Info.Comments))
DicConsole.WriteLine("Comments: {0}", imageFormat.Info.Comments);
if(imageFormat.Info.MediaSequence != 0 && imageFormat.Info.LastMediaSequence != 0)
DicConsole.WriteLine("Media is number {0} on a set of {1} medias", imageFormat.Info.MediaSequence,
imageFormat.Info.LastMediaSequence);
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaTitle))
DicConsole.WriteLine("Media title: {0}", imageFormat.Info.MediaTitle);
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaManufacturer))
DicConsole.WriteLine("Media manufacturer: {0}", imageFormat.Info.MediaManufacturer);
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaModel))
DicConsole.WriteLine("Media model: {0}", imageFormat.Info.MediaModel);
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaSerialNumber))
DicConsole.WriteLine("Media serial number: {0}", imageFormat.Info.MediaSerialNumber);
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaBarcode))
DicConsole.WriteLine("Media barcode: {0}", imageFormat.Info.MediaBarcode);
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaPartNumber))
DicConsole.WriteLine("Media part number: {0}", imageFormat.Info.MediaPartNumber);
if(!string.IsNullOrWhiteSpace(imageFormat.Info.DriveManufacturer))
DicConsole.WriteLine("Drive manufacturer: {0}", imageFormat.Info.DriveManufacturer);
if(!string.IsNullOrWhiteSpace(imageFormat.Info.DriveModel))
DicConsole.WriteLine("Drive model: {0}", imageFormat.Info.DriveModel);
if(!string.IsNullOrWhiteSpace(imageFormat.Info.DriveSerialNumber))
DicConsole.WriteLine("Drive serial number: {0}", imageFormat.Info.DriveSerialNumber);
if(!string.IsNullOrWhiteSpace(imageFormat.Info.DriveFirmwareRevision))
DicConsole.WriteLine("Drive firmware info: {0}", imageFormat.Info.DriveFirmwareRevision);
if(imageFormat.Info.Cylinders > 0 && imageFormat.Info.Heads > 0 && imageFormat.Info.SectorsPerTrack > 0)
DicConsole.WriteLine("Media geometry: {0} cylinders, {1} heads, {2} sectors per track",
imageFormat.Info.Cylinders, imageFormat.Info.Heads,
imageFormat.Info.SectorsPerTrack);
if(imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Count > 0)
{
DicConsole.WriteLine("Contains {0} readable media tags:", imageFormat.Info.ReadableMediaTags.Count);
foreach(MediaTagType tag in imageFormat.Info.ReadableMediaTags.OrderBy(t => t)) DicConsole.Write("{0} ", tag);
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableSectorTags != null && imageFormat.Info.ReadableSectorTags.Count > 0)
{
DicConsole.WriteLine("Contains {0} readable sector tags:", imageFormat.Info.ReadableSectorTags.Count);
foreach(SectorTagType tag in imageFormat.Info.ReadableSectorTags.OrderBy(t => t)) DicConsole.Write("{0} ", tag);
DicConsole.WriteLine();
}
DicConsole.WriteLine();
PeripheralDeviceTypes scsiDeviceType = PeripheralDeviceTypes.DirectAccess;
byte[] scsiVendorId = null;
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_INQUIRY))
{
byte[] inquiry = imageFormat.ReadDiskTag(MediaTagType.SCSI_INQUIRY);
scsiDeviceType = (PeripheralDeviceTypes)(inquiry[0] & 0x1F);
if(inquiry.Length >= 16)
{
scsiVendorId = new byte[8];
Array.Copy(inquiry, 8, scsiVendorId, 0, 8);
}
DicConsole.WriteLine("SCSI INQUIRY contained in image:");
DicConsole.Write("{0}", Inquiry.Prettify(inquiry));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.ATA_IDENTIFY))
{
byte[] identify = imageFormat.ReadDiskTag(MediaTagType.ATA_IDENTIFY);
DicConsole.WriteLine("ATA IDENTIFY contained in image:");
DicConsole.Write("{0}", Identify.Prettify(identify));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.ATAPI_IDENTIFY))
{
byte[] identify = imageFormat.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY);
DicConsole.WriteLine("ATAPI IDENTIFY contained in image:");
DicConsole.Write("{0}", Identify.Prettify(identify));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_MODESENSE_10))
{
byte[] modeSense10 = imageFormat.ReadDiskTag(MediaTagType.SCSI_MODESENSE_10);
Modes.DecodedMode? decMode = Modes.DecodeMode10(modeSense10, scsiDeviceType);
if(decMode.HasValue)
{
DicConsole.WriteLine("SCSI MODE SENSE (10) contained in image:");
PrintScsiModePages.Print(decMode.Value, scsiDeviceType, scsiVendorId);
DicConsole.WriteLine();
}
}
else if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_MODESENSE_6))
{
byte[] modeSense6 = imageFormat.ReadDiskTag(MediaTagType.SCSI_MODESENSE_6);
Modes.DecodedMode? decMode = Modes.DecodeMode6(modeSense6, scsiDeviceType);
if(decMode.HasValue)
{
DicConsole.WriteLine("SCSI MODE SENSE (6) contained in image:");
PrintScsiModePages.Print(decMode.Value, scsiDeviceType, scsiVendorId);
DicConsole.WriteLine();
}
}
else if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_MODEPAGE_2A))
{
byte[] mode2A = imageFormat.ReadDiskTag(MediaTagType.SCSI_MODEPAGE_2A);
DicConsole.WriteLine("SCSI INQUIRY contained in image:");
DicConsole.Write("{0}", Modes.PrettifyModePage_2A(mode2A));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_FullTOC))
{
byte[] toc = imageFormat.ReadDiskTag(MediaTagType.CD_FullTOC);
DicConsole.WriteLine("CompactDisc Table of Contents contained in image:");
DicConsole.Write("{0}", FullTOC.Prettify(toc));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_PMA))
{
byte[] pma = imageFormat.ReadDiskTag(MediaTagType.CD_PMA);
DicConsole.WriteLine("CompactDisc Power Management Area contained in image:");
DicConsole.Write("{0}", PMA.Prettify(pma));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_ATIP))
{
byte[] atip = imageFormat.ReadDiskTag(MediaTagType.CD_ATIP);
DicConsole.WriteLine("CompactDisc Absolute Time In Pregroove (ATIP) contained in image:");
DicConsole.Write("{0}", ATIP.Prettify(atip));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_TEXT))
{
byte[] cdtext = imageFormat.ReadDiskTag(MediaTagType.CD_TEXT);
DicConsole.WriteLine("CompactDisc Lead-in's CD-Text contained in image:");
DicConsole.Write("{0}", CDTextOnLeadIn.Prettify(cdtext));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_MCN))
{
byte[] mcn = imageFormat.ReadDiskTag(MediaTagType.CD_MCN);
DicConsole.WriteLine("CompactDisc Media Catalogue Number contained in image: {0}",
Encoding.UTF8.GetString(mcn));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_PFI))
{
byte[] pfi = imageFormat.ReadDiskTag(MediaTagType.DVD_PFI);
DicConsole.WriteLine("DVD Physical Format Information contained in image:");
DicConsole.Write("{0}", PFI.Prettify(pfi));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDRAM_DDS))
{
byte[] dds = imageFormat.ReadDiskTag(MediaTagType.DVDRAM_DDS);
DicConsole.WriteLine("DVD-RAM Disc Definition Structure contained in image:");
DicConsole.Write("{0}", DDS.Prettify(dds));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDR_PFI))
{
byte[] pfi = imageFormat.ReadDiskTag(MediaTagType.DVDR_PFI);
DicConsole.WriteLine("DVD-R Physical Format Information contained in image:");
DicConsole.Write("{0}", PFI.Prettify(pfi));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_DI))
{
byte[] di = imageFormat.ReadDiskTag(MediaTagType.BD_DI);
DicConsole.WriteLine("Bluray Disc Information contained in image:");
DicConsole.Write("{0}", DI.Prettify(di));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_DDS))
{
byte[] dds = imageFormat.ReadDiskTag(MediaTagType.BD_DDS);
DicConsole.WriteLine("Bluray Disc Definition Structure contained in image:");
DicConsole.Write("{0}", Decoders.Bluray.DDS.Prettify(dds));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.PCMCIA_CIS))
{
byte[] cis = imageFormat.ReadDiskTag(MediaTagType.PCMCIA_CIS);
DicConsole.WriteLine("PCMCIA CIS:");
Tuple[] tuples = CIS.GetTuples(cis);
if(tuples != null)
foreach(Tuple tuple in tuples)
switch(tuple.Code)
{
case TupleCodes.CISTPL_NULL:
case TupleCodes.CISTPL_END: break;
case TupleCodes.CISTPL_DEVICEGEO:
case TupleCodes.CISTPL_DEVICEGEO_A:
DicConsole.WriteLine("{0}", CIS.PrettifyDeviceGeometryTuple(tuple));
break;
case TupleCodes.CISTPL_MANFID:
DicConsole.WriteLine("{0}", CIS.PrettifyManufacturerIdentificationTuple(tuple));
break;
case TupleCodes.CISTPL_VERS_1:
DicConsole.WriteLine("{0}", CIS.PrettifyLevel1VersionTuple(tuple));
break;
case TupleCodes.CISTPL_ALTSTR:
case TupleCodes.CISTPL_BAR:
case TupleCodes.CISTPL_BATTERY:
case TupleCodes.CISTPL_BYTEORDER:
case TupleCodes.CISTPL_CFTABLE_ENTRY:
case TupleCodes.CISTPL_CFTABLE_ENTRY_CB:
case TupleCodes.CISTPL_CHECKSUM:
case TupleCodes.CISTPL_CONFIG:
case TupleCodes.CISTPL_CONFIG_CB:
case TupleCodes.CISTPL_DATE:
case TupleCodes.CISTPL_DEVICE:
case TupleCodes.CISTPL_DEVICE_A:
case TupleCodes.CISTPL_DEVICE_OA:
case TupleCodes.CISTPL_DEVICE_OC:
case TupleCodes.CISTPL_EXTDEVIC:
case TupleCodes.CISTPL_FORMAT:
case TupleCodes.CISTPL_FORMAT_A:
case TupleCodes.CISTPL_FUNCE:
case TupleCodes.CISTPL_FUNCID:
case TupleCodes.CISTPL_GEOMETRY:
case TupleCodes.CISTPL_INDIRECT:
case TupleCodes.CISTPL_JEDEC_A:
case TupleCodes.CISTPL_JEDEC_C:
case TupleCodes.CISTPL_LINKTARGET:
case TupleCodes.CISTPL_LONGLINK_A:
case TupleCodes.CISTPL_LONGLINK_C:
case TupleCodes.CISTPL_LONGLINK_CB:
case TupleCodes.CISTPL_LONGLINK_MFC:
case TupleCodes.CISTPL_NO_LINK:
case TupleCodes.CISTPL_ORG:
case TupleCodes.CISTPL_PWR_MGMNT:
case TupleCodes.CISTPL_SPCL:
case TupleCodes.CISTPL_SWIL:
case TupleCodes.CISTPL_VERS_2:
DicConsole.DebugWriteLine("Device-Info command", "Found undecoded tuple ID {0}",
tuple.Code);
break;
default:
DicConsole.DebugWriteLine("Device-Info command", "Found unknown tuple ID 0x{0:X2}",
(byte)tuple.Code);
break;
}
else DicConsole.DebugWriteLine("Device-Info command", "Could not get tuples");
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_CID))
{
byte[] cid = imageFormat.ReadDiskTag(MediaTagType.SD_CID);
DicConsole.WriteLine("SecureDigital CID contained in image:");
DicConsole.Write("{0}", Decoders.SecureDigital.Decoders.PrettifyCID(cid));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_CSD))
{
byte[] csd = imageFormat.ReadDiskTag(MediaTagType.SD_CSD);
DicConsole.WriteLine("SecureDigital CSD contained in image:");
DicConsole.Write("{0}", Decoders.SecureDigital.Decoders.PrettifyCSD(csd));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_SCR))
{
byte[] scr = imageFormat.ReadDiskTag(MediaTagType.SD_SCR);
DicConsole.WriteLine("SecureDigital SCR contained in image:");
DicConsole.Write("{0}", Decoders.SecureDigital.Decoders.PrettifySCR(scr));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_OCR))
{
byte[] ocr = imageFormat.ReadDiskTag(MediaTagType.SD_OCR);
DicConsole.WriteLine("SecureDigital OCR contained in image:");
DicConsole.Write("{0}", Decoders.SecureDigital.Decoders.PrettifyOCR(ocr));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_CID))
{
byte[] cid = imageFormat.ReadDiskTag(MediaTagType.MMC_CID);
DicConsole.WriteLine("MultiMediaCard CID contained in image:");
DicConsole.Write("{0}", Decoders.MMC.Decoders.PrettifyCID(cid));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_CSD))
{
byte[] csd = imageFormat.ReadDiskTag(MediaTagType.MMC_CSD);
DicConsole.WriteLine("MultiMediaCard CSD contained in image:");
DicConsole.Write("{0}", Decoders.MMC.Decoders.PrettifyCSD(csd));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_ExtendedCSD))
{
byte[] ecsd = imageFormat.ReadDiskTag(MediaTagType.MMC_ExtendedCSD);
DicConsole.WriteLine("MultiMediaCard ExtendedCSD contained in image:");
DicConsole.Write("{0}", Decoders.MMC.Decoders.PrettifyExtendedCSD(ecsd));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_OCR))
{
byte[] ocr = imageFormat.ReadDiskTag(MediaTagType.MMC_OCR);
DicConsole.WriteLine("MultiMediaCard OCR contained in image:");
DicConsole.Write("{0}", Decoders.MMC.Decoders.PrettifyOCR(ocr));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.Xbox_PFI))
{
byte[] xpfi = imageFormat.ReadDiskTag(MediaTagType.Xbox_PFI);
DicConsole.WriteLine("Xbox Physical Format Information contained in image:");
DicConsole.Write("{0}", PFI.Prettify(xpfi));
DicConsole.WriteLine();
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.Xbox_DMI))
{
byte[] xdmi = imageFormat.ReadDiskTag(MediaTagType.Xbox_DMI);
if(DMI.IsXbox(xdmi))
{
DMI.XboxDMI? xmi = DMI.DecodeXbox(xdmi);
if(xmi.HasValue)
{
DicConsole.WriteLine("Xbox DMI contained in image:");
DicConsole.Write("{0}", DMI.PrettifyXbox(xmi));
DicConsole.WriteLine();
}
}
if(DMI.IsXbox360(xdmi))
{
DMI.Xbox360DMI? xmi = DMI.DecodeXbox360(xdmi);
if(xmi.HasValue)
{
DicConsole.WriteLine("Xbox 360 DMI contained in image:");
DicConsole.Write("{0}", DMI.PrettifyXbox360(xmi));
DicConsole.WriteLine();
}
}
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.Xbox_SecuritySector))
{
byte[] toc = imageFormat.ReadDiskTag(MediaTagType.Xbox_SecuritySector);
DicConsole.WriteLine("Xbox Security Sectors contained in image:");
DicConsole.Write("{0}", SS.Prettify(toc));
DicConsole.WriteLine();
}
}
}
}

View File

@@ -0,0 +1,291 @@
using DiscImageChef.Console;
using DiscImageChef.Decoders.SCSI;
namespace DiscImageChef.Core
{
public class PrintScsiModePages
{
public static void Print(Modes.DecodedMode decMode, PeripheralDeviceTypes devType, byte[] vendorId)
{
DicConsole.WriteLine(Modes.PrettifyModeHeader(decMode.Header, devType));
if(decMode.Pages == null) return;
foreach(Modes.ModePage page in decMode.Pages)
//DicConsole.WriteLine("Page {0:X2}h subpage {1:X2}h is {2} bytes long", page.Page, page.Subpage, page.PageResponse.Length);
switch(page.Page)
{
case 0x00:
{
if(devType == PeripheralDeviceTypes.MultiMediaDevice && page.Subpage == 0)
DicConsole.WriteLine(Modes.PrettifyModePage_00_SFF(page.PageResponse));
else
{
if(page.Subpage != 0)
DicConsole.WriteLine("Found unknown vendor mode page {0:X2}h subpage {1:X2}h",
page.Page, page.Subpage);
else DicConsole.WriteLine("Found unknown vendor mode page {0:X2}h", page.Page);
}
break;
}
case 0x01:
{
if(page.Subpage == 0)
DicConsole.WriteLine(devType == PeripheralDeviceTypes.MultiMediaDevice
? Modes.PrettifyModePage_01_MMC(page.PageResponse)
: Modes.PrettifyModePage_01(page.PageResponse));
else goto default;
break;
}
case 0x02:
{
if(page.Subpage == 0) DicConsole.WriteLine(Modes.PrettifyModePage_02(page.PageResponse));
else goto default;
break;
}
case 0x03:
{
if(page.Subpage == 0) DicConsole.WriteLine(Modes.PrettifyModePage_03(page.PageResponse));
else goto default;
break;
}
case 0x04:
{
if(page.Subpage == 0) DicConsole.WriteLine(Modes.PrettifyModePage_04(page.PageResponse));
else goto default;
break;
}
case 0x05:
{
if(page.Subpage == 0) DicConsole.WriteLine(Modes.PrettifyModePage_05(page.PageResponse));
else goto default;
break;
}
case 0x06:
{
if(page.Subpage == 0) DicConsole.WriteLine(Modes.PrettifyModePage_06(page.PageResponse));
else goto default;
break;
}
case 0x07:
{
if(page.Subpage == 0)
DicConsole.WriteLine(devType == PeripheralDeviceTypes.MultiMediaDevice
? Modes.PrettifyModePage_07_MMC(page.PageResponse)
: Modes.PrettifyModePage_07(page.PageResponse));
else goto default;
break;
}
case 0x08:
{
if(page.Subpage == 0) DicConsole.WriteLine(Modes.PrettifyModePage_08(page.PageResponse));
else goto default;
break;
}
case 0x0A:
{
if(page.Subpage == 0) DicConsole.WriteLine(Modes.PrettifyModePage_0A(page.PageResponse));
else if(page.Subpage == 1)
DicConsole.WriteLine(Modes.PrettifyModePage_0A_S01(page.PageResponse));
else
goto default;
break;
}
case 0x0B:
{
if(page.Subpage == 0) DicConsole.WriteLine(Modes.PrettifyModePage_0B(page.PageResponse));
else goto default;
break;
}
case 0x0D:
{
if(page.Subpage == 0) DicConsole.WriteLine(Modes.PrettifyModePage_0D(page.PageResponse));
else goto default;
break;
}
case 0x0E:
{
if(page.Subpage == 0) DicConsole.WriteLine(Modes.PrettifyModePage_0E(page.PageResponse));
else goto default;
break;
}
case 0x0F:
{
if(page.Subpage == 0) DicConsole.WriteLine(Modes.PrettifyModePage_0F(page.PageResponse));
else goto default;
break;
}
case 0x10:
{
if(page.Subpage == 0)
DicConsole.WriteLine(devType == PeripheralDeviceTypes.SequentialAccess
? Modes.PrettifyModePage_10_SSC(page.PageResponse)
: Modes.PrettifyModePage_10(page.PageResponse));
else goto default;
break;
}
case 0x11:
{
if(page.Subpage == 0) DicConsole.WriteLine(Modes.PrettifyModePage_11(page.PageResponse));
else goto default;
break;
}
case 0x12:
case 0x13:
case 0x14:
{
if(page.Subpage == 0) DicConsole.WriteLine(Modes.PrettifyModePage_12_13_14(page.PageResponse));
else goto default;
break;
}
case 0x1A:
{
if(page.Subpage == 0) DicConsole.WriteLine(Modes.PrettifyModePage_1A(page.PageResponse));
else if(page.Subpage == 1)
DicConsole.WriteLine(Modes.PrettifyModePage_1A_S01(page.PageResponse));
else
goto default;
break;
}
case 0x1B:
{
if(page.Subpage == 0) DicConsole.WriteLine(Modes.PrettifyModePage_1B(page.PageResponse));
else goto default;
break;
}
case 0x1C:
{
if(page.Subpage == 0)
DicConsole.WriteLine(devType == PeripheralDeviceTypes.MultiMediaDevice
? Modes.PrettifyModePage_1C_SFF(page.PageResponse)
: Modes.PrettifyModePage_1C(page.PageResponse));
else if(page.Subpage == 1)
DicConsole.WriteLine(Modes.PrettifyModePage_1C_S01(page.PageResponse));
else
goto default;
break;
}
case 0x1D:
{
if(page.Subpage == 0) DicConsole.WriteLine(Modes.PrettifyModePage_1D(page.PageResponse));
else goto default;
break;
}
case 0x21:
{
if(StringHandlers.CToString(vendorId).Trim() == "CERTANCE")
DicConsole.WriteLine(Modes.PrettifyCertanceModePage_21(page.PageResponse));
else goto default;
break;
}
case 0x22:
{
if(StringHandlers.CToString(vendorId).Trim() == "CERTANCE")
DicConsole.WriteLine(Modes.PrettifyCertanceModePage_22(page.PageResponse));
else goto default;
break;
}
case 0x24:
{
if(StringHandlers.CToString(vendorId).Trim() == "IBM")
DicConsole.WriteLine(Modes.PrettifyIBMModePage_24(page.PageResponse));
else goto default;
break;
}
case 0x2A:
{
if(page.Subpage == 0) DicConsole.WriteLine(Modes.PrettifyModePage_2A(page.PageResponse));
else goto default;
break;
}
case 0x2F:
{
if(StringHandlers.CToString(vendorId).Trim() == "IBM")
DicConsole.WriteLine(Modes.PrettifyIBMModePage_2F(page.PageResponse));
else goto default;
break;
}
case 0x30:
{
if(Modes.IsAppleModePage_30(page.PageResponse))
DicConsole.WriteLine("Drive identifies as Apple OEM drive");
else goto default;
break;
}
case 0x3B:
{
if(StringHandlers.CToString(vendorId).Trim() == "HP")
DicConsole.WriteLine(Modes.PrettifyHPModePage_3B(page.PageResponse));
else goto default;
break;
}
case 0x3C:
{
if(StringHandlers.CToString(vendorId).Trim() == "HP")
DicConsole.WriteLine(Modes.PrettifyHPModePage_3C(page.PageResponse));
else goto default;
break;
}
case 0x3D:
{
if(StringHandlers.CToString(vendorId).Trim() == "IBM")
DicConsole.WriteLine(Modes.PrettifyIBMModePage_3D(page.PageResponse));
else if(StringHandlers.CToString(vendorId).Trim() == "HP")
DicConsole.WriteLine(Modes.PrettifyHPModePage_3D(page.PageResponse));
else
goto default;
break;
}
case 0x3E:
{
if(StringHandlers.CToString(vendorId).Trim() == "FUJITSU")
DicConsole.WriteLine(Modes.PrettifyFujitsuModePage_3E(page.PageResponse));
else if(StringHandlers.CToString(vendorId).Trim() == "HP")
DicConsole.WriteLine(Modes.PrettifyHPModePage_3E(page.PageResponse));
else
goto default;
break;
}
default:
{
if(page.Subpage != 0)
DicConsole.WriteLine("Found unknown mode page {0:X2}h subpage {1:X2}h", page.Page,
page.Subpage);
else DicConsole.WriteLine("Found unknown mode page {0:X2}h", page.Page);
break;
}
}
}
}
}

View File

@@ -216,7 +216,7 @@ namespace DiscImageChef.Core
System.Console.WriteLine("Uploading partial statistics file {0}", statsFile); System.Console.WriteLine("Uploading partial statistics file {0}", statsFile);
#else #else
DiscImageChef.Console.DicConsole.DebugWriteLine("Submit stats", "Uploading partial statistics file {0}", statsFile); DiscImageChef.Console.DicConsole.DebugWriteLine("Submit stats", "Uploading partial statistics file {0}", statsFile);
#endif #endif
FileStream fs = new FileStream(statsFile, FileMode.Open, FileAccess.Read); FileStream fs = new FileStream(statsFile, FileMode.Open, FileAccess.Read);
XmlSerializer xs = new XmlSerializer(stats.GetType()); XmlSerializer xs = new XmlSerializer(stats.GetType());
@@ -258,7 +258,7 @@ namespace DiscImageChef.Core
throw; throw;
#else #else
continue; continue;
#endif #endif
} }
submitStatsLock = false; submitStatsLock = false;
@@ -360,6 +360,10 @@ namespace DiscImageChef.Core
AllStats.Commands.ConvertImage++; AllStats.Commands.ConvertImage++;
CurrentStats.Commands.ConvertImage++; CurrentStats.Commands.ConvertImage++;
break; break;
case "image-info":
AllStats.Commands.ImageInfo++;
CurrentStats.Commands.ImageInfo++;
break;
} }
} }

View File

@@ -75,6 +75,7 @@ namespace DiscImageChef.Metadata
public long Entropy; public long Entropy;
public long ExtractFiles; public long ExtractFiles;
public long Formats; public long Formats;
public long ImageInfo;
public long ListDevices; public long ListDevices;
public long ListEncodings; public long ListEncodings;
public long Ls; public long Ls;

View File

@@ -110,6 +110,7 @@ namespace DiscImageChef.Server.Controllers
oldStats.Commands.ListDevices += newStats.Commands.ListDevices; oldStats.Commands.ListDevices += newStats.Commands.ListDevices;
oldStats.Commands.ListEncodings += newStats.Commands.ListEncodings; oldStats.Commands.ListEncodings += newStats.Commands.ListEncodings;
oldStats.Commands.ConvertImage += newStats.Commands.ConvertImage; oldStats.Commands.ConvertImage += newStats.Commands.ConvertImage;
oldStats.Commands.ImageInfo += newStats.Commands.ImageInfo;
} }
if(newStats.OperatingSystems != null) if(newStats.OperatingSystems != null)

View File

@@ -52,7 +52,8 @@
</head> </head>
<body id="body" runat="server"> <body id="body" runat="server">
<h1 align="center"> <h1 align="center">
Welcome to <i> Welcome to
<i>
<a href="http://github.com/claunia/discimagechef" target="_blank">DiscImageChef</a> <a href="http://github.com/claunia/discimagechef" target="_blank">DiscImageChef</a>
</i> Server version <asp:Label id="lblVersion" runat="server"/> </i> Server version <asp:Label id="lblVersion" runat="server"/>
</h1> </h1>
@@ -64,7 +65,8 @@
<ItemTemplate> <ItemTemplate>
<tr> <tr>
<td> <td>
DiscImageChef has run on <i> DiscImageChef has run on
<i>
<asp:Label runat="server" Text='<%# Eval("name") %>'/> <asp:Label runat="server" Text='<%# Eval("name") %>'/>
</i> <asp:Label runat="server" Text='<%# Eval("Value") %>'/> times. </i> <asp:Label runat="server" Text='<%# Eval("Value") %>'/> times.
</td> </td>
@@ -80,7 +82,8 @@
<ItemTemplate> <ItemTemplate>
<tr> <tr>
<td> <td>
DiscImageChef version <i> DiscImageChef version
<i>
<asp:Label runat="server" Text='<%# Eval("name") %>'/> <asp:Label runat="server" Text='<%# Eval("name") %>'/>
</i> has been used <asp:Label runat="server" Text='<%# Eval("Value") %>'/> times. </i> has been used <asp:Label runat="server" Text='<%# Eval("Value") %>'/> times.
</td> </td>
@@ -106,6 +109,7 @@
<i>entropy</i> command has been run <asp:Label id="lblEntropy" runat="server"/> times<br/> <i>entropy</i> command has been run <asp:Label id="lblEntropy" runat="server"/> times<br/>
<i>extract-files</i> command has been run <asp:Label id="lblExtractFiles" runat="server"/> times<br/> <i>extract-files</i> command has been run <asp:Label id="lblExtractFiles" runat="server"/> times<br/>
<i>formats</i> command has been run <asp:Label id="lblFormats" runat="server"/> times<br/> <i>formats</i> command has been run <asp:Label id="lblFormats" runat="server"/> times<br/>
<i>image-info</i> command has been run <asp:Label id="lblImageInfo" runat="server"/> times<br/>
<i>list-devices</i> command has been run <asp:Label id="lblListDevices" runat="server"/> times<br/> <i>list-devices</i> command has been run <asp:Label id="lblListDevices" runat="server"/> times<br/>
<i>list-encodings</i> command has been run <asp:Label id="lblListEncodings" runat="server"/> times<br/> <i>list-encodings</i> command has been run <asp:Label id="lblListEncodings" runat="server"/> times<br/>
<i>ls</i> command has been run <asp:Label id="lblLs" runat="server"/> times<br/> <i>ls</i> command has been run <asp:Label id="lblLs" runat="server"/> times<br/>

View File

@@ -51,13 +51,13 @@ namespace DiscImageChef.Server
/// </summary> /// </summary>
public partial class Statistics : Page public partial class Statistics : Page
{ {
List<DeviceItem> devices; List<DeviceItem> devices;
List<NameValueStats> operatingSystems; List<NameValueStats> operatingSystems;
List<MediaItem> realMedia; List<MediaItem> realMedia;
Stats statistics; Stats statistics;
List<NameValueStats> versions; List<NameValueStats> versions;
List<MediaItem> virtualMedia; List<MediaItem> virtualMedia;
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
{ {
@@ -68,19 +68,19 @@ namespace DiscImageChef.Server
if(!File.Exists(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), if(!File.Exists(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"Statistics", "Statistics.xml"))) "Statistics", "Statistics.xml")))
{ {
#if DEBUG #if DEBUG
content.InnerHtml = content.InnerHtml =
$"<b>Sorry, cannot load data file \"{Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Statistics", "Statistics.xml")}\"</b>"; $"<b>Sorry, cannot load data file \"{Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Statistics", "Statistics.xml")}\"</b>";
#else #else
content.InnerHtml = "<b>Sorry, cannot load data file</b>"; content.InnerHtml = "<b>Sorry, cannot load data file</b>";
#endif #endif
return; return;
} }
statistics = new Stats(); statistics = new Stats();
XmlSerializer xs = new XmlSerializer(statistics.GetType()); XmlSerializer xs = new XmlSerializer(statistics.GetType());
FileStream fs = FileStream fs =
WaitForFile(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Statistics", "Statistics.xml"), WaitForFile(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Statistics", "Statistics.xml"),
FileMode.Open, FileAccess.Read, FileShare.Read); FileMode.Open, FileAccess.Read, FileShare.Read);
statistics = (Stats)xs.Deserialize(fs); statistics = (Stats)xs.Deserialize(fs);
@@ -117,26 +117,27 @@ namespace DiscImageChef.Server
if(statistics.Commands != null) if(statistics.Commands != null)
{ {
lblAnalyze.Text = statistics.Commands.Analyze.ToString(); lblAnalyze.Text = statistics.Commands.Analyze.ToString();
lblCompare.Text = statistics.Commands.Compare.ToString(); lblCompare.Text = statistics.Commands.Compare.ToString();
lblChecksum.Text = statistics.Commands.Checksum.ToString(); lblChecksum.Text = statistics.Commands.Checksum.ToString();
lblEntropy.Text = statistics.Commands.Entropy.ToString(); lblEntropy.Text = statistics.Commands.Entropy.ToString();
lblVerify.Text = statistics.Commands.Verify.ToString(); lblVerify.Text = statistics.Commands.Verify.ToString();
lblPrintHex.Text = statistics.Commands.PrintHex.ToString(); lblPrintHex.Text = statistics.Commands.PrintHex.ToString();
lblDecode.Text = statistics.Commands.Decode.ToString(); lblDecode.Text = statistics.Commands.Decode.ToString();
lblDeviceInfo.Text = statistics.Commands.DeviceInfo.ToString(); lblDeviceInfo.Text = statistics.Commands.DeviceInfo.ToString();
lblMediaInfo.Text = statistics.Commands.MediaInfo.ToString(); lblMediaInfo.Text = statistics.Commands.MediaInfo.ToString();
lblMediaScan.Text = statistics.Commands.MediaScan.ToString(); lblMediaScan.Text = statistics.Commands.MediaScan.ToString();
lblFormats.Text = statistics.Commands.Formats.ToString(); lblFormats.Text = statistics.Commands.Formats.ToString();
lblBenchmark.Text = statistics.Commands.Benchmark.ToString(); lblBenchmark.Text = statistics.Commands.Benchmark.ToString();
lblCreateSidecar.Text = statistics.Commands.CreateSidecar.ToString(); lblCreateSidecar.Text = statistics.Commands.CreateSidecar.ToString();
lblDumpMedia.Text = statistics.Commands.DumpMedia.ToString(); lblDumpMedia.Text = statistics.Commands.DumpMedia.ToString();
lblDeviceReport.Text = statistics.Commands.DeviceReport.ToString(); lblDeviceReport.Text = statistics.Commands.DeviceReport.ToString();
lblLs.Text = statistics.Commands.Ls.ToString(); lblLs.Text = statistics.Commands.Ls.ToString();
lblExtractFiles.Text = statistics.Commands.ExtractFiles.ToString(); lblExtractFiles.Text = statistics.Commands.ExtractFiles.ToString();
lblListDevices.Text = statistics.Commands.ListDevices.ToString(); lblListDevices.Text = statistics.Commands.ListDevices.ToString();
lblListEncodings.Text = statistics.Commands.ListEncodings.ToString(); lblListEncodings.Text = statistics.Commands.ListEncodings.ToString();
lblConvertImage.Text = statistics.Commands.ConvertImage.ToString(); lblConvertImage.Text = statistics.Commands.ConvertImage.ToString();
lblImageInfo.Text = statistics.Commands.ImageInfo.ToString();
} }
else divCommands.Visible = false; else divCommands.Visible = false;
@@ -170,16 +171,16 @@ namespace DiscImageChef.Server
if(statistics.Medias != null) if(statistics.Medias != null)
{ {
realMedia = new List<MediaItem>(); realMedia = new List<MediaItem>();
virtualMedia = new List<MediaItem>(); virtualMedia = new List<MediaItem>();
foreach(MediaStats nvs in statistics.Medias) foreach(MediaStats nvs in statistics.Medias)
{ {
MediaType MediaType
.MediaTypeToString((CommonTypes.MediaType)Enum.Parse(typeof(CommonTypes.MediaType), nvs.type), .MediaTypeToString((CommonTypes.MediaType)Enum.Parse(typeof(CommonTypes.MediaType), nvs.type),
out string type, out string subtype); out string type, out string subtype);
if(nvs.real) realMedia.Add(new MediaItem {Type = type, SubType = subtype, Count = nvs.Value}); if(nvs.real) realMedia.Add(new MediaItem {Type = type, SubType = subtype, Count = nvs.Value});
else virtualMedia.Add(new MediaItem {Type = type, SubType = subtype, Count = nvs.Value}); else virtualMedia.Add(new MediaItem {Type = type, SubType = subtype, Count = nvs.Value});
} }
if(realMedia.Count > 0) if(realMedia.Count > 0)
@@ -200,7 +201,7 @@ namespace DiscImageChef.Server
} }
else else
{ {
divRealMedia.Visible = false; divRealMedia.Visible = false;
divVirtualMedia.Visible = false; divVirtualMedia.Visible = false;
} }
@@ -212,29 +213,30 @@ namespace DiscImageChef.Server
string url; string url;
string xmlFile; string xmlFile;
if(!string.IsNullOrWhiteSpace(device.Manufacturer) && if(!string.IsNullOrWhiteSpace(device.Manufacturer) &&
!string.IsNullOrWhiteSpace(device.Model) && !string.IsNullOrWhiteSpace(device.Revision)) !string.IsNullOrWhiteSpace(device.Model) &&
!string.IsNullOrWhiteSpace(device.Revision))
{ {
xmlFile = device.Manufacturer + "_" + device.Model + "_" + device.Revision + ".xml"; xmlFile = device.Manufacturer + "_" + device.Model + "_" + device.Revision + ".xml";
url = url =
$"ViewReport.aspx?manufacturer={HttpUtility.UrlPathEncode(device.Manufacturer)}&model={HttpUtility.UrlPathEncode(device.Model)}&revision={HttpUtility.UrlPathEncode(device.Revision)}"; $"ViewReport.aspx?manufacturer={HttpUtility.UrlPathEncode(device.Manufacturer)}&model={HttpUtility.UrlPathEncode(device.Model)}&revision={HttpUtility.UrlPathEncode(device.Revision)}";
} }
else if(!string.IsNullOrWhiteSpace(device.Manufacturer) && else if(!string.IsNullOrWhiteSpace(device.Manufacturer) &&
!string.IsNullOrWhiteSpace(device.Model)) !string.IsNullOrWhiteSpace(device.Model))
{ {
xmlFile = device.Manufacturer + "_" + device.Model + ".xml"; xmlFile = device.Manufacturer + "_" + device.Model + ".xml";
url = url =
$"ViewReport.aspx?manufacturer={HttpUtility.UrlPathEncode(device.Manufacturer)}&model={HttpUtility.UrlPathEncode(device.Model)}"; $"ViewReport.aspx?manufacturer={HttpUtility.UrlPathEncode(device.Manufacturer)}&model={HttpUtility.UrlPathEncode(device.Model)}";
} }
else if(!string.IsNullOrWhiteSpace(device.Model) && !string.IsNullOrWhiteSpace(device.Revision)) else if(!string.IsNullOrWhiteSpace(device.Model) && !string.IsNullOrWhiteSpace(device.Revision))
{ {
xmlFile = device.Model + "_" + device.Revision + ".xml"; xmlFile = device.Model + "_" + device.Revision + ".xml";
url = url =
$"ViewReport.aspx?model={HttpUtility.UrlPathEncode(device.Model)}&revision={HttpUtility.UrlPathEncode(device.Revision)}"; $"ViewReport.aspx?model={HttpUtility.UrlPathEncode(device.Model)}&revision={HttpUtility.UrlPathEncode(device.Revision)}";
} }
else else
{ {
xmlFile = device.Model + ".xml"; xmlFile = device.Model + ".xml";
url = $"ViewReport.aspx?model={HttpUtility.UrlPathEncode(device.Model)}"; url = $"ViewReport.aspx?model={HttpUtility.UrlPathEncode(device.Model)}";
} }
xmlFile = xmlFile.Replace('/', '_').Replace('\\', '_').Replace('?', '_'); xmlFile = xmlFile.Replace('/', '_').Replace('\\', '_').Replace('?', '_');
@@ -244,10 +246,10 @@ namespace DiscImageChef.Server
devices.Add(new DeviceItem devices.Add(new DeviceItem
{ {
Manufacturer = device.Manufacturer, Manufacturer = device.Manufacturer,
Model = device.Model, Model = device.Model,
Revision = device.Revision, Revision = device.Revision,
Bus = device.Bus, Bus = device.Bus,
ReportLink = url == null ? "No" : $"<a href=\"{url}\" target=\"_blank\">Yes</a>" ReportLink = url == null ? "No" : $"<a href=\"{url}\" target=\"_blank\">Yes</a>"
}); });
} }
@@ -261,9 +263,9 @@ namespace DiscImageChef.Server
catch(Exception) catch(Exception)
{ {
content.InnerHtml = "<b>Could not load statistics</b>"; content.InnerHtml = "<b>Could not load statistics</b>";
#if DEBUG #if DEBUG
throw; throw;
#endif #endif
} }
} }
@@ -289,18 +291,18 @@ namespace DiscImageChef.Server
class MediaItem class MediaItem
{ {
public string Type { get; set; } public string Type { get; set; }
public string SubType { get; set; } public string SubType { get; set; }
public long Count { get; set; } public long Count { get; set; }
} }
class DeviceItem class DeviceItem
{ {
public string Manufacturer { get; set; } public string Manufacturer { get; set; }
public string Model { get; set; } public string Model { get; set; }
public string Revision { get; set; } public string Revision { get; set; }
public string Bus { get; set; } public string Bus { get; set; }
public string ReportLink { get; set; } public string ReportLink { get; set; }
} }
} }
} }

View File

@@ -56,7 +56,9 @@ namespace DiscImageChef.Server {
protected Label lblExtractFiles; protected Label lblExtractFiles;
protected Label lblFormats; protected Label lblFormats;
protected Label lblImageInfo;
protected Label lblListDevices; protected Label lblListDevices;

View File

@@ -51,6 +51,7 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Analyze command", "--input={0}", options.InputFile); DicConsole.DebugWriteLine("Analyze command", "--input={0}", options.InputFile);
DicConsole.DebugWriteLine("Analyze command", "--filesystems={0}", options.SearchForFilesystems); DicConsole.DebugWriteLine("Analyze command", "--filesystems={0}", options.SearchForFilesystems);
DicConsole.DebugWriteLine("Analyze command", "--partitions={0}", options.SearchForPartitions); DicConsole.DebugWriteLine("Analyze command", "--partitions={0}", options.SearchForPartitions);
DicConsole.DebugWriteLine("Analyze command", "--encoding={0}", options.EncodingName);
FiltersList filtersList = new FiltersList(); FiltersList filtersList = new FiltersList();
IFilter inputFilter = filtersList.GetFilter(options.InputFile); IFilter inputFilter = filtersList.GetFilter(options.InputFile);
@@ -93,6 +94,7 @@ namespace DiscImageChef.Commands
DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", imageFormat.Name, DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", imageFormat.Name,
imageFormat.Id); imageFormat.Id);
else DicConsole.WriteLine("Image format identified by {0}.", imageFormat.Name); else DicConsole.WriteLine("Image format identified by {0}.", imageFormat.Name);
DicConsole.WriteLine();
try try
{ {
@@ -103,12 +105,11 @@ namespace DiscImageChef.Commands
return; return;
} }
DicConsole.DebugWriteLine("Analyze command", "Correctly opened image file."); if(options.Verbose)
DicConsole.DebugWriteLine("Analyze command", "Image without headers is {0} bytes.", {
imageFormat.Info.ImageSize); Core.ImageInfo.PrintImageInfo(imageFormat);
DicConsole.DebugWriteLine("Analyze command", "Image has {0} sectors.", imageFormat.Info.Sectors); DicConsole.WriteLine();
DicConsole.DebugWriteLine("Analyze command", "Image identifies disk type as {0}.", }
imageFormat.Info.MediaType);
Core.Statistics.AddMediaFormat(imageFormat.Format); Core.Statistics.AddMediaFormat(imageFormat.Format);
Core.Statistics.AddMedia(imageFormat.Info.MediaType, false); Core.Statistics.AddMedia(imageFormat.Info.MediaType, false);

View File

@@ -44,15 +44,15 @@ namespace DiscImageChef.Commands
{ {
internal static void DoCompare(CompareOptions options) internal static void DoCompare(CompareOptions options)
{ {
DicConsole.DebugWriteLine("Compare command", "--debug={0}", options.Debug); DicConsole.DebugWriteLine("Compare command", "--debug={0}", options.Debug);
DicConsole.DebugWriteLine("Compare command", "--verbose={0}", options.Verbose); DicConsole.DebugWriteLine("Compare command", "--verbose={0}", options.Verbose);
DicConsole.DebugWriteLine("Compare command", "--input1={0}", options.InputFile1); DicConsole.DebugWriteLine("Compare command", "--input1={0}", options.InputFile1);
DicConsole.DebugWriteLine("Compare command", "--input2={0}", options.InputFile2); DicConsole.DebugWriteLine("Compare command", "--input2={0}", options.InputFile2);
FiltersList filtersList = new FiltersList(); FiltersList filtersList = new FiltersList();
IFilter inputFilter1 = filtersList.GetFilter(options.InputFile1); IFilter inputFilter1 = filtersList.GetFilter(options.InputFile1);
filtersList = new FiltersList(); filtersList = new FiltersList();
IFilter inputFilter2 = filtersList.GetFilter(options.InputFile2); IFilter inputFilter2 = filtersList.GetFilter(options.InputFile2);
if(inputFilter1 == null) if(inputFilter1 == null)
{ {
@@ -107,8 +107,8 @@ namespace DiscImageChef.Commands
{ {
sb.AppendLine("\tDisc image 1\tDisc image 2"); sb.AppendLine("\tDisc image 1\tDisc image 2");
sb.AppendLine("================================"); sb.AppendLine("================================");
sb.AppendFormat("File\t{0}\t{1}", options.InputFile1, options.InputFile2).AppendLine(); sb.AppendFormat("File\t{0}\t{1}", options.InputFile1, options.InputFile2).AppendLine();
sb.AppendFormat("Disc image format\t{0}\t{1}", input1Format.Name, input2Format.Name).AppendLine(); sb.AppendFormat("Disc image format\t{0}\t{1}", input1Format.Name, input2Format.Name).AppendLine();
} }
else else
{ {
@@ -118,45 +118,45 @@ namespace DiscImageChef.Commands
bool imagesDiffer = false; bool imagesDiffer = false;
ImageInfo image1Info = new ImageInfo(); DiscImages.ImageInfo image1Info = new DiscImages.ImageInfo();
ImageInfo image2Info = new ImageInfo(); DiscImages.ImageInfo image2Info = new DiscImages.ImageInfo();
List<Session> image1Sessions = new List<Session>(); List<Session> image1Sessions = new List<Session>();
List<Session> image2Sessions = new List<Session>(); List<Session> image2Sessions = new List<Session>();
Dictionary<MediaTagType, byte[]> image1DiskTags = new Dictionary<MediaTagType, byte[]>(); Dictionary<MediaTagType, byte[]> image1DiskTags = new Dictionary<MediaTagType, byte[]>();
Dictionary<MediaTagType, byte[]> image2DiskTags = new Dictionary<MediaTagType, byte[]>(); Dictionary<MediaTagType, byte[]> image2DiskTags = new Dictionary<MediaTagType, byte[]>();
image1Info.HasPartitions = input1Format.Info.HasPartitions; image1Info.HasPartitions = input1Format.Info.HasPartitions;
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
try { image1Sessions = input1Format.Sessions; } try { image1Sessions = input1Format.Sessions; }
catch catch
{ {
// ignored // ignored
} }
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
image1Info.HasSessions |= image1Sessions.Count > 0; image1Info.HasSessions |= image1Sessions.Count > 0;
image1Info.ImageSize = input1Format.Info.ImageSize; image1Info.ImageSize = input1Format.Info.ImageSize;
image1Info.Sectors = input1Format.Info.Sectors; image1Info.Sectors = input1Format.Info.Sectors;
image1Info.SectorSize = input1Format.Info.SectorSize; image1Info.SectorSize = input1Format.Info.SectorSize;
image1Info.CreationTime = input1Format.Info.CreationTime; image1Info.CreationTime = input1Format.Info.CreationTime;
image1Info.LastModificationTime = input1Format.Info.LastModificationTime; image1Info.LastModificationTime = input1Format.Info.LastModificationTime;
image1Info.MediaType = input1Format.Info.MediaType; image1Info.MediaType = input1Format.Info.MediaType;
image1Info.Version = input1Format.Info.Version; image1Info.Version = input1Format.Info.Version;
image1Info.Application = input1Format.Info.Application; image1Info.Application = input1Format.Info.Application;
image1Info.ApplicationVersion = input1Format.Info.ApplicationVersion; image1Info.ApplicationVersion = input1Format.Info.ApplicationVersion;
image1Info.Creator = input1Format.Info.Creator; image1Info.Creator = input1Format.Info.Creator;
image1Info.MediaTitle = input1Format.Info.MediaTitle; image1Info.MediaTitle = input1Format.Info.MediaTitle;
image1Info.Comments = input1Format.Info.Comments; image1Info.Comments = input1Format.Info.Comments;
image1Info.MediaManufacturer = input1Format.Info.MediaManufacturer; image1Info.MediaManufacturer = input1Format.Info.MediaManufacturer;
image1Info.MediaModel = input1Format.Info.MediaModel; image1Info.MediaModel = input1Format.Info.MediaModel;
image1Info.MediaSerialNumber = input1Format.Info.MediaSerialNumber; image1Info.MediaSerialNumber = input1Format.Info.MediaSerialNumber;
image1Info.MediaBarcode = input1Format.Info.MediaBarcode; image1Info.MediaBarcode = input1Format.Info.MediaBarcode;
image1Info.MediaPartNumber = input1Format.Info.MediaPartNumber; image1Info.MediaPartNumber = input1Format.Info.MediaPartNumber;
image1Info.MediaSequence = input1Format.Info.MediaSequence; image1Info.MediaSequence = input1Format.Info.MediaSequence;
image1Info.LastMediaSequence = input1Format.Info.LastMediaSequence; image1Info.LastMediaSequence = input1Format.Info.LastMediaSequence;
image1Info.DriveManufacturer = input1Format.Info.DriveManufacturer; image1Info.DriveManufacturer = input1Format.Info.DriveManufacturer;
image1Info.DriveModel = input1Format.Info.DriveModel; image1Info.DriveModel = input1Format.Info.DriveModel;
image1Info.DriveSerialNumber = input1Format.Info.DriveSerialNumber; image1Info.DriveSerialNumber = input1Format.Info.DriveSerialNumber;
image1Info.DriveFirmwareRevision = input1Format.Info.DriveFirmwareRevision; image1Info.DriveFirmwareRevision = input1Format.Info.DriveFirmwareRevision;
foreach(MediaTagType disktag in Enum.GetValues(typeof(MediaTagType))) foreach(MediaTagType disktag in Enum.GetValues(typeof(MediaTagType)))
{ {
try try
@@ -164,46 +164,46 @@ namespace DiscImageChef.Commands
byte[] temparray = input1Format.ReadDiskTag(disktag); byte[] temparray = input1Format.ReadDiskTag(disktag);
image1DiskTags.Add(disktag, temparray); image1DiskTags.Add(disktag, temparray);
} }
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
catch catch
{ {
// ignored // ignored
} }
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
} }
image2Info.HasPartitions = input2Format.Info.HasPartitions; image2Info.HasPartitions = input2Format.Info.HasPartitions;
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
try { image2Sessions = input2Format.Sessions; } try { image2Sessions = input2Format.Sessions; }
catch catch
{ {
// ignored // ignored
} }
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
image2Info.HasSessions |= image2Sessions.Count > 0; image2Info.HasSessions |= image2Sessions.Count > 0;
image2Info.ImageSize = input2Format.Info.ImageSize; image2Info.ImageSize = input2Format.Info.ImageSize;
image2Info.Sectors = input2Format.Info.Sectors; image2Info.Sectors = input2Format.Info.Sectors;
image2Info.SectorSize = input2Format.Info.SectorSize; image2Info.SectorSize = input2Format.Info.SectorSize;
image2Info.CreationTime = input2Format.Info.CreationTime; image2Info.CreationTime = input2Format.Info.CreationTime;
image2Info.LastModificationTime = input2Format.Info.LastModificationTime; image2Info.LastModificationTime = input2Format.Info.LastModificationTime;
image2Info.MediaType = input2Format.Info.MediaType; image2Info.MediaType = input2Format.Info.MediaType;
image2Info.Version = input2Format.Info.Version; image2Info.Version = input2Format.Info.Version;
image2Info.Application = input2Format.Info.Application; image2Info.Application = input2Format.Info.Application;
image2Info.ApplicationVersion = input2Format.Info.ApplicationVersion; image2Info.ApplicationVersion = input2Format.Info.ApplicationVersion;
image2Info.Creator = input2Format.Info.Creator; image2Info.Creator = input2Format.Info.Creator;
image2Info.MediaTitle = input2Format.Info.MediaTitle; image2Info.MediaTitle = input2Format.Info.MediaTitle;
image2Info.Comments = input2Format.Info.Comments; image2Info.Comments = input2Format.Info.Comments;
image2Info.MediaManufacturer = input2Format.Info.MediaManufacturer; image2Info.MediaManufacturer = input2Format.Info.MediaManufacturer;
image2Info.MediaModel = input2Format.Info.MediaModel; image2Info.MediaModel = input2Format.Info.MediaModel;
image2Info.MediaSerialNumber = input2Format.Info.MediaSerialNumber; image2Info.MediaSerialNumber = input2Format.Info.MediaSerialNumber;
image2Info.MediaBarcode = input2Format.Info.MediaBarcode; image2Info.MediaBarcode = input2Format.Info.MediaBarcode;
image2Info.MediaPartNumber = input2Format.Info.MediaPartNumber; image2Info.MediaPartNumber = input2Format.Info.MediaPartNumber;
image2Info.MediaSequence = input2Format.Info.MediaSequence; image2Info.MediaSequence = input2Format.Info.MediaSequence;
image2Info.LastMediaSequence = input2Format.Info.LastMediaSequence; image2Info.LastMediaSequence = input2Format.Info.LastMediaSequence;
image2Info.DriveManufacturer = input2Format.Info.DriveManufacturer; image2Info.DriveManufacturer = input2Format.Info.DriveManufacturer;
image2Info.DriveModel = input2Format.Info.DriveModel; image2Info.DriveModel = input2Format.Info.DriveModel;
image2Info.DriveSerialNumber = input2Format.Info.DriveSerialNumber; image2Info.DriveSerialNumber = input2Format.Info.DriveSerialNumber;
image2Info.DriveFirmwareRevision = input2Format.Info.DriveFirmwareRevision; image2Info.DriveFirmwareRevision = input2Format.Info.DriveFirmwareRevision;
foreach(MediaTagType disktag in Enum.GetValues(typeof(MediaTagType))) foreach(MediaTagType disktag in Enum.GetValues(typeof(MediaTagType)))
{ {
try try
@@ -211,39 +211,37 @@ namespace DiscImageChef.Commands
byte[] temparray = input2Format.ReadDiskTag(disktag); byte[] temparray = input2Format.ReadDiskTag(disktag);
image2DiskTags.Add(disktag, temparray); image2DiskTags.Add(disktag, temparray);
} }
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
catch catch
{ {
// ignored // ignored
} }
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
} }
if(options.Verbose) if(options.Verbose)
{ {
sb.AppendFormat("Has partitions?\t{0}\t{1}", image1Info.HasPartitions, sb.AppendFormat("Has partitions?\t{0}\t{1}", image1Info.HasPartitions, image2Info.HasPartitions)
image2Info.HasPartitions).AppendLine(); .AppendLine();
sb.AppendFormat("Has sessions?\t{0}\t{1}", image1Info.HasSessions, image2Info.HasSessions) sb.AppendFormat("Has sessions?\t{0}\t{1}", image1Info.HasSessions, image2Info.HasSessions)
.AppendLine(); .AppendLine();
sb.AppendFormat("Image size\t{0}\t{1}", image1Info.ImageSize, image2Info.ImageSize).AppendLine(); sb.AppendFormat("Image size\t{0}\t{1}", image1Info.ImageSize, image2Info.ImageSize).AppendLine();
sb.AppendFormat("Sectors\t{0}\t{1}", image1Info.Sectors, image2Info.Sectors).AppendLine(); sb.AppendFormat("Sectors\t{0}\t{1}", image1Info.Sectors, image2Info.Sectors).AppendLine();
sb.AppendFormat("Sector size\t{0}\t{1}", image1Info.SectorSize, image2Info.SectorSize).AppendLine(); sb.AppendFormat("Sector size\t{0}\t{1}", image1Info.SectorSize, image2Info.SectorSize).AppendLine();
sb.AppendFormat("Creation time\t{0}\t{1}", image1Info.CreationTime, image2Info.CreationTime) sb.AppendFormat("Creation time\t{0}\t{1}", image1Info.CreationTime, image2Info.CreationTime)
.AppendLine(); .AppendLine();
sb.AppendFormat("Last modification time\t{0}\t{1}", image1Info.LastModificationTime, sb.AppendFormat("Last modification time\t{0}\t{1}", image1Info.LastModificationTime,
image2Info.LastModificationTime).AppendLine(); image2Info.LastModificationTime).AppendLine();
sb.AppendFormat("Disk type\t{0}\t{1}", image1Info.MediaType, image2Info.MediaType).AppendLine(); sb.AppendFormat("Disk type\t{0}\t{1}", image1Info.MediaType, image2Info.MediaType)
sb.AppendFormat("Image version\t{0}\t{1}", image1Info.Version, image2Info.Version)
.AppendLine(); .AppendLine();
sb.AppendFormat("Image version\t{0}\t{1}", image1Info.Version, image2Info.Version).AppendLine();
sb.AppendFormat("Image application\t{0}\t{1}", image1Info.Application, image2Info.Application) sb.AppendFormat("Image application\t{0}\t{1}", image1Info.Application, image2Info.Application)
.AppendLine(); .AppendLine();
sb.AppendFormat("Image application version\t{0}\t{1}", image1Info.ApplicationVersion, sb.AppendFormat("Image application version\t{0}\t{1}", image1Info.ApplicationVersion,
image2Info.ApplicationVersion).AppendLine(); image2Info.ApplicationVersion).AppendLine();
sb.AppendFormat("Image creator\t{0}\t{1}", image1Info.Creator, image2Info.Creator) sb.AppendFormat("Image creator\t{0}\t{1}", image1Info.Creator, image2Info.Creator).AppendLine();
.AppendLine(); sb.AppendFormat("Image name\t{0}\t{1}", image1Info.MediaTitle, image2Info.MediaTitle).AppendLine();
sb.AppendFormat("Image name\t{0}\t{1}", image1Info.MediaTitle, image2Info.MediaTitle).AppendLine(); sb.AppendFormat("Image comments\t{0}\t{1}", image1Info.Comments, image2Info.Comments).AppendLine();
sb.AppendFormat("Image comments\t{0}\t{1}", image1Info.Comments, image2Info.Comments)
.AppendLine();
sb.AppendFormat("Disk manufacturer\t{0}\t{1}", image1Info.MediaManufacturer, sb.AppendFormat("Disk manufacturer\t{0}\t{1}", image1Info.MediaManufacturer,
image2Info.MediaManufacturer).AppendLine(); image2Info.MediaManufacturer).AppendLine();
sb.AppendFormat("Disk model\t{0}\t{1}", image1Info.MediaModel, image2Info.MediaModel).AppendLine(); sb.AppendFormat("Disk model\t{0}\t{1}", image1Info.MediaModel, image2Info.MediaModel).AppendLine();
@@ -276,121 +274,145 @@ namespace DiscImageChef.Commands
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Image partitioned status differ"); if(!options.Verbose) sb.AppendLine("Image partitioned status differ");
} }
if(image1Info.HasSessions != image2Info.HasSessions) if(image1Info.HasSessions != image2Info.HasSessions)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Image session status differ"); if(!options.Verbose) sb.AppendLine("Image session status differ");
} }
if(image1Info.ImageSize != image2Info.ImageSize) if(image1Info.ImageSize != image2Info.ImageSize)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Image size differ"); if(!options.Verbose) sb.AppendLine("Image size differ");
} }
if(image1Info.Sectors != image2Info.Sectors) if(image1Info.Sectors != image2Info.Sectors)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Image sectors differ"); if(!options.Verbose) sb.AppendLine("Image sectors differ");
} }
if(image1Info.SectorSize != image2Info.SectorSize) if(image1Info.SectorSize != image2Info.SectorSize)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Image sector size differ"); if(!options.Verbose) sb.AppendLine("Image sector size differ");
} }
if(image1Info.CreationTime != image2Info.CreationTime) if(image1Info.CreationTime != image2Info.CreationTime)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Image creation time differ"); if(!options.Verbose) sb.AppendLine("Image creation time differ");
} }
if(image1Info.LastModificationTime != image2Info.LastModificationTime) if(image1Info.LastModificationTime != image2Info.LastModificationTime)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Image last modification time differ"); if(!options.Verbose) sb.AppendLine("Image last modification time differ");
} }
if(image1Info.MediaType != image2Info.MediaType) if(image1Info.MediaType != image2Info.MediaType)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Disk type differ"); if(!options.Verbose) sb.AppendLine("Disk type differ");
} }
if(image1Info.Version != image2Info.Version) if(image1Info.Version != image2Info.Version)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Image version differ"); if(!options.Verbose) sb.AppendLine("Image version differ");
} }
if(image1Info.Application != image2Info.Application) if(image1Info.Application != image2Info.Application)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Image application differ"); if(!options.Verbose) sb.AppendLine("Image application differ");
} }
if(image1Info.ApplicationVersion != image2Info.ApplicationVersion) if(image1Info.ApplicationVersion != image2Info.ApplicationVersion)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Image application version differ"); if(!options.Verbose) sb.AppendLine("Image application version differ");
} }
if(image1Info.Creator != image2Info.Creator) if(image1Info.Creator != image2Info.Creator)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Image creator differ"); if(!options.Verbose) sb.AppendLine("Image creator differ");
} }
if(image1Info.MediaTitle != image2Info.MediaTitle) if(image1Info.MediaTitle != image2Info.MediaTitle)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Image name differ"); if(!options.Verbose) sb.AppendLine("Image name differ");
} }
if(image1Info.Comments != image2Info.Comments) if(image1Info.Comments != image2Info.Comments)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Image comments differ"); if(!options.Verbose) sb.AppendLine("Image comments differ");
} }
if(image1Info.MediaManufacturer != image2Info.MediaManufacturer) if(image1Info.MediaManufacturer != image2Info.MediaManufacturer)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Disk manufacturer differ"); if(!options.Verbose) sb.AppendLine("Disk manufacturer differ");
} }
if(image1Info.MediaModel != image2Info.MediaModel) if(image1Info.MediaModel != image2Info.MediaModel)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Disk model differ"); if(!options.Verbose) sb.AppendLine("Disk model differ");
} }
if(image1Info.MediaSerialNumber != image2Info.MediaSerialNumber) if(image1Info.MediaSerialNumber != image2Info.MediaSerialNumber)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Disk serial number differ"); if(!options.Verbose) sb.AppendLine("Disk serial number differ");
} }
if(image1Info.MediaBarcode != image2Info.MediaBarcode) if(image1Info.MediaBarcode != image2Info.MediaBarcode)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Disk barcode differ"); if(!options.Verbose) sb.AppendLine("Disk barcode differ");
} }
if(image1Info.MediaPartNumber != image2Info.MediaPartNumber) if(image1Info.MediaPartNumber != image2Info.MediaPartNumber)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Disk part number differ"); if(!options.Verbose) sb.AppendLine("Disk part number differ");
} }
if(image1Info.MediaSequence != image2Info.MediaSequence) if(image1Info.MediaSequence != image2Info.MediaSequence)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Disk sequence differ"); if(!options.Verbose) sb.AppendLine("Disk sequence differ");
} }
if(image1Info.LastMediaSequence != image2Info.LastMediaSequence) if(image1Info.LastMediaSequence != image2Info.LastMediaSequence)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Last disk in sequence differ"); if(!options.Verbose) sb.AppendLine("Last disk in sequence differ");
} }
if(image1Info.DriveManufacturer != image2Info.DriveManufacturer) if(image1Info.DriveManufacturer != image2Info.DriveManufacturer)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Drive manufacturer differ"); if(!options.Verbose) sb.AppendLine("Drive manufacturer differ");
} }
if(image1Info.DriveModel != image2Info.DriveModel) if(image1Info.DriveModel != image2Info.DriveModel)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Drive model differ"); if(!options.Verbose) sb.AppendLine("Drive model differ");
} }
if(image1Info.DriveSerialNumber != image2Info.DriveSerialNumber) if(image1Info.DriveSerialNumber != image2Info.DriveSerialNumber)
{ {
imagesDiffer = true; imagesDiffer = true;
if(!options.Verbose) sb.AppendLine("Drive serial number differ"); if(!options.Verbose) sb.AppendLine("Drive serial number differ");
} }
if(image1Info.DriveFirmwareRevision != image2Info.DriveFirmwareRevision) if(image1Info.DriveFirmwareRevision != image2Info.DriveFirmwareRevision)
{ {
imagesDiffer = true; imagesDiffer = true;
@@ -410,7 +432,8 @@ namespace DiscImageChef.Commands
leastSectors = image2Info.Sectors; leastSectors = image2Info.Sectors;
if(!options.Verbose) sb.AppendLine("Image 1 has more sectors"); if(!options.Verbose) sb.AppendLine("Image 1 has more sectors");
} }
else leastSectors = image1Info.Sectors; else
leastSectors = image1Info.Sectors;
DicConsole.WriteLine("Comparing sectors..."); DicConsole.WriteLine("Comparing sectors...");
@@ -431,16 +454,16 @@ namespace DiscImageChef.Commands
{ {
imagesDiffer = true; imagesDiffer = true;
sb sb
.AppendFormat("Sector {0} has different sizes ({1} bytes in image 1, {2} in image 2) but are otherwise identical", .AppendFormat("Sector {0} has different sizes ({1} bytes in image 1, {2} in image 2) but are otherwise identical",
sector, image1Sector.LongLength, image2Sector.LongLength).AppendLine(); sector, image1Sector.LongLength, image2Sector.LongLength).AppendLine();
} }
} }
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
catch catch
{ {
// ignored // ignored
} }
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
} }
DicConsole.WriteLine(); DicConsole.WriteLine();

View File

@@ -67,11 +67,11 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Analyze command", "--drive-model={0}", options.DriveModel); DicConsole.DebugWriteLine("Analyze command", "--drive-model={0}", options.DriveModel);
DicConsole.DebugWriteLine("Analyze command", "--drive-serial={0}", options.DriveSerialNumber); DicConsole.DebugWriteLine("Analyze command", "--drive-serial={0}", options.DriveSerialNumber);
DicConsole.DebugWriteLine("Analyze command", "--drive-revision={0}", options.DriveFirmwareRevision); DicConsole.DebugWriteLine("Analyze command", "--drive-revision={0}", options.DriveFirmwareRevision);
DicConsole.DebugWriteLine("Analyze command", "--options={0}", options.Options); DicConsole.DebugWriteLine("Analyze command", "--options={0}", options.Options);
Dictionary<string, string> parsedOptions = Options.Parse(options.Options); Dictionary<string, string> parsedOptions = Options.Parse(options.Options);
DicConsole.DebugWriteLine("Analyze command", "Parsed options:"); DicConsole.DebugWriteLine("Analyze command", "Parsed options:");
foreach(KeyValuePair<string,string> parsedOption in parsedOptions) foreach(KeyValuePair<string, string> parsedOption in parsedOptions)
DicConsole.DebugWriteLine("Analyze command", "{0} = {1}", parsedOption.Key, parsedOption.Value); DicConsole.DebugWriteLine("Analyze command", "{0} = {1}", parsedOption.Key, parsedOption.Value);
if(options.Count == 0) if(options.Count == 0)
@@ -212,7 +212,7 @@ namespace DiscImageChef.Commands
return; return;
} }
ImageInfo metadata = new ImageInfo DiscImages.ImageInfo metadata = new DiscImages.ImageInfo
{ {
Application = "DiscImageChef", Application = "DiscImageChef",
ApplicationVersion = Version.GetVersion(), ApplicationVersion = Version.GetVersion(),

View File

@@ -47,9 +47,9 @@ namespace DiscImageChef.Commands
{ {
internal static void DoDeviceInfo(DeviceInfoOptions options) internal static void DoDeviceInfo(DeviceInfoOptions options)
{ {
DicConsole.DebugWriteLine("Device-Info command", "--debug={0}", options.Debug); DicConsole.DebugWriteLine("Device-Info command", "--debug={0}", options.Debug);
DicConsole.DebugWriteLine("Device-Info command", "--verbose={0}", options.Verbose); DicConsole.DebugWriteLine("Device-Info command", "--verbose={0}", options.Verbose);
DicConsole.DebugWriteLine("Device-Info command", "--device={0}", options.DevicePath); DicConsole.DebugWriteLine("Device-Info command", "--device={0}", options.DevicePath);
DicConsole.DebugWriteLine("Device-Info command", "--output-prefix={0}", options.OutputPrefix); DicConsole.DebugWriteLine("Device-Info command", "--output-prefix={0}", options.OutputPrefix);
if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && options.DevicePath[0] != '/' && if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && options.DevicePath[0] != '/' &&
@@ -71,11 +71,11 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("USB device"); DicConsole.WriteLine("USB device");
if(dev.UsbDescriptors != null) if(dev.UsbDescriptors != null)
DicConsole.WriteLine("USB descriptor is {0} bytes", dev.UsbDescriptors.Length); DicConsole.WriteLine("USB descriptor is {0} bytes", dev.UsbDescriptors.Length);
DicConsole.WriteLine("USB Vendor ID: {0:X4}", dev.UsbVendorId); DicConsole.WriteLine("USB Vendor ID: {0:X4}", dev.UsbVendorId);
DicConsole.WriteLine("USB Product ID: {0:X4}", dev.UsbProductId); DicConsole.WriteLine("USB Product ID: {0:X4}", dev.UsbProductId);
DicConsole.WriteLine("USB Manufacturer: {0}", dev.UsbManufacturerString); DicConsole.WriteLine("USB Manufacturer: {0}", dev.UsbManufacturerString);
DicConsole.WriteLine("USB Product: {0}", dev.UsbProductString); DicConsole.WriteLine("USB Product: {0}", dev.UsbProductString);
DicConsole.WriteLine("USB Serial number: {0}", dev.UsbSerialString); DicConsole.WriteLine("USB Serial number: {0}", dev.UsbSerialString);
DicConsole.WriteLine(); DicConsole.WriteLine();
} }
@@ -83,10 +83,10 @@ namespace DiscImageChef.Commands
{ {
DicConsole.WriteLine("FireWire device"); DicConsole.WriteLine("FireWire device");
DicConsole.WriteLine("FireWire Vendor ID: {0:X6}", dev.FireWireVendor); DicConsole.WriteLine("FireWire Vendor ID: {0:X6}", dev.FireWireVendor);
DicConsole.WriteLine("FireWire Model ID: {0:X6}", dev.FireWireModel); DicConsole.WriteLine("FireWire Model ID: {0:X6}", dev.FireWireModel);
DicConsole.WriteLine("FireWire Manufacturer: {0}", dev.FireWireVendorName); DicConsole.WriteLine("FireWire Manufacturer: {0}", dev.FireWireVendorName);
DicConsole.WriteLine("FireWire Model: {0}", dev.FireWireModelName); DicConsole.WriteLine("FireWire Model: {0}", dev.FireWireModelName);
DicConsole.WriteLine("FireWire GUID: {0:X16}", dev.FireWireGuid); DicConsole.WriteLine("FireWire GUID: {0:X16}", dev.FireWireGuid);
DicConsole.WriteLine(); DicConsole.WriteLine();
} }
@@ -165,7 +165,7 @@ namespace DiscImageChef.Commands
if(sense) if(sense)
{ {
DicConsole.DebugWriteLine("Device-Info command", "STATUS = 0x{0:X2}", errorRegisters.Status); DicConsole.DebugWriteLine("Device-Info command", "STATUS = 0x{0:X2}", errorRegisters.Status);
DicConsole.DebugWriteLine("Device-Info command", "ERROR = 0x{0:X2}", errorRegisters.Error); DicConsole.DebugWriteLine("Device-Info command", "ERROR = 0x{0:X2}", errorRegisters.Error);
DicConsole.DebugWriteLine("Device-Info command", "NSECTOR = 0x{0:X2}", DicConsole.DebugWriteLine("Device-Info command", "NSECTOR = 0x{0:X2}",
errorRegisters.SectorCount); errorRegisters.SectorCount);
DicConsole.DebugWriteLine("Device-Info command", "SECTOR = 0x{0:X2}", errorRegisters.Sector); DicConsole.DebugWriteLine("Device-Info command", "SECTOR = 0x{0:X2}", errorRegisters.Sector);
@@ -229,7 +229,7 @@ namespace DiscImageChef.Commands
if(sense) if(sense)
{ {
DicConsole.DebugWriteLine("Device-Info command", "STATUS = 0x{0:X2}", errorRegisters.Status); DicConsole.DebugWriteLine("Device-Info command", "STATUS = 0x{0:X2}", errorRegisters.Status);
DicConsole.DebugWriteLine("Device-Info command", "ERROR = 0x{0:X2}", errorRegisters.Error); DicConsole.DebugWriteLine("Device-Info command", "ERROR = 0x{0:X2}", errorRegisters.Error);
DicConsole.DebugWriteLine("Device-Info command", "NSECTOR = 0x{0:X2}", DicConsole.DebugWriteLine("Device-Info command", "NSECTOR = 0x{0:X2}",
errorRegisters.SectorCount); errorRegisters.SectorCount);
DicConsole.DebugWriteLine("Device-Info command", "SECTOR = 0x{0:X2}", errorRegisters.Sector); DicConsole.DebugWriteLine("Device-Info command", "SECTOR = 0x{0:X2}", errorRegisters.Sector);
@@ -426,7 +426,7 @@ namespace DiscImageChef.Commands
} }
else if(page == 0xC0 && else if(page == 0xC0 &&
StringHandlers StringHandlers
.CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == .CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() ==
"quantum") "quantum")
{ {
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);
@@ -439,7 +439,7 @@ namespace DiscImageChef.Commands
} }
else if(page == 0xC0 && else if(page == 0xC0 &&
StringHandlers StringHandlers
.CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == .CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() ==
"seagate") "seagate")
{ {
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);
@@ -452,7 +452,7 @@ namespace DiscImageChef.Commands
} }
else if(page == 0xC0 && else if(page == 0xC0 &&
StringHandlers StringHandlers
.CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == .CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() ==
"ibm") "ibm")
{ {
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);
@@ -465,7 +465,7 @@ namespace DiscImageChef.Commands
} }
else if(page == 0xC1 && else if(page == 0xC1 &&
StringHandlers StringHandlers
.CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == .CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() ==
"ibm") "ibm")
{ {
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);
@@ -478,7 +478,7 @@ namespace DiscImageChef.Commands
} }
else if((page == 0xC0 || page == 0xC1) && else if((page == 0xC0 || page == 0xC1) &&
StringHandlers StringHandlers
.CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == .CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() ==
"certance") "certance")
{ {
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);
@@ -489,10 +489,11 @@ namespace DiscImageChef.Commands
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf); inqBuf);
} }
else if( else if((page == 0xC2 || page == 0xC3 || page == 0xC4 || page == 0xC5 ||
(page == 0xC2 || page == 0xC3 || page == 0xC4 || page == 0xC5 || page == 0xC6) && page == 0xC6) &&
StringHandlers.CToString(inq.Value.VendorIdentification).ToLowerInvariant() StringHandlers
.Trim() == "certance") .CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() ==
"certance")
{ {
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);
if(sense) continue; if(sense) continue;
@@ -505,8 +506,7 @@ namespace DiscImageChef.Commands
else if((page == 0xC0 || page == 0xC1 || page == 0xC2 || page == 0xC3 || page == 0xC4 || else if((page == 0xC0 || page == 0xC1 || page == 0xC2 || page == 0xC3 || page == 0xC4 ||
page == 0xC5) && page == 0xC5) &&
StringHandlers StringHandlers
.CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == .CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == "hp")
"hp")
{ {
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);
if(sense) continue; if(sense) continue;
@@ -518,7 +518,7 @@ namespace DiscImageChef.Commands
} }
else if(page == 0xDF && else if(page == 0xDF &&
StringHandlers StringHandlers
.CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == .CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() ==
"certance") "certance")
{ {
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);
@@ -544,7 +544,7 @@ namespace DiscImageChef.Commands
} }
} }
Modes.DecodedMode? decMode = null; Modes.DecodedMode? decMode = null;
PeripheralDeviceTypes devType = (PeripheralDeviceTypes)inq.Value.PeripheralDeviceType; PeripheralDeviceTypes devType = (PeripheralDeviceTypes)inq.Value.PeripheralDeviceType;
sense = dev.ModeSense10(out byte[] modeBuf, out senseBuf, false, true, sense = dev.ModeSense10(out byte[] modeBuf, out senseBuf, false, true,
@@ -572,300 +572,7 @@ namespace DiscImageChef.Commands
"SCSI MODE SENSE", modeBuf); "SCSI MODE SENSE", modeBuf);
if(decMode.HasValue) if(decMode.HasValue)
{ PrintScsiModePages.Print(decMode.Value, devType, inq.Value.VendorIdentification);
DicConsole.WriteLine(Modes.PrettifyModeHeader(decMode.Value.Header, devType));
if(decMode.Value.Pages != null)
foreach(Modes.ModePage page in decMode.Value.Pages)
//DicConsole.WriteLine("Page {0:X2}h subpage {1:X2}h is {2} bytes long", page.Page, page.Subpage, page.PageResponse.Length);
switch(page.Page)
{
case 0x00:
{
if(devType == PeripheralDeviceTypes.MultiMediaDevice && page.Subpage == 0)
DicConsole.WriteLine(Modes.PrettifyModePage_00_SFF(page.PageResponse));
else
{
if(page.Subpage != 0)
DicConsole
.WriteLine("Found unknown vendor mode page {0:X2}h subpage {1:X2}h",
page.Page, page.Subpage);
else
DicConsole.WriteLine("Found unknown vendor mode page {0:X2}h",
page.Page);
}
break;
}
case 0x01:
{
if(page.Subpage == 0)
if(devType == PeripheralDeviceTypes.MultiMediaDevice)
DicConsole.WriteLine(Modes.PrettifyModePage_01_MMC(page.PageResponse));
else DicConsole.WriteLine(Modes.PrettifyModePage_01(page.PageResponse));
else goto default;
break;
}
case 0x02:
{
if(page.Subpage == 0)
DicConsole.WriteLine(Modes.PrettifyModePage_02(page.PageResponse));
else goto default;
break;
}
case 0x03:
{
if(page.Subpage == 0)
DicConsole.WriteLine(Modes.PrettifyModePage_03(page.PageResponse));
else goto default;
break;
}
case 0x04:
{
if(page.Subpage == 0)
DicConsole.WriteLine(Modes.PrettifyModePage_04(page.PageResponse));
else goto default;
break;
}
case 0x05:
{
if(page.Subpage == 0)
DicConsole.WriteLine(Modes.PrettifyModePage_05(page.PageResponse));
else goto default;
break;
}
case 0x06:
{
if(page.Subpage == 0)
DicConsole.WriteLine(Modes.PrettifyModePage_06(page.PageResponse));
else goto default;
break;
}
case 0x07:
{
if(page.Subpage == 0)
if(devType == PeripheralDeviceTypes.MultiMediaDevice)
DicConsole.WriteLine(Modes.PrettifyModePage_07_MMC(page.PageResponse));
else DicConsole.WriteLine(Modes.PrettifyModePage_07(page.PageResponse));
else goto default;
break;
}
case 0x08:
{
if(page.Subpage == 0)
DicConsole.WriteLine(Modes.PrettifyModePage_08(page.PageResponse));
else goto default;
break;
}
case 0x0A:
{
if(page.Subpage == 0)
DicConsole.WriteLine(Modes.PrettifyModePage_0A(page.PageResponse));
else if(page.Subpage == 1)
DicConsole.WriteLine(Modes.PrettifyModePage_0A_S01(page.PageResponse));
else goto default;
break;
}
case 0x0B:
{
if(page.Subpage == 0)
DicConsole.WriteLine(Modes.PrettifyModePage_0B(page.PageResponse));
else goto default;
break;
}
case 0x0D:
{
if(page.Subpage == 0)
DicConsole.WriteLine(Modes.PrettifyModePage_0D(page.PageResponse));
else goto default;
break;
}
case 0x0E:
{
if(page.Subpage == 0)
DicConsole.WriteLine(Modes.PrettifyModePage_0E(page.PageResponse));
else goto default;
break;
}
case 0x0F:
{
if(page.Subpage == 0)
DicConsole.WriteLine(Modes.PrettifyModePage_0F(page.PageResponse));
else goto default;
break;
}
case 0x10:
{
if(page.Subpage == 0)
if(devType == PeripheralDeviceTypes.SequentialAccess)
DicConsole.WriteLine(Modes.PrettifyModePage_10_SSC(page.PageResponse));
else DicConsole.WriteLine(Modes.PrettifyModePage_10(page.PageResponse));
else goto default;
break;
}
case 0x11:
{
if(page.Subpage == 0)
DicConsole.WriteLine(Modes.PrettifyModePage_11(page.PageResponse));
else goto default;
break;
}
case 0x12:
case 0x13:
case 0x14:
{
if(page.Subpage == 0)
DicConsole.WriteLine(Modes.PrettifyModePage_12_13_14(page.PageResponse));
else goto default;
break;
}
case 0x1A:
{
if(page.Subpage == 0)
DicConsole.WriteLine(Modes.PrettifyModePage_1A(page.PageResponse));
else if(page.Subpage == 1)
DicConsole.WriteLine(Modes.PrettifyModePage_1A_S01(page.PageResponse));
else goto default;
break;
}
case 0x1B:
{
if(page.Subpage == 0)
DicConsole.WriteLine(Modes.PrettifyModePage_1B(page.PageResponse));
else goto default;
break;
}
case 0x1C:
{
if(page.Subpage == 0)
if(devType == PeripheralDeviceTypes.MultiMediaDevice)
DicConsole.WriteLine(Modes.PrettifyModePage_1C_SFF(page.PageResponse));
else DicConsole.WriteLine(Modes.PrettifyModePage_1C(page.PageResponse));
else if(page.Subpage == 1)
DicConsole.WriteLine(Modes.PrettifyModePage_1C_S01(page.PageResponse));
else goto default;
break;
}
case 0x1D:
{
if(page.Subpage == 0)
DicConsole.WriteLine(Modes.PrettifyModePage_1D(page.PageResponse));
else goto default;
break;
}
case 0x21:
{
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "CERTANCE"
) DicConsole.WriteLine(Modes.PrettifyCertanceModePage_21(page.PageResponse));
else goto default;
break;
}
case 0x22:
{
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "CERTANCE"
) DicConsole.WriteLine(Modes.PrettifyCertanceModePage_22(page.PageResponse));
else goto default;
break;
}
case 0x24:
{
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "IBM")
DicConsole.WriteLine(Modes.PrettifyIBMModePage_24(page.PageResponse));
else goto default;
break;
}
case 0x2A:
{
if(page.Subpage == 0)
DicConsole.WriteLine(Modes.PrettifyModePage_2A(page.PageResponse));
else goto default;
break;
}
case 0x2F:
{
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "IBM")
DicConsole.WriteLine(Modes.PrettifyIBMModePage_2F(page.PageResponse));
else goto default;
break;
}
case 0x30:
{
if(Modes.IsAppleModePage_30(page.PageResponse))
DicConsole.WriteLine("Drive identifies as Apple OEM drive");
else goto default;
break;
}
case 0x3B:
{
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP")
DicConsole.WriteLine(Modes.PrettifyHPModePage_3B(page.PageResponse));
else goto default;
break;
}
case 0x3C:
{
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP")
DicConsole.WriteLine(Modes.PrettifyHPModePage_3C(page.PageResponse));
else goto default;
break;
}
case 0x3D:
{
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "IBM")
DicConsole.WriteLine(Modes.PrettifyIBMModePage_3D(page.PageResponse));
else if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP")
DicConsole.WriteLine(Modes.PrettifyHPModePage_3D(page.PageResponse));
else goto default;
break;
}
case 0x3E:
{
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "FUJITSU")
DicConsole.WriteLine(Modes.PrettifyFujitsuModePage_3E(page.PageResponse));
else if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP")
DicConsole.WriteLine(Modes.PrettifyHPModePage_3E(page.PageResponse));
else goto default;
break;
}
default:
{
if(page.Subpage != 0)
DicConsole.WriteLine("Found unknown mode page {0:X2}h subpage {1:X2}h",
page.Page, page.Subpage);
else DicConsole.WriteLine("Found unknown mode page {0:X2}h", page.Page);
break;
}
}
}
switch(devType) switch(devType)
{ {
@@ -1126,16 +833,16 @@ namespace DiscImageChef.Commands
#region Plextor #region Plextor
if(dev.Manufacturer == "PLEXTOR") if(dev.Manufacturer == "PLEXTOR")
{ {
bool plxtSense = true; bool plxtSense = true;
bool plxtDvd = false; bool plxtDvd = false;
byte[] plxtBuf = null; byte[] plxtBuf = null;
switch(dev.Model) switch(dev.Model)
{ {
case "DVDR PX-708A": case "DVDR PX-708A":
case "DVDR PX-708A2": case "DVDR PX-708A2":
case "DVDR PX-712A": case "DVDR PX-712A":
plxtDvd = true; plxtDvd = true;
plxtSense = dev.PlextorReadEeprom(out plxtBuf, out senseBuf, dev.Timeout, plxtSense = dev.PlextorReadEeprom(out plxtBuf, out senseBuf, dev.Timeout,
out _); out _);
break; break;
@@ -1174,39 +881,39 @@ namespace DiscImageChef.Commands
"PLEXTOR READ EEPROM", plxtBuf); "PLEXTOR READ EEPROM", plxtBuf);
ushort discs; ushort discs;
uint cdReadTime, cdWriteTime, dvdReadTime = 0, dvdWriteTime = 0; uint cdReadTime, cdWriteTime, dvdReadTime = 0, dvdWriteTime = 0;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
if(plxtDvd) if(plxtDvd)
{ {
discs = BigEndianBitConverter.ToUInt16(plxtBuf, 0x0120); discs = BigEndianBitConverter.ToUInt16(plxtBuf, 0x0120);
cdReadTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x0122); cdReadTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x0122);
cdWriteTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x0126); cdWriteTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x0126);
dvdReadTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x012A); dvdReadTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x012A);
dvdWriteTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x012E); dvdWriteTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x012E);
} }
else else
{ {
discs = BigEndianBitConverter.ToUInt16(plxtBuf, 0x0078); discs = BigEndianBitConverter.ToUInt16(plxtBuf, 0x0078);
cdReadTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x006C); cdReadTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x006C);
cdWriteTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x007A); cdWriteTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x007A);
} }
DicConsole.WriteLine("Drive has loaded a total of {0} discs", discs); DicConsole.WriteLine("Drive has loaded a total of {0} discs", discs);
DicConsole DicConsole
.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds reading CDs", .WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds reading CDs",
cdReadTime / 3600, cdReadTime / 60 % 60, cdReadTime % 60); cdReadTime / 3600, cdReadTime / 60 % 60, cdReadTime % 60);
DicConsole DicConsole
.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds writing CDs", .WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds writing CDs",
cdWriteTime / 3600, cdWriteTime / 60 % 60, cdWriteTime % 60); cdWriteTime / 3600, cdWriteTime / 60 % 60, cdWriteTime % 60);
if(plxtDvd) if(plxtDvd)
{ {
DicConsole DicConsole
.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds reading DVDs", .WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds reading DVDs",
dvdReadTime / 3600, dvdReadTime / 60 % 60, dvdReadTime % 60); dvdReadTime / 3600, dvdReadTime / 60 % 60, dvdReadTime % 60);
DicConsole DicConsole
.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds writing DVDs", .WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds writing DVDs",
dvdWriteTime / 3600, dvdWriteTime / 60 % 60, dvdWriteTime % 60); dvdWriteTime / 3600, dvdWriteTime / 60 % 60, dvdWriteTime % 60);
} }
} }
@@ -1231,12 +938,12 @@ namespace DiscImageChef.Commands
{ {
if(plxtPwrRecSelected > 0) if(plxtPwrRecSelected > 0)
DicConsole DicConsole
.WriteLine("Selected PoweRec speed for currently inserted media is {0} Kb/sec ({1}x)", .WriteLine("Selected PoweRec speed for currently inserted media is {0} Kb/sec ({1}x)",
plxtPwrRecSelected, plxtPwrRecSelected / 177); plxtPwrRecSelected, plxtPwrRecSelected / 177);
if(plxtPwrRecMax > 0) if(plxtPwrRecMax > 0)
DicConsole DicConsole
.WriteLine("Maximum PoweRec speed for currently inserted media is {0} Kb/sec ({1}x)", .WriteLine("Maximum PoweRec speed for currently inserted media is {0} Kb/sec ({1}x)",
plxtPwrRecMax, plxtPwrRecMax / 177); plxtPwrRecMax, plxtPwrRecMax / 177);
if(plxtPwrRecLast > 0) if(plxtPwrRecLast > 0)
DicConsole.WriteLine("Last used PoweRec was {0} Kb/sec ({1}x)", DicConsole.WriteLine("Last used PoweRec was {0} Kb/sec ({1}x)",
plxtPwrRecLast, plxtPwrRecLast / 177); plxtPwrRecLast, plxtPwrRecLast / 177);
@@ -1343,6 +1050,7 @@ namespace DiscImageChef.Commands
if(krFeatures.HasFlag(KreonFeatures.ErrorSkipping)) if(krFeatures.HasFlag(KreonFeatures.ErrorSkipping))
DicConsole.WriteLine("\tCan skip read errors"); DicConsole.WriteLine("\tCan skip read errors");
} }
break; break;
case PeripheralDeviceTypes.SequentialAccess: case PeripheralDeviceTypes.SequentialAccess:
@@ -1388,8 +1096,10 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Medium types supported by device:"); DicConsole.WriteLine("Medium types supported by device:");
DicConsole.WriteLine(DensitySupport.PrettifyMediumType(meds)); DicConsole.WriteLine(DensitySupport.PrettifyMediumType(meds));
} }
DicConsole.WriteLine(DensitySupport.PrettifyMediumType(seqBuf)); DicConsole.WriteLine(DensitySupport.PrettifyMediumType(seqBuf));
} }
break; break;
} }
@@ -1407,6 +1117,7 @@ namespace DiscImageChef.Commands
mmcBuf); mmcBuf);
DicConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyCID(mmcBuf)); DicConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyCID(mmcBuf));
} }
sense = dev.ReadCsd(out mmcBuf, out _, dev.Timeout, out _); sense = dev.ReadCsd(out mmcBuf, out _, dev.Timeout, out _);
if(!sense) if(!sense)
{ {
@@ -1415,6 +1126,7 @@ namespace DiscImageChef.Commands
mmcBuf); mmcBuf);
DicConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyCSD(mmcBuf)); DicConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyCSD(mmcBuf));
} }
sense = dev.ReadOcr(out mmcBuf, out _, dev.Timeout, out _); sense = dev.ReadOcr(out mmcBuf, out _, dev.Timeout, out _);
if(!sense) if(!sense)
{ {
@@ -1423,6 +1135,7 @@ namespace DiscImageChef.Commands
mmcBuf); mmcBuf);
DicConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyOCR(mmcBuf)); DicConsole.WriteLine("{0}", Decoders.MMC.Decoders.PrettifyOCR(mmcBuf));
} }
sense = dev.ReadExtendedCsd(out mmcBuf, out _, dev.Timeout, out _); sense = dev.ReadExtendedCsd(out mmcBuf, out _, dev.Timeout, out _);
if(!sense) if(!sense)
{ {
@@ -1447,6 +1160,7 @@ namespace DiscImageChef.Commands
"SecureDigital CID", sdBuf); "SecureDigital CID", sdBuf);
DicConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyCID(sdBuf)); DicConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyCID(sdBuf));
} }
sense = dev.ReadCsd(out sdBuf, out _, dev.Timeout, out _); sense = dev.ReadCsd(out sdBuf, out _, dev.Timeout, out _);
if(!sense) if(!sense)
{ {
@@ -1455,6 +1169,7 @@ namespace DiscImageChef.Commands
"SecureDigital CSD", sdBuf); "SecureDigital CSD", sdBuf);
DicConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyCSD(sdBuf)); DicConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyCSD(sdBuf));
} }
sense = dev.ReadSdocr(out sdBuf, out _, dev.Timeout, out _); sense = dev.ReadSdocr(out sdBuf, out _, dev.Timeout, out _);
if(!sense) if(!sense)
{ {
@@ -1463,6 +1178,7 @@ namespace DiscImageChef.Commands
"SecureDigital OCR", sdBuf); "SecureDigital OCR", sdBuf);
DicConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyOCR(sdBuf)); DicConsole.WriteLine("{0}", Decoders.SecureDigital.Decoders.PrettifyOCR(sdBuf));
} }
sense = dev.ReadScr(out sdBuf, out _, dev.Timeout, out _); sense = dev.ReadScr(out sdBuf, out _, dev.Timeout, out _);
if(!sense) if(!sense)
{ {

View File

@@ -0,0 +1,102 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : ImageInfo.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Verbs.
//
// --[ Description ] ----------------------------------------------------------
//
// Implements the 'image-info' verb.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// 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
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
using System;
using DiscImageChef.Console;
using DiscImageChef.Core;
using DiscImageChef.DiscImages;
using DiscImageChef.Filters;
namespace DiscImageChef.Commands
{
static class ImageInfo
{
internal static void GetImageInfo(ImageInfoOptions options)
{
DicConsole.DebugWriteLine("Analyze command", "--debug={0}", options.Debug);
DicConsole.DebugWriteLine("Analyze command", "--verbose={0}", options.Verbose);
DicConsole.DebugWriteLine("Analyze command", "--input={0}", options.InputFile);
FiltersList filtersList = new FiltersList();
IFilter inputFilter = filtersList.GetFilter(options.InputFile);
if(inputFilter == null)
{
DicConsole.ErrorWriteLine("Cannot open specified file.");
return;
}
try
{
IMediaImage imageFormat = ImageFormat.Detect(inputFilter);
if(imageFormat == null)
{
DicConsole.WriteLine("Image format not identified.");
return;
}
DicConsole.WriteLine("Image format identified by {0} ({1}).", imageFormat.Name, imageFormat.Id);
DicConsole.WriteLine();
try
{
if(!imageFormat.Open(inputFilter))
{
DicConsole.WriteLine("Unable to open image format");
DicConsole.WriteLine("No error given");
return;
}
Core.ImageInfo.PrintImageInfo(imageFormat);
Core.Statistics.AddMediaFormat(imageFormat.Format);
Core.Statistics.AddMedia(imageFormat.Info.MediaType, false);
Core.Statistics.AddFilter(inputFilter.Name);
}
catch(Exception ex)
{
DicConsole.ErrorWriteLine("Unable to open image format");
DicConsole.ErrorWriteLine("Error: {0}", ex.Message);
DicConsole.DebugWriteLine("Image-info command", "Stack trace: {0}", ex.StackTrace);
}
}
catch(Exception ex)
{
DicConsole.ErrorWriteLine($"Error reading file: {ex.Message}");
DicConsole.DebugWriteLine("Image-info command", ex.StackTrace);
}
Core.Statistics.AddCommand("image-info");
}
}
}

View File

@@ -63,6 +63,9 @@ namespace DiscImageChef.Commands
if(Core.Statistics.AllStats.Commands.Compare > 0) if(Core.Statistics.AllStats.Commands.Compare > 0)
DicConsole.WriteLine("You have called the Compare command {0} times", DicConsole.WriteLine("You have called the Compare command {0} times",
Core.Statistics.AllStats.Commands.Compare); Core.Statistics.AllStats.Commands.Compare);
if(Core.Statistics.AllStats.Commands.ConvertImage > 0)
DicConsole.WriteLine("You have called the Convert-Image command {0} times",
Core.Statistics.AllStats.Commands.ConvertImage);
if(Core.Statistics.AllStats.Commands.CreateSidecar > 0) if(Core.Statistics.AllStats.Commands.CreateSidecar > 0)
DicConsole.WriteLine("You have called the Create-Sidecar command {0} times", DicConsole.WriteLine("You have called the Create-Sidecar command {0} times",
Core.Statistics.AllStats.Commands.CreateSidecar); Core.Statistics.AllStats.Commands.CreateSidecar);
@@ -84,6 +87,9 @@ namespace DiscImageChef.Commands
if(Core.Statistics.AllStats.Commands.Formats > 0) if(Core.Statistics.AllStats.Commands.Formats > 0)
DicConsole.WriteLine("You have called the Formats command {0} times", DicConsole.WriteLine("You have called the Formats command {0} times",
Core.Statistics.AllStats.Commands.Formats); Core.Statistics.AllStats.Commands.Formats);
if(Core.Statistics.AllStats.Commands.ImageInfo > 0)
DicConsole.WriteLine("You have called the Image-Info command {0} times",
Core.Statistics.AllStats.Commands.ImageInfo);
if(Core.Statistics.AllStats.Commands.MediaInfo > 0) if(Core.Statistics.AllStats.Commands.MediaInfo > 0)
DicConsole.WriteLine("You have called the Media-Info command {0} times", DicConsole.WriteLine("You have called the Media-Info command {0} times",
Core.Statistics.AllStats.Commands.MediaInfo); Core.Statistics.AllStats.Commands.MediaInfo);
@@ -171,8 +177,8 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("================="); DicConsole.WriteLine("=================");
foreach(DeviceStats ds in Core.Statistics.AllStats.Devices) foreach(DeviceStats ds in Core.Statistics.AllStats.Devices)
DicConsole DicConsole
.WriteLine("Device model {0}, manufactured by {1}, with revision {2} and attached via {3}.", .WriteLine("Device model {0}, manufactured by {1}, with revision {2} and attached via {3}.",
ds.Model, ds.Manufacturer, ds.Revision, ds.Bus); ds.Model, ds.Manufacturer, ds.Revision, ds.Bus);
DicConsole.WriteLine(); DicConsole.WriteLine();
thereAreStats = true; thereAreStats = true;
@@ -196,7 +202,7 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("====================="); DicConsole.WriteLine("=====================");
DicConsole.WriteLine("Scanned a total of {0} sectors", DicConsole.WriteLine("Scanned a total of {0} sectors",
Core.Statistics.AllStats.MediaScan.Sectors.Total); Core.Statistics.AllStats.MediaScan.Sectors.Total);
DicConsole.WriteLine("{0} of them correctly", Core.Statistics.AllStats.MediaScan.Sectors.Correct); DicConsole.WriteLine("{0} of them correctly", Core.Statistics.AllStats.MediaScan.Sectors.Correct);
DicConsole.WriteLine("{0} of them had errors", Core.Statistics.AllStats.MediaScan.Sectors.Error); DicConsole.WriteLine("{0} of them had errors", Core.Statistics.AllStats.MediaScan.Sectors.Error);
DicConsole.WriteLine("{0} of them took less than 3 ms", DicConsole.WriteLine("{0} of them took less than 3 ms",
Core.Statistics.AllStats.MediaScan.Times.LessThan3ms); Core.Statistics.AllStats.MediaScan.Times.LessThan3ms);

View File

@@ -52,6 +52,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Commands\ConvertImage.cs" /> <Compile Include="Commands\ConvertImage.cs" />
<Compile Include="Commands\ImageInfo.cs" />
<Compile Include="Commands\ListOptions.cs" /> <Compile Include="Commands\ListOptions.cs" />
<Compile Include="Main.cs" /> <Compile Include="Main.cs" />
<Compile Include="AssemblyInfo.cs" /> <Compile Include="AssemblyInfo.cs" />

View File

@@ -56,7 +56,7 @@ namespace DiscImageChef
typeof(ConvertImageOptions), typeof(CreateSidecarOptions), typeof(ConvertImageOptions), typeof(CreateSidecarOptions),
typeof(DecodeOptions), typeof(DeviceInfoOptions), typeof(DeviceReportOptions), typeof(DecodeOptions), typeof(DeviceInfoOptions), typeof(DeviceReportOptions),
typeof(DumpMediaOptions), typeof(EntropyOptions), typeof(ExtractFilesOptions), typeof(DumpMediaOptions), typeof(EntropyOptions), typeof(ExtractFilesOptions),
typeof(FormatsOptions), typeof(ListDevicesOptions), typeof(FormatsOptions), typeof(ImageInfoOptions), typeof(ListDevicesOptions),
typeof(ListEncodingsOptions), typeof(ListOptionsOptions), typeof(LsOptions), typeof(ListEncodingsOptions), typeof(ListOptionsOptions), typeof(LsOptions),
typeof(MediaInfoOptions), typeof(MediaScanOptions), typeof(PrintHexOptions), typeof(MediaInfoOptions), typeof(MediaScanOptions), typeof(PrintHexOptions),
typeof(StatsOptions), typeof(VerifyOptions)) typeof(StatsOptions), typeof(VerifyOptions))
@@ -186,6 +186,12 @@ namespace DiscImageChef
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
PrintCopyright(); PrintCopyright();
ConvertImage.DoConvert(opts); ConvertImage.DoConvert(opts);
}).WithParsed<ImageInfoOptions>(opts =>
{
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
PrintCopyright();
ImageInfo.GetImageInfo(opts);
}).WithParsed<ConfigureOptions>(opts => }).WithParsed<ConfigureOptions>(opts =>
{ {
PrintCopyright(); PrintCopyright();

View File

@@ -430,4 +430,12 @@ namespace DiscImageChef
HelpText = "Comma separated name=value pairs of options to pass to output image plugin")] HelpText = "Comma separated name=value pairs of options to pass to output image plugin")]
public string Options { get; set; } public string Options { get; set; }
} }
[Verb("image-info", HelpText =
"Opens a media image and shows information about the media it represents and metadata.")]
public class ImageInfoOptions : CommonOptions
{
[Option('i', "input", Required = true, HelpText = "Media image.")]
public string InputFile { get; set; }
}
} }