* commandline:

Moved commandline submodule to my own fork.

	* DiscImageChef.sln:
	* DiscImageChef/Main.cs:
	* DiscImageChef/Options.cs:
	* DiscImageChef/Commands/Decode.cs:
	* DiscImageChef/Commands/Verify.cs:
	* DiscImageChef/Commands/Entropy.cs:
	* DiscImageChef/Commands/Analyze.cs:
	* DiscImageChef/Commands/Compare.cs:
	* DiscImageChef/Commands/Formats.cs:
	* DiscImageChef/DiscImageChef.csproj:
	* DiscImageChef/Commands/PrintHex.cs:
	* DiscImageChef/Commands/Checksum.cs:
	* DiscImageChef/Commands/Benchmark.cs:
	* DiscImageChef/Commands/MediaScan.cs:
	* DiscImageChef/Commands/MediaInfo.cs:
	* DiscImageChef/Commands/DumpMedia.cs:
	* DiscImageChef/Commands/DeviceInfo.cs:
	* DiscImageChef/Commands/DeviceReport.cs:
	* DiscImageChef/Commands/CreateSidecar.cs:
	  Updated to new CommandLine API.
This commit is contained in:
2016-04-08 01:13:42 +01:00
parent 139a78fc63
commit 942a96defa
21 changed files with 405 additions and 327 deletions

3
.gitmodules vendored
View File

@@ -1,3 +1,6 @@
[submodule "CICMMetadata"] [submodule "CICMMetadata"]
path = CICMMetadata path = CICMMetadata
url = https://github.com/claunia/CICMMetadata url = https://github.com/claunia/CICMMetadata
[submodule "commandline"]
path = commandline
url = https://github.com/claunia/commandline

View File

@@ -5,8 +5,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef", "DiscImageC
EndProject EndProject
Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "Packages", "Packages.mdproj", "{8996EF59-09B9-4920-A3DE-2F8EA2EBBCFF}" Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "Packages", "Packages.mdproj", "{8996EF59-09B9-4920-A3DE-2F8EA2EBBCFF}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandLine35", "commandline\src\libcmdline\CommandLine35.csproj", "{5DEA2811-2FFA-4959-830B-CAD3ACACABEB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Checksums", "DiscImageChef.Checksums\DiscImageChef.Checksums.csproj", "{CC48B324-A532-4A45-87A6-6F91F7141E8D}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Checksums", "DiscImageChef.Checksums\DiscImageChef.Checksums.csproj", "{CC48B324-A532-4A45-87A6-6F91F7141E8D}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Helpers", "DiscImageChef.Helpers\DiscImageChef.Helpers.csproj", "{F8BDF57B-1571-4CD0-84B3-B422088D359A}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Helpers", "DiscImageChef.Helpers\DiscImageChef.Helpers.csproj", "{F8BDF57B-1571-4CD0-84B3-B422088D359A}"
@@ -31,6 +29,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Metadata", "D
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Settings", "DiscImageChef.Settings\DiscImageChef.Settings.csproj", "{5C4C7BAA-CF60-4233-84ED-39CB2312AF38}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Settings", "DiscImageChef.Settings\DiscImageChef.Settings.csproj", "{5C4C7BAA-CF60-4233-84ED-39CB2312AF38}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandLine", "commandline\src\CommandLine\CommandLine.csproj", "{E1BD3C65-49C3-49E7-BABA-C60980CB3F20}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86 Debug|x86 = Debug|x86
@@ -45,10 +45,6 @@ Global
{57BB2341-AB62-48FD-91B8-46F5A2F9ED51}.Debug|x86.Build.0 = Debug|Any CPU {57BB2341-AB62-48FD-91B8-46F5A2F9ED51}.Debug|x86.Build.0 = Debug|Any CPU
{57BB2341-AB62-48FD-91B8-46F5A2F9ED51}.Release|x86.ActiveCfg = Release|Any CPU {57BB2341-AB62-48FD-91B8-46F5A2F9ED51}.Release|x86.ActiveCfg = Release|Any CPU
{57BB2341-AB62-48FD-91B8-46F5A2F9ED51}.Release|x86.Build.0 = Release|Any CPU {57BB2341-AB62-48FD-91B8-46F5A2F9ED51}.Release|x86.Build.0 = Release|Any CPU
{5DEA2811-2FFA-4959-830B-CAD3ACACABEB}.Debug|x86.ActiveCfg = Debug|Any CPU
{5DEA2811-2FFA-4959-830B-CAD3ACACABEB}.Debug|x86.Build.0 = Debug|Any CPU
{5DEA2811-2FFA-4959-830B-CAD3ACACABEB}.Release|x86.ActiveCfg = Release|Any CPU
{5DEA2811-2FFA-4959-830B-CAD3ACACABEB}.Release|x86.Build.0 = Release|Any CPU
{74032CBC-339B-42F3-AF6F-E96C261F3E6A}.Debug|x86.ActiveCfg = Debug|Any CPU {74032CBC-339B-42F3-AF6F-E96C261F3E6A}.Debug|x86.ActiveCfg = Debug|Any CPU
{74032CBC-339B-42F3-AF6F-E96C261F3E6A}.Debug|x86.Build.0 = Debug|Any CPU {74032CBC-339B-42F3-AF6F-E96C261F3E6A}.Debug|x86.Build.0 = Debug|Any CPU
{74032CBC-339B-42F3-AF6F-E96C261F3E6A}.Release|x86.ActiveCfg = Release|Any CPU {74032CBC-339B-42F3-AF6F-E96C261F3E6A}.Release|x86.ActiveCfg = Release|Any CPU
@@ -95,6 +91,10 @@ Global
{5C4C7BAA-CF60-4233-84ED-39CB2312AF38}.Debug|x86.Build.0 = Debug|Any CPU {5C4C7BAA-CF60-4233-84ED-39CB2312AF38}.Debug|x86.Build.0 = Debug|Any CPU
{5C4C7BAA-CF60-4233-84ED-39CB2312AF38}.Release|x86.ActiveCfg = Release|Any CPU {5C4C7BAA-CF60-4233-84ED-39CB2312AF38}.Release|x86.ActiveCfg = Release|Any CPU
{5C4C7BAA-CF60-4233-84ED-39CB2312AF38}.Release|x86.Build.0 = Release|Any CPU {5C4C7BAA-CF60-4233-84ED-39CB2312AF38}.Release|x86.Build.0 = Release|Any CPU
{E1BD3C65-49C3-49E7-BABA-C60980CB3F20}.Debug|x86.ActiveCfg = Debug|Any CPU
{E1BD3C65-49C3-49E7-BABA-C60980CB3F20}.Debug|x86.Build.0 = Debug|Any CPU
{E1BD3C65-49C3-49E7-BABA-C60980CB3F20}.Release|x86.ActiveCfg = Release|Any CPU
{E1BD3C65-49C3-49E7-BABA-C60980CB3F20}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0 Policies = $0
@@ -102,9 +102,10 @@ Global
$1.Text = @/***************************************************************************\nThe Disc Image Chef\n----------------------------------------------------------------------------\n \nFilename : ${FileName}\nVersion : 1.0\nAuthor(s) : ${AuthorName}\n \nComponent : Component\n\nRevision : $Revision$\nLast change by : $Author$\nDate : $Date$\n \n--[ Description ] ----------------------------------------------------------\n \nDescription\n \n--[ License ] --------------------------------------------------------------\n \n This program is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as\n published by the Free Software Foundation, either version 3 of the\n License, or (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.\n\n----------------------------------------------------------------------------\nCopyright (C) 2011-2015 Claunia.com\n****************************************************************************/\n//$Id$ $1.Text = @/***************************************************************************\nThe Disc Image Chef\n----------------------------------------------------------------------------\n \nFilename : ${FileName}\nVersion : 1.0\nAuthor(s) : ${AuthorName}\n \nComponent : Component\n\nRevision : $Revision$\nLast change by : $Author$\nDate : $Date$\n \n--[ Description ] ----------------------------------------------------------\n \nDescription\n \n--[ License ] --------------------------------------------------------------\n \n This program is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as\n published by the Free Software Foundation, either version 3 of the\n License, or (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.\n\n----------------------------------------------------------------------------\nCopyright (C) 2011-2015 Claunia.com\n****************************************************************************/\n//$Id$
$1.IncludeInNewFiles = True $1.IncludeInNewFiles = True
$0.TextStylePolicy = $2 $0.TextStylePolicy = $2
$2.inheritsSet = VisualStudio $2.inheritsSet = null
$2.inheritsScope = text/plain $2.inheritsScope = text/plain
$2.scope = text/x-csharp $2.scope = application/config+xml
$2.FileWidth = 120
$0.CSharpFormattingPolicy = $3 $0.CSharpFormattingPolicy = $3
$3.SpacingAfterMethodDeclarationName = False $3.SpacingAfterMethodDeclarationName = False
$3.SpaceAfterMethodCallName = False $3.SpaceAfterMethodCallName = False
@@ -127,6 +128,151 @@ Global
$3.NewLineForMembersInObjectInit = True $3.NewLineForMembersInObjectInit = True
$3.NewLineForMembersInAnonymousTypes = True $3.NewLineForMembersInAnonymousTypes = True
$3.NewLineForClausesInQuery = True $3.NewLineForClausesInQuery = True
$3.IndentBlock = False
$3.IndentSwitchCaseSection = False
$0.DotNetNamingPolicy = $4
$4.DirectoryNamespaceAssociation = Hierarchical
$4.ResourceNamePolicy = MSBuild
$0.XmlFormattingPolicy = $5
$5.DefaultFormat = $6
$6.AlignAttributes = True
$5.inheritsSet = null
$5.inheritsScope = application/xml
$5.scope = application/config+xml
$0.NameConventionPolicy = $7
$7.Rules = $8
$8.NamingRule = $9
$9.Name = Type Parameters
$9.AffectedEntity = TypeParameter
$9.VisibilityMask = VisibilityMask
$9.NamingStyle = PascalCase
$9.IncludeInstanceMembers = True
$9.IncludeStaticEntities = True
$9.RequiredPrefixes = $32
$32.String = T
$9.RequiredSuffixes = $33
$33.String = Exception
$8.NamingRule = $10
$10.Name = Types
$10.AffectedEntity = Class, Struct, Enum, Delegate
$10.VisibilityMask = Public
$10.NamingStyle = PascalCase
$10.IncludeInstanceMembers = True
$10.IncludeStaticEntities = True
$8.NamingRule = $11
$11.Name = Interfaces
$11.RequiredPrefixes = $12
$12.String = I
$11.AffectedEntity = Interface
$11.VisibilityMask = Public
$11.NamingStyle = PascalCase
$11.IncludeInstanceMembers = True
$11.IncludeStaticEntities = True
$8.NamingRule = $13
$13.Name = Attributes
$13.RequiredSuffixes = $14
$14.String = Attribute
$13.AffectedEntity = CustomAttributes
$13.VisibilityMask = Public
$13.NamingStyle = PascalCase
$13.IncludeInstanceMembers = True
$13.IncludeStaticEntities = True
$8.NamingRule = $15
$15.Name = Event Arguments
$15.RequiredSuffixes = $16
$16.String = EventArgs
$15.AffectedEntity = CustomEventArgs
$15.VisibilityMask = Public
$15.NamingStyle = PascalCase
$15.IncludeInstanceMembers = True
$15.IncludeStaticEntities = True
$8.NamingRule = $17
$17.Name = Exceptions
$17.RequiredSuffixes = $18
$18.String = Exception
$17.AffectedEntity = CustomExceptions
$17.VisibilityMask = VisibilityMask
$17.NamingStyle = PascalCase
$17.IncludeInstanceMembers = True
$17.IncludeStaticEntities = True
$8.NamingRule = $19
$19.Name = Methods
$19.AffectedEntity = Methods
$19.VisibilityMask = Protected, Public
$19.NamingStyle = PascalCase
$19.IncludeInstanceMembers = True
$19.IncludeStaticEntities = True
$8.NamingRule = $20
$20.Name = Static Readonly Fields
$20.AffectedEntity = ReadonlyField
$20.VisibilityMask = Protected, Public
$20.NamingStyle = PascalCase
$20.IncludeInstanceMembers = False
$20.IncludeStaticEntities = True
$8.NamingRule = $21
$21.Name = Fields
$21.AffectedEntity = Field
$21.VisibilityMask = Protected, Public
$21.NamingStyle = PascalCase
$21.IncludeInstanceMembers = True
$21.IncludeStaticEntities = True
$8.NamingRule = $22
$22.Name = ReadOnly Fields
$22.AffectedEntity = ReadonlyField
$22.VisibilityMask = Protected, Public
$22.NamingStyle = PascalCase
$22.IncludeInstanceMembers = True
$22.IncludeStaticEntities = False
$8.NamingRule = $23
$23.Name = Constant Fields
$23.AffectedEntity = ConstantField
$23.VisibilityMask = Protected, Public
$23.NamingStyle = PascalCase
$23.IncludeInstanceMembers = True
$23.IncludeStaticEntities = True
$8.NamingRule = $24
$24.Name = Properties
$24.AffectedEntity = Property
$24.VisibilityMask = Protected, Public
$24.NamingStyle = PascalCase
$24.IncludeInstanceMembers = True
$24.IncludeStaticEntities = True
$8.NamingRule = $25
$25.Name = Events
$25.AffectedEntity = Event
$25.VisibilityMask = Protected, Public
$25.NamingStyle = PascalCase
$25.IncludeInstanceMembers = True
$25.IncludeStaticEntities = True
$8.NamingRule = $26
$26.Name = Enum Members
$26.AffectedEntity = EnumMember
$26.VisibilityMask = VisibilityMask
$26.NamingStyle = PascalCase
$26.IncludeInstanceMembers = True
$26.IncludeStaticEntities = True
$8.NamingRule = $27
$27.Name = Parameters
$27.AffectedEntity = Parameter
$27.VisibilityMask = VisibilityMask
$27.NamingStyle = CamelCase
$27.IncludeInstanceMembers = True
$27.IncludeStaticEntities = True
$8.NamingRule = $28
$28.Name = Type Parameters
$28.RequiredPrefixes = $29
$29.String = T
$28.AffectedEntity = TypeParameter
$28.VisibilityMask = VisibilityMask
$28.NamingStyle = PascalCase
$28.IncludeInstanceMembers = True
$28.IncludeStaticEntities = True
$0.VersionControlPolicy = $30
$30.CommitMessageStyle = $31
$31.Indent = @\t
$31.LastFilePostfix = "@:\n "
$31.IncludeDirectoryPaths = True
$30.inheritsSet = Mono
description = The Disc Image Chef. description = The Disc Image Chef.
version = 2.2 version = 2.2
EndGlobalSection EndGlobalSection

View File

@@ -46,7 +46,7 @@ namespace DiscImageChef.Commands
{ {
public static class Analyze public static class Analyze
{ {
public static void doAnalyze(AnalyzeSubOptions options) public static void doAnalyze(AnalyzeOptions options)
{ {
DicConsole.DebugWriteLine("Analyze command", "--debug={0}", options.Debug); DicConsole.DebugWriteLine("Analyze command", "--debug={0}", options.Debug);
DicConsole.DebugWriteLine("Analyze command", "--verbose={0}", options.Verbose); DicConsole.DebugWriteLine("Analyze command", "--verbose={0}", options.Verbose);

View File

@@ -45,7 +45,7 @@ namespace DiscImageChef.Commands
{ {
public static class Benchmark public static class Benchmark
{ {
public static void doBenchmark(BenchmarkSubOptions options) public static void doBenchmark(BenchmarkOptions options)
{ {
int bufferSize = options.BufferSize * 1024 * 1024; int bufferSize = options.BufferSize * 1024 * 1024;
long minMemory = long.MaxValue; long minMemory = long.MaxValue;

View File

@@ -49,7 +49,7 @@ namespace DiscImageChef.Commands
// How many sectors to read at once // How many sectors to read at once
const uint sectorsToRead = 256; const uint sectorsToRead = 256;
public static void doChecksum(ChecksumSubOptions options) public static void doChecksum(ChecksumOptions options)
{ {
DicConsole.DebugWriteLine("Checksum command", "--debug={0}", options.Debug); DicConsole.DebugWriteLine("Checksum command", "--debug={0}", options.Debug);
DicConsole.DebugWriteLine("Checksum command", "--verbose={0}", options.Verbose); DicConsole.DebugWriteLine("Checksum command", "--verbose={0}", options.Verbose);

View File

@@ -45,7 +45,7 @@ namespace DiscImageChef.Commands
{ {
public static class Compare public static class Compare
{ {
public static void doCompare(CompareSubOptions options) public 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);

View File

@@ -51,7 +51,7 @@ namespace DiscImageChef.Commands
{ {
public static class CreateSidecar public static class CreateSidecar
{ {
public static void doSidecar(CreateSidecarSubOptions options) public static void doSidecar(CreateSidecarOptions options)
{ {
CICMMetadataType sidecar = new CICMMetadataType(); CICMMetadataType sidecar = new CICMMetadataType();
PluginBase plugins = new PluginBase(); PluginBase plugins = new PluginBase();

View File

@@ -43,7 +43,7 @@ namespace DiscImageChef.Commands
{ {
public static class Decode public static class Decode
{ {
public static void doDecode(DecodeSubOptions options) public static void doDecode(DecodeOptions options)
{ {
DicConsole.DebugWriteLine("Decode command", "--debug={0}", options.Debug); DicConsole.DebugWriteLine("Decode command", "--debug={0}", options.Debug);
DicConsole.DebugWriteLine("Decode command", "--verbose={0}", options.Verbose); DicConsole.DebugWriteLine("Decode command", "--verbose={0}", options.Verbose);

View File

@@ -46,7 +46,7 @@ namespace DiscImageChef.Commands
{ {
public static class DeviceInfo public static class DeviceInfo
{ {
public static void doDeviceInfo(DeviceInfoSubOptions options) public 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);

View File

@@ -46,7 +46,7 @@ namespace DiscImageChef.Commands
{ {
public static class DeviceReport public static class DeviceReport
{ {
public static void doDeviceReport(DeviceReportSubOptions options) public static void doDeviceReport(DeviceReportOptions options)
{ {
DicConsole.DebugWriteLine("Device-Report command", "--debug={0}", options.Debug); DicConsole.DebugWriteLine("Device-Report command", "--debug={0}", options.Debug);
DicConsole.DebugWriteLine("Device-Report command", "--verbose={0}", options.Verbose); DicConsole.DebugWriteLine("Device-Report command", "--verbose={0}", options.Verbose);
@@ -97,7 +97,7 @@ namespace DiscImageChef.Commands
Core.Statistics.AddCommand("device-report"); Core.Statistics.AddCommand("device-report");
} }
static void doATADeviceReport(DeviceReportSubOptions options, Device dev) static void doATADeviceReport(DeviceReportOptions options, Device dev)
{ {
DiscImageChef.Decoders.ATA.AtaErrorRegistersCHS errorRegs; DiscImageChef.Decoders.ATA.AtaErrorRegistersCHS errorRegs;
byte[] buffer; byte[] buffer;
@@ -1074,17 +1074,17 @@ namespace DiscImageChef.Commands
xmlFs.Close(); xmlFs.Close();
} }
static void doNVMeDeviceReport(DeviceReportSubOptions options, Device dev) static void doNVMeDeviceReport(DeviceReportOptions options, Device dev)
{ {
throw new NotImplementedException("NVMe devices not yet supported."); throw new NotImplementedException("NVMe devices not yet supported.");
} }
static void doSDDeviceReport(DeviceReportSubOptions options, Device dev) static void doSDDeviceReport(DeviceReportOptions options, Device dev)
{ {
throw new NotImplementedException("MMC/SD devices not yet supported."); throw new NotImplementedException("MMC/SD devices not yet supported.");
} }
static void doSCSIDeviceReport(DeviceReportSubOptions options, Device dev) static void doSCSIDeviceReport(DeviceReportOptions options, Device dev)
{ {
byte[] senseBuffer; byte[] senseBuffer;
byte[] buffer; byte[] buffer;

View File

@@ -56,7 +56,7 @@ namespace DiscImageChef.Commands
static Core.IBGLog ibgLog; static Core.IBGLog ibgLog;
// TODO: Implement dump map // TODO: Implement dump map
public static void doDumpMedia(DumpMediaSubOptions options) public static void doDumpMedia(DumpMediaOptions options)
{ {
DicConsole.DebugWriteLine("Dump-Media command", "--debug={0}", options.Debug); DicConsole.DebugWriteLine("Dump-Media command", "--debug={0}", options.Debug);
DicConsole.DebugWriteLine("Dump-Media command", "--verbose={0}", options.Verbose); DicConsole.DebugWriteLine("Dump-Media command", "--verbose={0}", options.Verbose);
@@ -116,7 +116,7 @@ namespace DiscImageChef.Commands
Core.Statistics.AddCommand("dump-media"); Core.Statistics.AddCommand("dump-media");
} }
static void doATAMediaScan(DumpMediaSubOptions options, Device dev) static void doATAMediaScan(DumpMediaOptions options, Device dev)
{ {
if(options.Raw) if(options.Raw)
{ {
@@ -899,17 +899,17 @@ namespace DiscImageChef.Commands
DicConsole.ErrorWriteLine("Unable to communicate with ATA device."); DicConsole.ErrorWriteLine("Unable to communicate with ATA device.");
} }
static void doNVMeMediaScan(DumpMediaSubOptions options, Device dev) static void doNVMeMediaScan(DumpMediaOptions options, Device dev)
{ {
throw new NotImplementedException("NVMe devices not yet supported."); throw new NotImplementedException("NVMe devices not yet supported.");
} }
static void doSDMediaScan(DumpMediaSubOptions options, Device dev) static void doSDMediaScan(DumpMediaOptions options, Device dev)
{ {
throw new NotImplementedException("MMC/SD devices not yet supported."); throw new NotImplementedException("MMC/SD devices not yet supported.");
} }
static void doSCSIMediaScan(DumpMediaSubOptions options, Device dev) static void doSCSIMediaScan(DumpMediaOptions options, Device dev)
{ {
byte[] cmdBuf = null; byte[] cmdBuf = null;
byte[] senseBuf = null; byte[] senseBuf = null;

View File

@@ -45,7 +45,7 @@ namespace DiscImageChef.Commands
{ {
public static class Entropy public static class Entropy
{ {
public static void doEntropy(EntropySubOptions options) public static void doEntropy(EntropyOptions options)
{ {
DicConsole.DebugWriteLine("Entropy command", "--debug={0}", options.Debug); DicConsole.DebugWriteLine("Entropy command", "--debug={0}", options.Debug);
DicConsole.DebugWriteLine("Entropy command", "--verbose={0}", options.Verbose); DicConsole.DebugWriteLine("Entropy command", "--verbose={0}", options.Verbose);

View File

@@ -46,7 +46,7 @@ namespace DiscImageChef.Commands
{ {
public static class Formats public static class Formats
{ {
public static void ListFormats(FormatsSubOptions FormatsOptions) public static void ListFormats(FormatsOptions FormatsOptions)
{ {
PluginBase plugins = new PluginBase(); PluginBase plugins = new PluginBase();
plugins.RegisterAllPlugins(); plugins.RegisterAllPlugins();

View File

@@ -46,7 +46,7 @@ namespace DiscImageChef.Commands
{ {
public static class MediaInfo public static class MediaInfo
{ {
public static void doMediaInfo(MediaInfoSubOptions options) public static void doMediaInfo(MediaInfoOptions options)
{ {
DicConsole.DebugWriteLine("Media-Info command", "--debug={0}", options.Debug); DicConsole.DebugWriteLine("Media-Info command", "--debug={0}", options.Debug);
DicConsole.DebugWriteLine("Media-Info command", "--verbose={0}", options.Verbose); DicConsole.DebugWriteLine("Media-Info command", "--verbose={0}", options.Verbose);

View File

@@ -48,7 +48,7 @@ namespace DiscImageChef.Commands
static Core.MHDDLog mhddLog; static Core.MHDDLog mhddLog;
static Core.IBGLog ibgLog; static Core.IBGLog ibgLog;
public static void doMediaScan(MediaScanSubOptions options) public static void doMediaScan(MediaScanOptions options)
{ {
DicConsole.DebugWriteLine("Media-Scan command", "--debug={0}", options.Debug); DicConsole.DebugWriteLine("Media-Scan command", "--debug={0}", options.Debug);
DicConsole.DebugWriteLine("Media-Scan command", "--verbose={0}", options.Verbose); DicConsole.DebugWriteLine("Media-Scan command", "--verbose={0}", options.Verbose);

View File

@@ -43,7 +43,7 @@ namespace DiscImageChef.Commands
{ {
public static class PrintHex public static class PrintHex
{ {
public static void doPrintHex(PrintHexSubOptions options) public static void doPrintHex(PrintHexOptions options)
{ {
DicConsole.DebugWriteLine("PrintHex command", "--debug={0}", options.Debug); DicConsole.DebugWriteLine("PrintHex command", "--debug={0}", options.Debug);
DicConsole.DebugWriteLine("PrintHex command", "--verbose={0}", options.Verbose); DicConsole.DebugWriteLine("PrintHex command", "--verbose={0}", options.Verbose);

View File

@@ -44,7 +44,7 @@ namespace DiscImageChef.Commands
{ {
public static class Verify public static class Verify
{ {
public static void doVerify(VerifySubOptions options) public static void doVerify(VerifyOptions options)
{ {
DicConsole.DebugWriteLine("Verify command", "--debug={0}", options.Debug); DicConsole.DebugWriteLine("Verify command", "--debug={0}", options.Debug);
DicConsole.DebugWriteLine("Verify command", "--verbose={0}", options.Verbose); DicConsole.DebugWriteLine("Verify command", "--verbose={0}", options.Verbose);

View File

@@ -158,10 +158,6 @@
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\commandline\src\libcmdline\CommandLine35.csproj">
<Project>{5DEA2811-2FFA-4959-830B-CAD3ACACABEB}</Project>
<Name>CommandLine35</Name>
</ProjectReference>
<ProjectReference Include="..\DiscImageChef.Checksums\DiscImageChef.Checksums.csproj"> <ProjectReference Include="..\DiscImageChef.Checksums\DiscImageChef.Checksums.csproj">
<Project>{CC48B324-A532-4A45-87A6-6F91F7141E8D}</Project> <Project>{CC48B324-A532-4A45-87A6-6F91F7141E8D}</Project>
<Name>DiscImageChef.Checksums</Name> <Name>DiscImageChef.Checksums</Name>
@@ -210,5 +206,9 @@
<Project>{5C4C7BAA-CF60-4233-84ED-39CB2312AF38}</Project> <Project>{5C4C7BAA-CF60-4233-84ED-39CB2312AF38}</Project>
<Name>DiscImageChef.Settings</Name> <Name>DiscImageChef.Settings</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\commandline\src\CommandLine\CommandLine.csproj">
<Project>{E1BD3C65-49C3-49E7-BABA-C60980CB3F20}</Project>
<Name>CommandLine</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -40,34 +40,19 @@ using System;
using System.Reflection; using System.Reflection;
using DiscImageChef.Console; using DiscImageChef.Console;
using DiscImageChef.Settings; using DiscImageChef.Settings;
using CommandLine;
namespace DiscImageChef namespace DiscImageChef
{ {
class MainClass class MainClass
{ {
public static void Main(string[] args) public static void Main(string [] args)
{ {
string invokedVerb = ""; object [] attributes = typeof(MainClass).Assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
object invokedVerbInstance = null; string AssemblyTitle = ((AssemblyTitleAttribute)attributes [0]).Title;
var options = new Options();
if (!CommandLine.Parser.Default.ParseArguments(args, options,
(verb, subOptions) =>
{
// if parsing succeeds the verb name and correct instance
// will be passed to onVerbCommand delegate (string,object)
invokedVerb = verb;
invokedVerbInstance = subOptions;
}))
{
Environment.Exit(CommandLine.Parser.DefaultExitCodeFail);
}
object[] attributes = typeof(MainClass).Assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
string AssemblyTitle = ((AssemblyTitleAttribute) attributes[0]).Title;
attributes = typeof(MainClass).Assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); attributes = typeof(MainClass).Assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
Version AssemblyVersion = typeof(MainClass).Assembly.GetName().Version; Version AssemblyVersion = typeof(MainClass).Assembly.GetName().Version;
string AssemblyCopyright = ((AssemblyCopyrightAttribute) attributes[0]).Copyright; string AssemblyCopyright = ((AssemblyCopyrightAttribute)attributes [0]).Copyright;
DicConsole.WriteLineEvent += System.Console.WriteLine; DicConsole.WriteLineEvent += System.Console.WriteLine;
DicConsole.WriteEvent += System.Console.Write; DicConsole.WriteEvent += System.Console.Write;
@@ -80,137 +65,145 @@ namespace DiscImageChef
Settings.Settings.LoadSettings(); Settings.Settings.LoadSettings();
Core.Statistics.LoadStats(); Core.Statistics.LoadStats();
switch (invokedVerb) Parser.Default.ParseArguments<AnalyzeOptions, CompareOptions, ChecksumOptions, EntropyOptions, VerifyOptions, PrintHexOptions,
DecodeOptions, DeviceInfoOptions, MediaInfoOptions, MediaScanOptions, FormatsOptions, BenchmarkOptions, CreateSidecarOptions,
DumpMediaOptions, DeviceReportOptions, ConfigureOptions, StatsOptions>(args)
.WithParsed<AnalyzeOptions>(opts =>
{
if (opts.Debug)
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if (opts.Verbose)
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
Commands.Analyze.doAnalyze(opts);
})
.WithParsed<CompareOptions>(opts =>
{
if (opts.Debug)
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if (opts.Verbose)
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
Commands.Compare.doCompare(opts);
})
.WithParsed<ChecksumOptions>(opts =>
{ {
case "analyze": if (opts.Debug)
AnalyzeSubOptions AnalyzeOptions = (AnalyzeSubOptions)invokedVerbInstance; DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if (AnalyzeOptions.Debug) if (opts.Verbose)
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
if (AnalyzeOptions.Verbose) Commands.Checksum.doChecksum(opts);
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; })
Commands.Analyze.doAnalyze(AnalyzeOptions);
break; .WithParsed<EntropyOptions>(opts =>
case "compare": {
CompareSubOptions CompareOptions = (CompareSubOptions)invokedVerbInstance; if (opts.Debug)
if (CompareOptions.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; if (opts.Verbose)
if (CompareOptions.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; Commands.Entropy.doEntropy(opts);
Commands.Compare.doCompare(CompareOptions); })
break;
case "checksum": .WithParsed<VerifyOptions>(opts =>
ChecksumSubOptions ChecksumOptions = (ChecksumSubOptions)invokedVerbInstance; {
if (ChecksumOptions.Debug) if (opts.Debug)
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if (ChecksumOptions.Verbose) if (opts.Verbose)
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
Commands.Checksum.doChecksum(ChecksumOptions); Commands.Verify.doVerify(opts);
break; })
case "entropy":
EntropySubOptions entropyOptions = (EntropySubOptions)invokedVerbInstance; .WithParsed<PrintHexOptions>(opts =>
if (entropyOptions.Debug) {
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; if (opts.Debug)
if (entropyOptions.Verbose) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if (opts.Verbose)
Commands.Entropy.doEntropy(entropyOptions); DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
break; Commands.PrintHex.doPrintHex(opts);
case "verify": })
VerifySubOptions VerifyOptions = (VerifySubOptions)invokedVerbInstance;
if (VerifyOptions.Debug) .WithParsed<DecodeOptions>(opts =>
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; {
if (VerifyOptions.Verbose) if (opts.Debug)
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
Commands.Verify.doVerify(VerifyOptions); if (opts.Verbose)
break; DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
case "printhex": Commands.Decode.doDecode(opts);
PrintHexSubOptions PrintHexOptions = (PrintHexSubOptions)invokedVerbInstance; })
if (PrintHexOptions.Debug)
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; .WithParsed<DeviceInfoOptions>(opts =>
if (PrintHexOptions.Verbose) {
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if (opts.Debug)
Commands.PrintHex.doPrintHex(PrintHexOptions); DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
break; if (opts.Verbose)
case "decode": DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
DecodeSubOptions DecodeOptions = (DecodeSubOptions)invokedVerbInstance; Commands.DeviceInfo.doDeviceInfo(opts);
if (DecodeOptions.Debug) })
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if (DecodeOptions.Verbose) .WithParsed<MediaInfoOptions>(opts =>
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; {
Commands.Decode.doDecode(DecodeOptions); if (opts.Debug)
break; DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
case "formats": if (opts.Verbose)
FormatsSubOptions FormatsOptions = (FormatsSubOptions)invokedVerbInstance; DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
if (FormatsOptions.Debug) Commands.MediaInfo.doMediaInfo(opts);
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; })
if (FormatsOptions.Verbose)
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; .WithParsed<MediaScanOptions>(opts =>
Commands.Formats.ListFormats(FormatsOptions); {
break; if (opts.Debug)
case "device-info": DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
DeviceInfoSubOptions DeviceInfoOptions = (DeviceInfoSubOptions)invokedVerbInstance; if (opts.Verbose)
if (DeviceInfoOptions.Debug) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; Commands.MediaScan.doMediaScan(opts);
if (DeviceInfoOptions.Verbose) })
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
Commands.DeviceInfo.doDeviceInfo(DeviceInfoOptions); .WithParsed<FormatsOptions>(opts =>
break; {
case "media-info": if (opts.Debug)
MediaInfoSubOptions MediaInfoOptions = (MediaInfoSubOptions)invokedVerbInstance; DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if (MediaInfoOptions.Debug) if (opts.Verbose)
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
if (MediaInfoOptions.Verbose) Commands.Formats.ListFormats(opts);
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; })
Commands.MediaInfo.doMediaInfo(MediaInfoOptions);
break; .WithParsed<BenchmarkOptions>(opts =>
case "benchmark": {
BenchmarkSubOptions BenchmarkOptions = (BenchmarkSubOptions)invokedVerbInstance; if (opts.Debug)
if (BenchmarkOptions.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; if (opts.Verbose)
if (BenchmarkOptions.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; Commands.Benchmark.doBenchmark(opts);
Commands.Benchmark.doBenchmark(BenchmarkOptions); })
break;
case "create-sidecar": .WithParsed<CreateSidecarOptions>(opts =>
CreateSidecarSubOptions CreateSidecarOptions = (CreateSidecarSubOptions)invokedVerbInstance; {
if (CreateSidecarOptions.Debug) if (opts.Debug)
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if (CreateSidecarOptions.Verbose) if (opts.Verbose)
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
Commands.CreateSidecar.doSidecar(CreateSidecarOptions); Commands.CreateSidecar.doSidecar(opts);
break; })
case "media-scan":
MediaScanSubOptions MediaScanOptions = (MediaScanSubOptions)invokedVerbInstance; .WithParsed<DumpMediaOptions>(opts =>
if (MediaScanOptions.Debug) {
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; if (opts.Debug)
if (MediaScanOptions.Verbose) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if (opts.Verbose)
Commands.MediaScan.doMediaScan(MediaScanOptions); DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
break; Commands.DumpMedia.doDumpMedia(opts);
case "dump-media": })
DumpMediaSubOptions DumpMediaOptions = (DumpMediaSubOptions)invokedVerbInstance;
if (DumpMediaOptions.Debug) .WithParsed<DeviceReportOptions>(opts =>
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; {
if (DumpMediaOptions.Verbose) if (opts.Debug)
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
Commands.DumpMedia.doDumpMedia(DumpMediaOptions); if (opts.Verbose)
break; DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
case "device-report": Commands.DeviceReport.doDeviceReport(opts);
DeviceReportSubOptions DeviceReportOptions = (DeviceReportSubOptions)invokedVerbInstance; })
if (DeviceReportOptions.Debug)
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; .WithParsed<ConfigureOptions>(opts => { Commands.Configure.doConfigure();})
if (DeviceReportOptions.Verbose) .WithParsed<StatsOptions>(opts => { Commands.Statistics.showStats(); })
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; .WithNotParsed(errs => Environment.Exit(1));
Commands.DeviceReport.doDeviceReport(DeviceReportOptions);
break;
case "configure":
Commands.Configure.doConfigure ();
break;
case "stats":
Commands.Statistics.showStats ();
break;
default:
throw new ArgumentException("Should never arrive here!");
}
Core.Statistics.SaveStats(); Core.Statistics.SaveStats();
} }

View File

@@ -40,22 +40,23 @@ using CommandLine.Text;
namespace DiscImageChef namespace DiscImageChef
{ {
public abstract class CommonSubOptions public abstract class CommonOptions
{ {
[Option('v', "verbose", DefaultValue = false, HelpText = "Shows verbose output")] [Option('v', "verbose", Default = false, HelpText = "Shows verbose output")]
public bool Verbose { get; set; } public bool Verbose { get; set; }
[Option('d', "debug", DefaultValue = false, HelpText = "Shows debug output from plugins")] [Option('d', "debug", Default = false, HelpText = "Shows debug output from plugins")]
public bool Debug { get; set; } public bool Debug { get; set; }
} }
public class AnalyzeSubOptions : CommonSubOptions [Verb("analyze", HelpText = "Analyzes a disc image and searches for partitions and/or filesystems.")]
public class AnalyzeOptions : CommonOptions
{ {
[Option('p', "partitions", DefaultValue = true, [Option('p', "partitions", Default = true,
HelpText = "Searches and interprets partitions.")] HelpText = "Searches and interprets partitions.")]
public bool SearchForPartitions { get; set; } public bool SearchForPartitions { get; set; }
[Option('f', "filesystems", DefaultValue = true, [Option('f', "filesystems", Default = true,
HelpText = "Searches and interprets partitions.")] HelpText = "Searches and interprets partitions.")]
public bool SearchForFilesystems { get; set; } public bool SearchForFilesystems { get; set; }
@@ -63,7 +64,8 @@ namespace DiscImageChef
public string InputFile { get; set; } public string InputFile { get; set; }
} }
public class CompareSubOptions : CommonSubOptions [Verb("compare", HelpText = "Compares two disc images.")]
public class CompareOptions : CommonOptions
{ {
[Option("input1", Required = true, HelpText = "First disc image.")] [Option("input1", Required = true, HelpText = "First disc image.")]
public string InputFile1 { get; set; } public string InputFile1 { get; set; }
@@ -72,65 +74,66 @@ namespace DiscImageChef
public string InputFile2 { get; set; } public string InputFile2 { get; set; }
} }
public class ChecksumSubOptions : CommonSubOptions [Verb("checksum", HelpText = "Checksums an image.")]
public class ChecksumOptions : CommonOptions
{ {
[Option('t', "separated-tracks", DefaultValue = true, [Option('t', "separated-tracks", Default = true,
HelpText = "Checksums each track separately.")] HelpText = "Checksums each track separately.")]
public bool SeparatedTracks { get; set; } public bool SeparatedTracks { get; set; }
[Option('w', "whole-disc", DefaultValue = true, [Option('w', "whole-disc", Default = true,
HelpText = "Checksums the whole disc.")] HelpText = "Checksums the whole disc.")]
public bool WholeDisc { get; set; } public bool WholeDisc { get; set; }
[Option('a', "adler32", DefaultValue = true, [Option('a', "adler32", Default = true,
HelpText = "Calculates Adler-32.")] HelpText = "Calculates Adler-32.")]
public bool DoAdler32 { get; set; } public bool DoAdler32 { get; set; }
[Option("crc16", DefaultValue = true, [Option("crc16", Default = true,
HelpText = "Calculates CRC16.")] HelpText = "Calculates CRC16.")]
public bool DoCRC16 { get; set; } public bool DoCRC16 { get; set; }
[Option('c', "crc32", DefaultValue = true, [Option('c', "crc32", Default = true,
HelpText = "Calculates CRC32.")] HelpText = "Calculates CRC32.")]
public bool DoCRC32 { get; set; } public bool DoCRC32 { get; set; }
[Option("crc64", DefaultValue = false, [Option("crc64", Default = false,
HelpText = "Calculates CRC64 (ECMA).")] HelpText = "Calculates CRC64 (ECMA).")]
public bool DoCRC64 { get; set; } public bool DoCRC64 { get; set; }
/*[Option("fletcher16", DefaultValue = false, /*[Option("fletcher16", Default = false,
HelpText = "Calculates Fletcher-16.")] HelpText = "Calculates Fletcher-16.")]
public bool DoFletcher16 { get; set; } public bool DoFletcher16 { get; set; }
[Option("fletcher32", DefaultValue = false, [Option("fletcher32", Default = false,
HelpText = "Calculates Fletcher-32.")] HelpText = "Calculates Fletcher-32.")]
public bool DoFletcher32 { get; set; }*/ public bool DoFletcher32 { get; set; }*/
[Option('m', "md5", DefaultValue = true, [Option('m', "md5", Default = true,
HelpText = "Calculates MD5.")] HelpText = "Calculates MD5.")]
public bool DoMD5 { get; set; } public bool DoMD5 { get; set; }
[Option("ripemd160", DefaultValue = false, [Option("ripemd160", Default = false,
HelpText = "Calculates RIPEMD160.")] HelpText = "Calculates RIPEMD160.")]
public bool DoRIPEMD160 { get; set; } public bool DoRIPEMD160 { get; set; }
[Option('s', "sha1", DefaultValue = true, [Option('s', "sha1", Default = true,
HelpText = "Calculates SHA1.")] HelpText = "Calculates SHA1.")]
public bool DoSHA1 { get; set; } public bool DoSHA1 { get; set; }
[Option("sha256", DefaultValue = false, [Option("sha256", Default = false,
HelpText = "Calculates SHA256.")] HelpText = "Calculates SHA256.")]
public bool DoSHA256 { get; set; } public bool DoSHA256 { get; set; }
[Option("sha384", DefaultValue = false, [Option("sha384", Default = false,
HelpText = "Calculates SHA384.")] HelpText = "Calculates SHA384.")]
public bool DoSHA384 { get; set; } public bool DoSHA384 { get; set; }
[Option("sha512", DefaultValue = false, [Option("sha512", Default = false,
HelpText = "Calculates SHA512.")] HelpText = "Calculates SHA512.")]
public bool DoSHA512 { get; set; } public bool DoSHA512 { get; set; }
[Option('f', "spamsum", DefaultValue = true, [Option('f', "spamsum", Default = true,
HelpText = "Calculates SpamSum fuzzy hash.")] HelpText = "Calculates SpamSum fuzzy hash.")]
public bool DoSpamSum { get; set; } public bool DoSpamSum { get; set; }
@@ -138,17 +141,18 @@ namespace DiscImageChef
public string InputFile { get; set; } public string InputFile { get; set; }
} }
public class EntropySubOptions : CommonSubOptions [Verb("entropy", HelpText = "Calculates entropy and/or duplicated sectors of an image.")]
public class EntropyOptions : CommonOptions
{ {
[Option('p', "duplicated-sectors", DefaultValue = true, [Option('p', "duplicated-sectors", Default = true,
HelpText = "Calculates how many sectors are duplicated (have same exact data in user area).")] HelpText = "Calculates how many sectors are duplicated (have same exact data in user area).")]
public bool DuplicatedSectors { get; set; } public bool DuplicatedSectors { get; set; }
[Option('t', "separated-tracks", DefaultValue = true, [Option('t', "separated-tracks", Default = true,
HelpText = "Calculates entropy for each track separately.")] HelpText = "Calculates entropy for each track separately.")]
public bool SeparatedTracks { get; set; } public bool SeparatedTracks { get; set; }
[Option('w', "whole-disc", DefaultValue = true, [Option('w', "whole-disc", Default = true,
HelpText = "Calculates entropy for the whole disc.")] HelpText = "Calculates entropy for the whole disc.")]
public bool WholeDisc { get; set; } public bool WholeDisc { get; set; }
@@ -156,13 +160,14 @@ namespace DiscImageChef
public string InputFile { get; set; } public string InputFile { get; set; }
} }
public class VerifySubOptions : CommonSubOptions [Verb("verify", HelpText = "Verifies a disc image integrity, and if supported, sector integrity.")]
public class VerifyOptions : CommonOptions
{ {
[Option('w', "verify-disc", DefaultValue = true, [Option('w', "verify-disc", Default = true,
HelpText = "Verify disc image if supported.")] HelpText = "Verify disc image if supported.")]
public bool VerifyDisc { get; set; } public bool VerifyDisc { get; set; }
[Option('s', "verify-sectors", DefaultValue = true, [Option('s', "verify-sectors", Default = true,
HelpText = "Verify all sectors if supported.")] HelpText = "Verify all sectors if supported.")]
public bool VerifySectors { get; set; } public bool VerifySectors { get; set; }
@@ -170,21 +175,22 @@ namespace DiscImageChef
public string InputFile { get; set; } public string InputFile { get; set; }
} }
public class PrintHexSubOptions : CommonSubOptions [Verb("printhex", HelpText = "Prints a sector, in hexadecimal values, to the console.")]
public class PrintHexOptions : CommonOptions
{ {
[Option('s', "start", Required = true, [Option('s', "start", Required = true,
HelpText = "Start sector.")] HelpText = "Start sector.")]
public ulong StartSector { get; set; } public ulong StartSector { get; set; }
[Option('l', "length", DefaultValue = (ulong)1, [Option('l', "length", Default = (ulong)1,
HelpText = "How many sectors to print.")] HelpText = "How many sectors to print.")]
public ulong Length { get; set; } public ulong Length { get; set; }
[Option('r', "long-sectors", DefaultValue = false, [Option('r', "long-sectors", Default = false,
HelpText = "Print sectors with tags included.")] HelpText = "Print sectors with tags included.")]
public bool LongSectors { get; set; } public bool LongSectors { get; set; }
[Option('w', "width", DefaultValue = (ushort)32, [Option('w', "width", Default = (ushort)32,
HelpText = "How many bytes to print per line.")] HelpText = "How many bytes to print per line.")]
public ushort WidthBytes { get; set; } public ushort WidthBytes { get; set; }
@@ -192,21 +198,22 @@ namespace DiscImageChef
public string InputFile { get; set; } public string InputFile { get; set; }
} }
public class DecodeSubOptions : CommonSubOptions [Verb("decode", HelpText = "Decodes and pretty prints disk and/or sector tags.")]
public class DecodeOptions : CommonOptions
{ {
[Option('s', "start", DefaultValue = (ulong)0, [Option('s', "start", Default = (ulong)0,
HelpText = "Start sector.")] HelpText = "Start sector.")]
public ulong StartSector { get; set; } public ulong StartSector { get; set; }
[Option('l', "length", DefaultValue = "all", [Option('l', "length", Default = "all",
HelpText = "How many sectors to decode, or \"all\".")] HelpText = "How many sectors to decode, or \"all\".")]
public string Length { get; set; } public string Length { get; set; }
[Option('k', "disk-tags", DefaultValue = true, [Option('k', "disk-tags", Default = true,
HelpText = "Decode disk tags.")] HelpText = "Decode disk tags.")]
public bool DiskTags { get; set; } public bool DiskTags { get; set; }
[Option('t', "sector-tags", DefaultValue = true, [Option('t', "sector-tags", Default = true,
HelpText = "Decode sector tags.")] HelpText = "Decode sector tags.")]
public bool SectorTags { get; set; } public bool SectorTags { get; set; }
@@ -214,56 +221,63 @@ namespace DiscImageChef
public string InputFile { get; set; } public string InputFile { get; set; }
} }
public class DeviceInfoSubOptions : CommonSubOptions [Verb("device-info", HelpText = "Gets information about a device.")]
public class DeviceInfoOptions : CommonOptions
{ {
[Option('i', "device", Required = true, HelpText = "Device path.")] [Option('i', "device", Required = true, HelpText = "Device path.")]
public string DevicePath { get; set; } public string DevicePath { get; set; }
[Option('w', "output-prefix", Required = false, DefaultValue = "", HelpText = "Write binary responses from device with that prefix.")] [Option('w', "output-prefix", Required = false, Default = "", HelpText = "Write binary responses from device with that prefix.")]
public string OutputPrefix { get; set; } public string OutputPrefix { get; set; }
} }
public class MediaInfoSubOptions : CommonSubOptions [Verb("media-info", HelpText = "Gets information about the media inserted on a device.")]
public class MediaInfoOptions : CommonOptions
{ {
[Option('i', "device", Required = true, HelpText = "Device path.")] [Option('i', "device", Required = true, HelpText = "Device path.")]
public string DevicePath { get; set; } public string DevicePath { get; set; }
[Option('w', "output-prefix", Required = false, DefaultValue = "", HelpText = "Write binary responses from device with that prefix.")] [Option('w', "output-prefix", Required = false, Default = "", HelpText = "Write binary responses from device with that prefix.")]
public string OutputPrefix { get; set; } public string OutputPrefix { get; set; }
} }
public class MediaScanSubOptions : CommonSubOptions [Verb("media-scan", HelpText = "Scans the media inserted on a device.")]
public class MediaScanOptions : CommonOptions
{ {
[Option('i', "device", Required = true, HelpText = "Device path.")] [Option('i', "device", Required = true, HelpText = "Device path.")]
public string DevicePath { get; set; } public string DevicePath { get; set; }
[Option('m', "mhdd-log", Required = false, DefaultValue = "", HelpText = "Write a log of the scan in the format used by MHDD.")] [Option('m', "mhdd-log", Required = false, Default = "", HelpText = "Write a log of the scan in the format used by MHDD.")]
public string MHDDLogPath { get; set; } public string MHDDLogPath { get; set; }
[Option('b', "ibg-log", Required = false, DefaultValue = "", HelpText = "Write a log of the scan in the format used by ImgBurn.")] [Option('b', "ibg-log", Required = false, Default = "", HelpText = "Write a log of the scan in the format used by ImgBurn.")]
public string IBGLogPath { get; set; } public string IBGLogPath { get; set; }
} }
public class FormatsSubOptions : CommonSubOptions [Verb("formats", HelpText = "Lists all supported disc images, partition schemes and file systems.")]
public class FormatsOptions : CommonOptions
{ {
} }
public class BenchmarkSubOptions : CommonSubOptions [Verb("benchmark", HelpText = "Benchmarks hashing and entropy calculation.")]
public class BenchmarkOptions : CommonOptions
{ {
[Option('b', "block-size", Required = false, DefaultValue = (int)512, HelpText = "Block size.")] [Option('b', "block-size", Required = false, Default = (int)512, HelpText = "Block size.")]
public int BlockSize { get; set; } public int BlockSize { get; set; }
[Option('s', "buffer-size", Required = false, DefaultValue = (int)128, HelpText = "Buffer size in mebibytes.")] [Option('s', "buffer-size", Required = false, Default = (int)128, HelpText = "Buffer size in mebibytes.")]
public int BufferSize { get; set; } public int BufferSize { get; set; }
} }
public class CreateSidecarSubOptions : CommonSubOptions [Verb("create-sidecar", HelpText = "Creates CICM Metadata XML sidecar.")]
public class CreateSidecarOptions : CommonOptions
{ {
[Option('i', "input", Required = true, HelpText = "Disc image.")] [Option('i', "input", Required = true, HelpText = "Disc image.")]
public string InputFile { get; set; } public string InputFile { get; set; }
} }
public class DumpMediaSubOptions : CommonSubOptions [Verb("dump-media", HelpText = "Dumps the media inserted on a device to a media image.")]
public class DumpMediaOptions : CommonOptions
{ {
[Option('i', "device", Required = true, HelpText = "Device path.")] [Option('i', "device", Required = true, HelpText = "Device path.")]
public string DevicePath { get; set; } public string DevicePath { get; set; }
@@ -271,122 +285,43 @@ namespace DiscImageChef
[Option('w', "output-prefix", Required = true, HelpText = "Prefix for media dump.")] [Option('w', "output-prefix", Required = true, HelpText = "Prefix for media dump.")]
public string OutputPrefix { get; set; } public string OutputPrefix { get; set; }
[Option('r', "raw", DefaultValue = false, [Option('r', "raw", Default = false,
HelpText = "Print sectors with tags included.")] HelpText = "Print sectors with tags included.")]
public bool Raw { get; set; } public bool Raw { get; set; }
[Option('s', "stop-on-error", DefaultValue = false, [Option('s', "stop-on-error", Default = false,
HelpText = "Stop media dump on first error.")] HelpText = "Stop media dump on first error.")]
public bool StopOnError { get; set; } public bool StopOnError { get; set; }
[Option('f', "force", DefaultValue = false, [Option('f', "force", Default = false,
HelpText = "Continue dump whatever happens.")] HelpText = "Continue dump whatever happens.")]
public bool Force { get; set; } public bool Force { get; set; }
[Option('p', "retry-passes", DefaultValue = (ushort)5, [Option('p', "retry-passes", Default = (ushort)5,
HelpText = "How many retry passes to do.")] HelpText = "How many retry passes to do.")]
public ushort RetryPasses { get; set; } public ushort RetryPasses { get; set; }
[Option("persistent", DefaultValue = false, [Option("persistent", Default = false,
HelpText = "Try to recover partial or incorrect data.")] HelpText = "Try to recover partial or incorrect data.")]
public bool Persistent { get; set; } public bool Persistent { get; set; }
} }
public class DeviceReportSubOptions : CommonSubOptions [Verb("device-report", HelpText = "Tests the device capabilities and creates an XML report of them.")]
public class DeviceReportOptions : CommonOptions
{ {
[Option('i', "device", Required = true, HelpText = "Device path.")] [Option('i', "device", Required = true, HelpText = "Device path.")]
public string DevicePath { get; set; } public string DevicePath { get; set; }
} }
public class ConfigureSubOptions : CommonSubOptions [Verb("configure", HelpText = "Configures user settings and statistics.")]
public class ConfigureOptions
{ {
} }
public class StatsSubOptions : CommonSubOptions [Verb("stats", HelpText = "Shows statistics.")]
public class StatsOptions
{ {
} }
public class Options
{
public Options()
{
AnalyzeVerb = new AnalyzeSubOptions();
CompareVerb = new CompareSubOptions();
ChecksumVerb = new ChecksumSubOptions();
EntropyVerb = new EntropySubOptions();
VerifyVerb = new VerifySubOptions();
FormatsVerb = new FormatsSubOptions();
PrintHexVerb = new PrintHexSubOptions();
DecodeVerb = new DecodeSubOptions();
DeviceInfoVerb = new DeviceInfoSubOptions();
MediaInfoVerb = new MediaInfoSubOptions();
BenchmarkVerb = new BenchmarkSubOptions();
CreateSidecarVerb = new CreateSidecarSubOptions();
MediaScanVerb = new MediaScanSubOptions();
DumpMediaVerb = new DumpMediaSubOptions();
DeviceReportVerb = new DeviceReportSubOptions();
ConfigureVerb = new ConfigureSubOptions();
StatsVerb = new StatsSubOptions();
}
[VerbOption("analyze", HelpText = "Analyzes a disc image and searches for partitions and/or filesystems.")]
public AnalyzeSubOptions AnalyzeVerb { get; set; }
[VerbOption("compare", HelpText = "Compares two disc images.")]
public CompareSubOptions CompareVerb { get; set; }
[VerbOption("checksum", HelpText = "Checksums an image.")]
public ChecksumSubOptions ChecksumVerb { get; set; }
[VerbOption("entropy", HelpText = "Calculates entropy and/or duplicated sectors of an image.")]
public EntropySubOptions EntropyVerb { get; set; }
[VerbOption("verify", HelpText = "Verifies a disc image integrity, and if supported, sector integrity.")]
public VerifySubOptions VerifyVerb { get; set; }
[VerbOption("printhex", HelpText = "Prints a sector, in hexadecimal values, to the console.")]
public PrintHexSubOptions PrintHexVerb { get; set; }
[VerbOption("decode", HelpText = "Decodes and pretty prints disk and/or sector tags.")]
public DecodeSubOptions DecodeVerb { get; set; }
[VerbOption("formats", HelpText = "Lists all supported disc images, partition schemes and file systems.")]
public FormatsSubOptions FormatsVerb { get; set; }
[VerbOption("device-info", HelpText = "Gets information about a device.")]
public DeviceInfoSubOptions DeviceInfoVerb { get; set; }
[VerbOption("media-info", HelpText = "Gets information about the media inserted on a device.")]
public MediaInfoSubOptions MediaInfoVerb { get; set; }
[VerbOption("benchmark", HelpText = "Benchmarks hashing and entropy calculation.")]
public BenchmarkSubOptions BenchmarkVerb { get; set; }
[VerbOption("create-sidecar", HelpText = "Creates CICM Metadata XML sidecar.")]
public CreateSidecarSubOptions CreateSidecarVerb { get; set; }
[VerbOption("media-scan", HelpText = "Scans the media inserted on a device.")]
public MediaScanSubOptions MediaScanVerb { get; set; }
[VerbOption("dump-media", HelpText = "Dumps the media inserted on a device to a media image.")]
public DumpMediaSubOptions DumpMediaVerb { get; set; }
[VerbOption("device-report", HelpText = "Tests the device capabilities and creates an XML report of them.")]
public DeviceReportSubOptions DeviceReportVerb { get; set; }
[VerbOption("configure", HelpText = "Configures user settings and statistics.")]
public ConfigureSubOptions ConfigureVerb { get; set; }
[VerbOption("stats", HelpText = "Shows statistics.")]
public StatsSubOptions StatsVerb { get; set; }
[HelpVerbOption]
public string DoHelpForVerb(string verbName)
{
return HelpText.AutoBuild(this, verbName);
}
}
} }

1
commandline Submodule

Submodule commandline added at 143edf1226