Add support to show available options from IReadOnlyFilesystems.

This commit is contained in:
2017-12-28 00:29:04 +00:00
parent a1f82e0e72
commit 1bb2d16e54
14 changed files with 269 additions and 152 deletions

View File

@@ -32,6 +32,7 @@
<e p="Formats.cs" t="Include" /> <e p="Formats.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="Ls.cs" t="Include" /> <e p="Ls.cs" t="Include" />
<e p="MediaInfo.cs" t="Include" /> <e p="MediaInfo.cs" t="Include" />
<e p="MediaScan.cs" t="Include" /> <e p="MediaScan.cs" t="Include" />

View File

@@ -57,6 +57,11 @@ namespace DiscImageChef.Filesystems.AppleDOS
public string Name => "Apple DOS File System"; public string Name => "Apple DOS File System";
public Guid Id => new Guid("8658A1E9-B2E7-4BCC-9638-157A31B0A700\n"); public Guid Id => new Guid("8658A1E9-B2E7-4BCC-9638-157A31B0A700\n");
public (string name, Type type, string description)[] ListOptions()
{
return new(string name, Type type, string description)[] { };
}
static Dictionary<string, string> GetDefaultOptions() static Dictionary<string, string> GetDefaultOptions()
{ {
return new Dictionary<string, string> {{"debug", false.ToString()}}; return new Dictionary<string, string> {{"debug", false.ToString()}};
@@ -70,17 +75,17 @@ namespace DiscImageChef.Filesystems.AppleDOS
/// <summary>Caches catalog</summary> /// <summary>Caches catalog</summary>
Dictionary<string, ushort> catalogCache; Dictionary<string, ushort> catalogCache;
/// <summary>Caches file size</summary> /// <summary>Caches file size</summary>
Dictionary<string, int> fileSizeCache; Dictionary<string, int> fileSizeCache;
/// <summary>Caches VTOC</summary> /// <summary>Caches VTOC</summary>
byte[] vtocBlocks; byte[] vtocBlocks;
/// <summary>Caches catalog</summary> /// <summary>Caches catalog</summary>
byte[] catalogBlocks; byte[] catalogBlocks;
/// <summary>Caches boot code</summary> /// <summary>Caches boot code</summary>
byte[] bootBlocks; byte[] bootBlocks;
/// <summary>Caches file type</summary> /// <summary>Caches file type</summary>
Dictionary<string, byte> fileTypeCache; Dictionary<string, byte> fileTypeCache;
/// <summary>Caches locked files</summary> /// <summary>Caches locked files</summary>
List<string> lockedFiles; List<string> lockedFiles;
#endregion Caches #endregion Caches
} }
} }

View File

@@ -71,5 +71,11 @@ namespace DiscImageChef.Filesystems.AppleMFS
{ {
return new Dictionary<string, string> {{"debug", false.ToString()}}; return new Dictionary<string, string> {{"debug", false.ToString()}};
} }
// TODO: Implement Finder namespace (requires decoding Desktop database)
public (string name, Type type, string description)[] ListOptions()
{
return new(string name, Type type, string description)[] { };
}
} }
} }

View File

@@ -117,6 +117,11 @@ namespace DiscImageChef.Filesystems.CPM
public string Name => "CP/M File System"; public string Name => "CP/M File System";
public Guid Id => new Guid("AA2B8585-41DF-4E3B-8A35-D1A935E2F8A1"); public Guid Id => new Guid("AA2B8585-41DF-4E3B-8A35-D1A935E2F8A1");
public (string name, Type type, string description)[] ListOptions()
{
return new(string name, Type type, string description)[] { };
}
static Dictionary<string, string> GetDefaultOptions() static Dictionary<string, string> GetDefaultOptions()
{ {
return new Dictionary<string, string> {{"debug", false.ToString()}}; return new Dictionary<string, string> {{"debug", false.ToString()}};

View File

@@ -35,6 +35,9 @@
<HintPath>..\packages\Claunia.Encoding.1.4.0\lib\portable40-net40+sl5+win8+wp8\Claunia.Encoding.dll</HintPath> <HintPath>..\packages\Claunia.Encoding.1.4.0\lib\portable40-net40+sl5+win8+wp8\Claunia.Encoding.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
<HintPath>..\packages\System.ValueTuple.4.4.0\lib\portable-net40+sl4+win8+wp8\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -31,6 +31,7 @@
// Copyright © 2011-2018 Natalia Portillo // Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/ // ****************************************************************************/
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using DiscImageChef.CommonTypes; using DiscImageChef.CommonTypes;
@@ -129,5 +130,10 @@ namespace DiscImageChef.Filesystems
/// <param name="path">Link path.</param> /// <param name="path">Link path.</param>
/// <param name="dest">Link destination.</param> /// <param name="dest">Link destination.</param>
Errno ReadLink(string path, out string dest); Errno ReadLink(string path, out string dest);
/// <summary>
/// Retrieves a list of options supported by the filesystem, with name, type and description
/// </summary>
(string name, Type type, string description)[] ListOptions();
} }
} }

View File

@@ -56,6 +56,12 @@ namespace DiscImageChef.Filesystems.LisaFS
public Encoding Encoding { get; private set; } public Encoding Encoding { get; private set; }
public FileSystemType XmlFsType { get; private set; } public FileSystemType XmlFsType { get; private set; }
// TODO: Implement Lisa 7/7 namespace (needs decoding {!CATALOG} file)
public (string name, Type type, string description)[] ListOptions()
{
return new(string name, Type type, string description)[] { };
}
static Dictionary<string, string> GetDefaultOptions() static Dictionary<string, string> GetDefaultOptions()
{ {
return new Dictionary<string, string> {{"debug", false.ToString()}}; return new Dictionary<string, string> {{"debug", false.ToString()}};
@@ -65,17 +71,17 @@ namespace DiscImageChef.Filesystems.LisaFS
/// <summary>Caches Extents Files</summary> /// <summary>Caches Extents Files</summary>
Dictionary<short, ExtentFile> extentCache; Dictionary<short, ExtentFile> extentCache;
/// <summary>Caches system files</summary> /// <summary>Caches system files</summary>
Dictionary<short, byte[]> systemFileCache; Dictionary<short, byte[]> systemFileCache;
/// <summary>Caches user files files</summary> /// <summary>Caches user files files</summary>
Dictionary<short, byte[]> fileCache; Dictionary<short, byte[]> fileCache;
/// <summary>Caches catalogs</summary> /// <summary>Caches catalogs</summary>
List<CatalogEntry> catalogCache; List<CatalogEntry> catalogCache;
/// <summary>Caches file size</summary> /// <summary>Caches file size</summary>
Dictionary<short, int> fileSizeCache; Dictionary<short, int> fileSizeCache;
/// <summary>Lists Extents Files already printed in debug mode to not repeat them</summary> /// <summary>Lists Extents Files already printed in debug mode to not repeat them</summary>
List<short> printedExtents; List<short> printedExtents;
/// <summary>Caches the creation times for subdirectories as to not have to traverse the Catalog File on each stat</summary> /// <summary>Caches the creation times for subdirectories as to not have to traverse the Catalog File on each stat</summary>
Dictionary<short, DateTime> directoryDtcCache; Dictionary<short, DateTime> directoryDtcCache;
#endregion Caches #endregion Caches
} }
} }

View File

@@ -73,6 +73,11 @@ namespace DiscImageChef.Filesystems.UCSDPascal
return Errno.NotSupported; return Errno.NotSupported;
} }
public (string name, Type type, string description)[] ListOptions()
{
return new(string name, Type type, string description)[] { };
}
static Dictionary<string, string> GetDefaultOptions() static Dictionary<string, string> GetDefaultOptions()
{ {
return new Dictionary<string, string> {{"debug", false.ToString()}}; return new Dictionary<string, string> {{"debug", false.ToString()}};

View File

@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Claunia.Encoding" version="1.4.0" targetFramework="net40" /> <package id="Claunia.Encoding" version="1.4.0" targetFramework="net40" />
<package id="System.ValueTuple" version="4.4.0" targetFramework="net40" />
</packages> </packages>

View File

@@ -0,0 +1,61 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : ListOptions.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Verbs.
//
// --[ Description ] ----------------------------------------------------------
//
// Lists all options supported by read-only filesystems.
//
// --[ 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.Collections.Generic;
using System.Linq;
using DiscImageChef.Console;
using DiscImageChef.Core;
using DiscImageChef.Filesystems;
namespace DiscImageChef.Commands
{
static class ListOptions
{
internal static void DoList()
{
PluginBase plugins = new PluginBase();
foreach(KeyValuePair<string, IReadOnlyFilesystem> kvp in plugins.ReadOnlyFilesystems)
{
List<(string name, Type type, string description)> options = kvp.Value.ListOptions().ToList();
options.Add(("debug", typeof(bool), "Enables debug features if available"));
DicConsole.WriteLine("Options for {0}:", kvp.Value.Name);
DicConsole.WriteLine("{0,-16} {1,-16} {2,-8}", "Name", "Type", "Description");
foreach((string name, Type type, string description) option in options.OrderBy(t => t.name))
DicConsole.WriteLine("{0,-16} {1,-16} {2,-8}", option.name, option.type, option.description);
DicConsole.WriteLine();
}
}
}
}

View File

@@ -45,9 +45,13 @@
<Reference Include="CommandLine"> <Reference Include="CommandLine">
<HintPath>..\packages\CommandLineParser.2.1.1-beta\lib\net40\CommandLine.dll</HintPath> <HintPath>..\packages\CommandLineParser.2.1.1-beta\lib\net40\CommandLine.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
<HintPath>..\packages\System.ValueTuple.4.4.0\lib\portable-net40+sl4+win8+wp8\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Commands\ListOptions.cs" />
<Compile Include="Main.cs" /> <Compile Include="Main.cs" />
<Compile Include="AssemblyInfo.cs" /> <Compile Include="AssemblyInfo.cs" />
<Compile Include="Options.cs" /> <Compile Include="Options.cs" />

View File

@@ -43,8 +43,8 @@ namespace DiscImageChef
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
DicConsole.WriteLineEvent += System.Console.WriteLine; DicConsole.WriteLineEvent += System.Console.WriteLine;
DicConsole.WriteEvent += System.Console.Write; DicConsole.WriteEvent += System.Console.Write;
DicConsole.ErrorWriteLineEvent += System.Console.Error.WriteLine; DicConsole.ErrorWriteLineEvent += System.Console.Error.WriteLine;
Settings.Settings.LoadSettings(); Settings.Settings.LoadSettings();
@@ -58,143 +58,152 @@ namespace DiscImageChef
typeof(CreateSidecarOptions), typeof(DumpMediaOptions), typeof(CreateSidecarOptions), typeof(DumpMediaOptions),
typeof(DeviceReportOptions), typeof(ConfigureOptions), typeof(StatsOptions), typeof(DeviceReportOptions), typeof(ConfigureOptions), typeof(StatsOptions),
typeof(LsOptions), typeof(ExtractFilesOptions), typeof(ListDevicesOptions), typeof(LsOptions), typeof(ExtractFilesOptions), typeof(ListDevicesOptions),
typeof(ListEncodingsOptions)).WithParsed<AnalyzeOptions>(opts => typeof(ListEncodingsOptions), typeof(ListOptionsOptions))
{ .WithParsed<AnalyzeOptions>(opts =>
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; {
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
PrintCopyright(); if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
Analyze.DoAnalyze(opts); PrintCopyright();
}).WithParsed<CompareOptions>(opts => Analyze.DoAnalyze(opts);
{ }).WithParsed<CompareOptions>(opts =>
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; {
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
PrintCopyright(); if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
Compare.DoCompare(opts); PrintCopyright();
}).WithParsed<ChecksumOptions>(opts => Compare.DoCompare(opts);
{ }).WithParsed<ChecksumOptions>(opts =>
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; {
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
PrintCopyright(); if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
Checksum.DoChecksum(opts); PrintCopyright();
}).WithParsed<EntropyOptions>(opts => Checksum.DoChecksum(opts);
{ }).WithParsed<EntropyOptions>(opts =>
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; {
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
PrintCopyright(); if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
Entropy.DoEntropy(opts); PrintCopyright();
}).WithParsed<VerifyOptions>(opts => Entropy.DoEntropy(opts);
{ }).WithParsed<VerifyOptions>(opts =>
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; {
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
PrintCopyright(); if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
Verify.DoVerify(opts); PrintCopyright();
}).WithParsed<PrintHexOptions>(opts => Verify.DoVerify(opts);
{ }).WithParsed<PrintHexOptions>(opts =>
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; {
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
PrintCopyright(); if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
Commands.PrintHex.DoPrintHex(opts); PrintCopyright();
}).WithParsed<DecodeOptions>(opts => Commands.PrintHex.DoPrintHex(opts);
{ }).WithParsed<DecodeOptions>(opts =>
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; {
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
PrintCopyright(); if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
Decode.DoDecode(opts); PrintCopyright();
}).WithParsed<DeviceInfoOptions>(opts => Decode.DoDecode(opts);
{ }).WithParsed<DeviceInfoOptions>(opts =>
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; {
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
PrintCopyright(); if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
DeviceInfo.DoDeviceInfo(opts); PrintCopyright();
}).WithParsed<MediaInfoOptions>(opts => DeviceInfo.DoDeviceInfo(opts);
{ }).WithParsed<MediaInfoOptions>(opts =>
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; {
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
PrintCopyright(); if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
MediaInfo.DoMediaInfo(opts); PrintCopyright();
}).WithParsed<MediaScanOptions>(opts => MediaInfo.DoMediaInfo(opts);
{ }).WithParsed<MediaScanOptions>(opts =>
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; {
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
PrintCopyright(); if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
MediaScan.DoMediaScan(opts); PrintCopyright();
}).WithParsed<FormatsOptions>(opts => MediaScan.DoMediaScan(opts);
{ }).WithParsed<FormatsOptions>(opts =>
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; {
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
PrintCopyright(); if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
Formats.ListFormats(opts); PrintCopyright();
}).WithParsed<BenchmarkOptions>(opts => Formats.ListFormats(opts);
{ }).WithParsed<BenchmarkOptions>(opts =>
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; {
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
PrintCopyright(); if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
Benchmark.DoBenchmark(opts); PrintCopyright();
}).WithParsed<CreateSidecarOptions>(opts => Benchmark.DoBenchmark(opts);
{ }).WithParsed<CreateSidecarOptions>(opts =>
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; {
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
PrintCopyright(); if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
CreateSidecar.DoSidecar(opts); PrintCopyright();
}).WithParsed<DumpMediaOptions>(opts => CreateSidecar.DoSidecar(opts);
{ }).WithParsed<DumpMediaOptions>(opts =>
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; {
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
PrintCopyright(); if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
DumpMedia.DoDumpMedia(opts); PrintCopyright();
}).WithParsed<DeviceReportOptions>(opts => DumpMedia.DoDumpMedia(opts);
{ }).WithParsed<DeviceReportOptions>(opts =>
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; {
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
PrintCopyright(); if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
DeviceReport.DoDeviceReport(opts); PrintCopyright();
}).WithParsed<LsOptions>(opts => DeviceReport.DoDeviceReport(opts);
{ }).WithParsed<LsOptions>(opts =>
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; {
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
PrintCopyright(); if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
Ls.DoLs(opts); PrintCopyright();
}).WithParsed<ExtractFilesOptions>(opts => Ls.DoLs(opts);
{ }).WithParsed<ExtractFilesOptions>(opts =>
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; {
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
PrintCopyright(); if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
ExtractFiles.DoExtractFiles(opts); PrintCopyright();
}).WithParsed<ListDevicesOptions>(opts => ExtractFiles.DoExtractFiles(opts);
{ }).WithParsed<ListDevicesOptions>(opts =>
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; {
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
PrintCopyright(); if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
ListDevices.DoListDevices(opts); PrintCopyright();
}).WithParsed<ListEncodingsOptions>(opts => ListDevices.DoListDevices(opts);
{ }).WithParsed<ListEncodingsOptions>(opts =>
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; {
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
PrintCopyright(); if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
ListEncodings.DoList(); PrintCopyright();
}).WithParsed<ConfigureOptions>(opts => ListEncodings.DoList();
{ }).WithParsed<ListOptionsOptions>(opts =>
PrintCopyright(); {
Configure.DoConfigure(); if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
}).WithParsed<StatsOptions>(opts => if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
{ PrintCopyright();
PrintCopyright(); ListOptions.DoList();
Commands.Statistics.ShowStats(); }).WithParsed<ConfigureOptions>(opts =>
}).WithNotParsed(errs => Environment.Exit(1)); {
PrintCopyright();
Configure.DoConfigure();
}).WithParsed<StatsOptions>(opts =>
{
PrintCopyright();
Commands.Statistics.ShowStats();
}).WithNotParsed(errs => Environment.Exit(1));
Statistics.SaveStats(); Statistics.SaveStats();
} }
static void PrintCopyright() static void PrintCopyright()
{ {
object[] attributes = typeof(MainClass).Assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false); object[] attributes =
typeof(MainClass).Assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
string assemblyTitle = ((AssemblyTitleAttribute)attributes[0]).Title; string assemblyTitle = ((AssemblyTitleAttribute)attributes[0]).Title;
attributes = typeof(MainClass).Assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); attributes =
Version assemblyVersion = typeof(MainClass).Assembly.GetName().Version; typeof(MainClass).Assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
string assemblyCopyright = ((AssemblyCopyrightAttribute)attributes[0]).Copyright; Version assemblyVersion = typeof(MainClass).Assembly.GetName().Version;
string assemblyCopyright = ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
DicConsole.WriteLine("{0} {1}", assemblyTitle, assemblyVersion); DicConsole.WriteLine("{0} {1}", assemblyTitle, assemblyVersion);
DicConsole.WriteLine("{0}", assemblyCopyright); DicConsole.WriteLine("{0}", assemblyCopyright);
DicConsole.WriteLine(); DicConsole.WriteLine();
} }
} }

View File

@@ -130,7 +130,8 @@ namespace DiscImageChef
public class EntropyOptions : CommonOptions public class EntropyOptions : CommonOptions
{ {
[Option('p', "duplicated-sectors", Default = 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", Default = true, HelpText = "Calculates entropy for each track separately.")] [Option('t', "separated-tracks", Default = true, HelpText = "Calculates entropy for each track separately.")]
@@ -201,7 +202,7 @@ namespace DiscImageChef
public string DevicePath { get; set; } public string DevicePath { get; set; }
[Option('w', "output-prefix", Required = false, Default = "", [Option('w', "output-prefix", Required = false, Default = "",
HelpText = "Write binary responses from device with that prefix.")] HelpText = "Write binary responses from device with that prefix.")]
public string OutputPrefix { get; set; } public string OutputPrefix { get; set; }
} }
@@ -212,7 +213,7 @@ namespace DiscImageChef
public string DevicePath { get; set; } public string DevicePath { get; set; }
[Option('w', "output-prefix", Required = false, Default = "", [Option('w', "output-prefix", Required = false, Default = "",
HelpText = "Write binary responses from device with that prefix.")] HelpText = "Write binary responses from device with that prefix.")]
public string OutputPrefix { get; set; } public string OutputPrefix { get; set; }
} }
@@ -223,11 +224,11 @@ namespace DiscImageChef
public string DevicePath { get; set; } public string DevicePath { get; set; }
[Option('m', "mhdd-log", Required = false, Default = "", [Option('m', "mhdd-log", Required = false, Default = "",
HelpText = "Write a log of the scan in the format used by MHDD.")] 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, Default = "", [Option('b', "ibg-log", Required = false, Default = "",
HelpText = "Write a log of the scan in the format used by ImgBurn.")] HelpText = "Write a log of the scan in the format used by ImgBurn.")]
public string IbgLogPath { get; set; } public string IbgLogPath { get; set; }
} }
@@ -250,11 +251,11 @@ namespace DiscImageChef
[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; }
[Option('t', "tape", Required = false, Default = false, [Option('t', "tape", Required = false, Default = false,
HelpText = HelpText =
"When used indicates that input is a folder containing alphabetically sorted files extracted from a linear block-based tape with fixed block size (e.g. a SCSI tape device).")] "When used indicates that input is a folder containing alphabetically sorted files extracted from a linear block-based tape with fixed block size (e.g. a SCSI tape device).")]
public bool Tape { get; set; } public bool Tape { get; set; }
[Option('b', "block-size", Required = false, Default = 512, [Option('b', "block-size", Required = false, Default = 512,
HelpText = HelpText =
"Only used for tapes, indicates block size. Files in the folder whose size is not a multiple of this value will simply be ignored.")] "Only used for tapes, indicates block size. Files in the folder whose size is not a multiple of this value will simply be ignored.")]
public int BlockSize { get; set; } public int BlockSize { get; set; }
@@ -272,7 +273,7 @@ namespace DiscImageChef
public string OutputPrefix { get; set; } public string OutputPrefix { get; set; }
[Option('r', "raw", Default = false, [Option('r', "raw", Default = false,
HelpText = "Dump sectors with tags included. For optical media, dump scrambled sectors")] HelpText = "Dump sectors with tags included. For optical media, dump scrambled sectors")]
public bool Raw { get; set; } public bool Raw { get; set; }
[Option('s', "stop-on-error", Default = false, HelpText = "Stop media dump on first error.")] [Option('s', "stop-on-error", Default = false, HelpText = "Stop media dump on first error.")]
@@ -288,7 +289,7 @@ namespace DiscImageChef
public bool Persistent { get; set; } public bool Persistent { get; set; }
[Option("separate-subchannel", Default = false, [Option("separate-subchannel", Default = false,
HelpText = "Save subchannel in a separate file. Only applicable to CD/DDCD/GD.")] HelpText = "Save subchannel in a separate file. Only applicable to CD/DDCD/GD.")]
public bool SeparateSubchannel { get; set; } public bool SeparateSubchannel { get; set; }
[Option('m', "resume", Default = true, HelpText = "Create/use resume mapfile.")] [Option('m', "resume", Default = true, HelpText = "Create/use resume mapfile.")]
@@ -334,7 +335,7 @@ namespace DiscImageChef
public string InputFile { get; set; } public string InputFile { get; set; }
[Option('o', "output", Required = true, [Option('o', "output", Required = true,
HelpText = "Directory where extracted files will be created. Will abort if it exists.")] HelpText = "Directory where extracted files will be created. Will abort if it exists.")]
public string OutputDir { get; set; } public string OutputDir { get; set; }
[Option('x', "xattrs", Default = false, HelpText = "Extract extended attributes if present.")] [Option('x', "xattrs", Default = false, HelpText = "Extract extended attributes if present.")]
@@ -349,4 +350,7 @@ namespace DiscImageChef
[Verb("list-encodings", HelpText = "Lists all supported text encodings and code pages.")] [Verb("list-encodings", HelpText = "Lists all supported text encodings and code pages.")]
public class ListEncodingsOptions : CommonOptions { } public class ListEncodingsOptions : CommonOptions { }
[Verb("list-options", HelpText = "Lists all options supported by read-only filesystems.")]
public class ListOptionsOptions : CommonOptions { }
} }

View File

@@ -3,4 +3,5 @@
<package id="Claunia.Encoding" version="1.4.0" targetFramework="net40" /> <package id="Claunia.Encoding" version="1.4.0" targetFramework="net40" />
<package id="CommandLineParser" version="2.1.1-beta" targetFramework="net40" /> <package id="CommandLineParser" version="2.1.1-beta" targetFramework="net40" />
<package id="SharpCompress" version="0.19.2" targetFramework="net40" /> <package id="SharpCompress" version="0.19.2" targetFramework="net40" />
<package id="System.ValueTuple" version="4.4.0" targetFramework="net40" />
</packages> </packages>