mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
* 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:
@@ -40,22 +40,23 @@ using CommandLine.Text;
|
||||
|
||||
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; }
|
||||
|
||||
[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 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.")]
|
||||
public bool SearchForPartitions { get; set; }
|
||||
|
||||
[Option('f', "filesystems", DefaultValue = true,
|
||||
[Option('f', "filesystems", Default = true,
|
||||
HelpText = "Searches and interprets partitions.")]
|
||||
public bool SearchForFilesystems { get; set; }
|
||||
|
||||
@@ -63,7 +64,8 @@ namespace DiscImageChef
|
||||
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.")]
|
||||
public string InputFile1 { get; set; }
|
||||
@@ -72,65 +74,66 @@ namespace DiscImageChef
|
||||
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.")]
|
||||
public bool SeparatedTracks { get; set; }
|
||||
|
||||
[Option('w', "whole-disc", DefaultValue = true,
|
||||
[Option('w', "whole-disc", Default = true,
|
||||
HelpText = "Checksums the whole disc.")]
|
||||
public bool WholeDisc { get; set; }
|
||||
|
||||
[Option('a', "adler32", DefaultValue = true,
|
||||
[Option('a', "adler32", Default = true,
|
||||
HelpText = "Calculates Adler-32.")]
|
||||
public bool DoAdler32 { get; set; }
|
||||
|
||||
[Option("crc16", DefaultValue = true,
|
||||
[Option("crc16", Default = true,
|
||||
HelpText = "Calculates CRC16.")]
|
||||
public bool DoCRC16 { get; set; }
|
||||
|
||||
[Option('c', "crc32", DefaultValue = true,
|
||||
[Option('c', "crc32", Default = true,
|
||||
HelpText = "Calculates CRC32.")]
|
||||
public bool DoCRC32 { get; set; }
|
||||
|
||||
[Option("crc64", DefaultValue = false,
|
||||
[Option("crc64", Default = false,
|
||||
HelpText = "Calculates CRC64 (ECMA).")]
|
||||
public bool DoCRC64 { get; set; }
|
||||
|
||||
/*[Option("fletcher16", DefaultValue = false,
|
||||
/*[Option("fletcher16", Default = false,
|
||||
HelpText = "Calculates Fletcher-16.")]
|
||||
public bool DoFletcher16 { get; set; }
|
||||
|
||||
[Option("fletcher32", DefaultValue = false,
|
||||
[Option("fletcher32", Default = false,
|
||||
HelpText = "Calculates Fletcher-32.")]
|
||||
public bool DoFletcher32 { get; set; }*/
|
||||
|
||||
[Option('m', "md5", DefaultValue = true,
|
||||
[Option('m', "md5", Default = true,
|
||||
HelpText = "Calculates MD5.")]
|
||||
public bool DoMD5 { get; set; }
|
||||
|
||||
[Option("ripemd160", DefaultValue = false,
|
||||
[Option("ripemd160", Default = false,
|
||||
HelpText = "Calculates RIPEMD160.")]
|
||||
public bool DoRIPEMD160 { get; set; }
|
||||
|
||||
[Option('s', "sha1", DefaultValue = true,
|
||||
[Option('s', "sha1", Default = true,
|
||||
HelpText = "Calculates SHA1.")]
|
||||
public bool DoSHA1 { get; set; }
|
||||
|
||||
[Option("sha256", DefaultValue = false,
|
||||
[Option("sha256", Default = false,
|
||||
HelpText = "Calculates SHA256.")]
|
||||
public bool DoSHA256 { get; set; }
|
||||
|
||||
[Option("sha384", DefaultValue = false,
|
||||
[Option("sha384", Default = false,
|
||||
HelpText = "Calculates SHA384.")]
|
||||
public bool DoSHA384 { get; set; }
|
||||
|
||||
[Option("sha512", DefaultValue = false,
|
||||
[Option("sha512", Default = false,
|
||||
HelpText = "Calculates SHA512.")]
|
||||
public bool DoSHA512 { get; set; }
|
||||
|
||||
[Option('f', "spamsum", DefaultValue = true,
|
||||
[Option('f', "spamsum", Default = true,
|
||||
HelpText = "Calculates SpamSum fuzzy hash.")]
|
||||
public bool DoSpamSum { get; set; }
|
||||
|
||||
@@ -138,17 +141,18 @@ namespace DiscImageChef
|
||||
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).")]
|
||||
public bool DuplicatedSectors { get; set; }
|
||||
|
||||
[Option('t', "separated-tracks", DefaultValue = true,
|
||||
[Option('t', "separated-tracks", Default = true,
|
||||
HelpText = "Calculates entropy for each track separately.")]
|
||||
public bool SeparatedTracks { get; set; }
|
||||
|
||||
[Option('w', "whole-disc", DefaultValue = true,
|
||||
[Option('w', "whole-disc", Default = true,
|
||||
HelpText = "Calculates entropy for the whole disc.")]
|
||||
public bool WholeDisc { get; set; }
|
||||
|
||||
@@ -156,13 +160,14 @@ namespace DiscImageChef
|
||||
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.")]
|
||||
public bool VerifyDisc { get; set; }
|
||||
|
||||
[Option('s', "verify-sectors", DefaultValue = true,
|
||||
[Option('s', "verify-sectors", Default = true,
|
||||
HelpText = "Verify all sectors if supported.")]
|
||||
public bool VerifySectors { get; set; }
|
||||
|
||||
@@ -170,21 +175,22 @@ namespace DiscImageChef
|
||||
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,
|
||||
HelpText = "Start sector.")]
|
||||
public ulong StartSector { get; set; }
|
||||
|
||||
[Option('l', "length", DefaultValue = (ulong)1,
|
||||
[Option('l', "length", Default = (ulong)1,
|
||||
HelpText = "How many sectors to print.")]
|
||||
public ulong Length { get; set; }
|
||||
|
||||
[Option('r', "long-sectors", DefaultValue = false,
|
||||
[Option('r', "long-sectors", Default = false,
|
||||
HelpText = "Print sectors with tags included.")]
|
||||
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.")]
|
||||
public ushort WidthBytes { get; set; }
|
||||
|
||||
@@ -192,21 +198,22 @@ namespace DiscImageChef
|
||||
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.")]
|
||||
public ulong StartSector { get; set; }
|
||||
|
||||
[Option('l', "length", DefaultValue = "all",
|
||||
[Option('l', "length", Default = "all",
|
||||
HelpText = "How many sectors to decode, or \"all\".")]
|
||||
public string Length { get; set; }
|
||||
|
||||
[Option('k', "disk-tags", DefaultValue = true,
|
||||
[Option('k', "disk-tags", Default = true,
|
||||
HelpText = "Decode disk tags.")]
|
||||
public bool DiskTags { get; set; }
|
||||
|
||||
[Option('t', "sector-tags", DefaultValue = true,
|
||||
[Option('t', "sector-tags", Default = true,
|
||||
HelpText = "Decode sector tags.")]
|
||||
public bool SectorTags { get; set; }
|
||||
|
||||
@@ -214,56 +221,63 @@ namespace DiscImageChef
|
||||
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.")]
|
||||
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 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.")]
|
||||
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 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.")]
|
||||
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; }
|
||||
|
||||
[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 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; }
|
||||
|
||||
[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 class CreateSidecarSubOptions : CommonSubOptions
|
||||
[Verb("create-sidecar", HelpText = "Creates CICM Metadata XML sidecar.")]
|
||||
public class CreateSidecarOptions : CommonOptions
|
||||
{
|
||||
[Option('i', "input", Required = true, HelpText = "Disc image.")]
|
||||
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.")]
|
||||
public string DevicePath { get; set; }
|
||||
@@ -271,122 +285,43 @@ namespace DiscImageChef
|
||||
[Option('w', "output-prefix", Required = true, HelpText = "Prefix for media dump.")]
|
||||
public string OutputPrefix { get; set; }
|
||||
|
||||
[Option('r', "raw", DefaultValue = false,
|
||||
[Option('r', "raw", Default = false,
|
||||
HelpText = "Print sectors with tags included.")]
|
||||
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.")]
|
||||
public bool StopOnError { get; set; }
|
||||
|
||||
[Option('f', "force", DefaultValue = false,
|
||||
[Option('f', "force", Default = false,
|
||||
HelpText = "Continue dump whatever happens.")]
|
||||
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.")]
|
||||
public ushort RetryPasses { get; set; }
|
||||
|
||||
[Option("persistent", DefaultValue = false,
|
||||
[Option("persistent", Default = false,
|
||||
HelpText = "Try to recover partial or incorrect data.")]
|
||||
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.")]
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user