mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add support to show available options from IReadOnlyFilesystems.
This commit is contained in:
1
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
1
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
@@ -32,6 +32,7 @@
|
||||
<e p="Formats.cs" t="Include" />
|
||||
<e p="ListDevices.cs" t="Include" />
|
||||
<e p="ListEncodings.cs" t="Include" />
|
||||
<e p="ListOptions.cs" t="Include" />
|
||||
<e p="Ls.cs" t="Include" />
|
||||
<e p="MediaInfo.cs" t="Include" />
|
||||
<e p="MediaScan.cs" t="Include" />
|
||||
|
||||
@@ -57,6 +57,11 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
public string Name => "Apple DOS File System";
|
||||
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()
|
||||
{
|
||||
return new Dictionary<string, string> {{"debug", false.ToString()}};
|
||||
@@ -70,17 +75,17 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
/// <summary>Caches catalog</summary>
|
||||
Dictionary<string, ushort> catalogCache;
|
||||
/// <summary>Caches file size</summary>
|
||||
Dictionary<string, int> fileSizeCache;
|
||||
Dictionary<string, int> fileSizeCache;
|
||||
/// <summary>Caches VTOC</summary>
|
||||
byte[] vtocBlocks;
|
||||
byte[] vtocBlocks;
|
||||
/// <summary>Caches catalog</summary>
|
||||
byte[] catalogBlocks;
|
||||
byte[] catalogBlocks;
|
||||
/// <summary>Caches boot code</summary>
|
||||
byte[] bootBlocks;
|
||||
byte[] bootBlocks;
|
||||
/// <summary>Caches file type</summary>
|
||||
Dictionary<string, byte> fileTypeCache;
|
||||
Dictionary<string, byte> fileTypeCache;
|
||||
/// <summary>Caches locked files</summary>
|
||||
List<string> lockedFiles;
|
||||
List<string> lockedFiles;
|
||||
#endregion Caches
|
||||
}
|
||||
}
|
||||
@@ -71,5 +71,11 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
{
|
||||
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)[] { };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,6 +117,11 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
public string Name => "CP/M File System";
|
||||
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()
|
||||
{
|
||||
return new Dictionary<string, string> {{"debug", false.ToString()}};
|
||||
|
||||
@@ -35,6 +35,9 @@
|
||||
<HintPath>..\packages\Claunia.Encoding.1.4.0\lib\portable40-net40+sl5+win8+wp8\Claunia.Encoding.dll</HintPath>
|
||||
</Reference>
|
||||
<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" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
// Copyright © 2011-2018 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using DiscImageChef.CommonTypes;
|
||||
@@ -129,5 +130,10 @@ namespace DiscImageChef.Filesystems
|
||||
/// <param name="path">Link path.</param>
|
||||
/// <param name="dest">Link destination.</param>
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,12 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
public Encoding Encoding { 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()
|
||||
{
|
||||
return new Dictionary<string, string> {{"debug", false.ToString()}};
|
||||
@@ -65,17 +71,17 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
/// <summary>Caches Extents Files</summary>
|
||||
Dictionary<short, ExtentFile> extentCache;
|
||||
/// <summary>Caches system files</summary>
|
||||
Dictionary<short, byte[]> systemFileCache;
|
||||
Dictionary<short, byte[]> systemFileCache;
|
||||
/// <summary>Caches user files files</summary>
|
||||
Dictionary<short, byte[]> fileCache;
|
||||
Dictionary<short, byte[]> fileCache;
|
||||
/// <summary>Caches catalogs</summary>
|
||||
List<CatalogEntry> catalogCache;
|
||||
List<CatalogEntry> catalogCache;
|
||||
/// <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>
|
||||
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>
|
||||
Dictionary<short, DateTime> directoryDtcCache;
|
||||
Dictionary<short, DateTime> directoryDtcCache;
|
||||
#endregion Caches
|
||||
}
|
||||
}
|
||||
@@ -73,6 +73,11 @@ namespace DiscImageChef.Filesystems.UCSDPascal
|
||||
return Errno.NotSupported;
|
||||
}
|
||||
|
||||
public (string name, Type type, string description)[] ListOptions()
|
||||
{
|
||||
return new(string name, Type type, string description)[] { };
|
||||
}
|
||||
|
||||
static Dictionary<string, string> GetDefaultOptions()
|
||||
{
|
||||
return new Dictionary<string, string> {{"debug", false.ToString()}};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Claunia.Encoding" version="1.4.0" targetFramework="net40" />
|
||||
<package id="System.ValueTuple" version="4.4.0" targetFramework="net40" />
|
||||
</packages>
|
||||
61
DiscImageChef/Commands/ListOptions.cs
Normal file
61
DiscImageChef/Commands/ListOptions.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,9 +45,13 @@
|
||||
<Reference Include="CommandLine">
|
||||
<HintPath>..\packages\CommandLineParser.2.1.1-beta\lib\net40\CommandLine.dll</HintPath>
|
||||
</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" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Commands\ListOptions.cs" />
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="Options.cs" />
|
||||
|
||||
@@ -43,8 +43,8 @@ namespace DiscImageChef
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
DicConsole.WriteLineEvent += System.Console.WriteLine;
|
||||
DicConsole.WriteEvent += System.Console.Write;
|
||||
DicConsole.WriteLineEvent += System.Console.WriteLine;
|
||||
DicConsole.WriteEvent += System.Console.Write;
|
||||
DicConsole.ErrorWriteLineEvent += System.Console.Error.WriteLine;
|
||||
|
||||
Settings.Settings.LoadSettings();
|
||||
@@ -58,143 +58,152 @@ namespace DiscImageChef
|
||||
typeof(CreateSidecarOptions), typeof(DumpMediaOptions),
|
||||
typeof(DeviceReportOptions), typeof(ConfigureOptions), typeof(StatsOptions),
|
||||
typeof(LsOptions), typeof(ExtractFilesOptions), typeof(ListDevicesOptions),
|
||||
typeof(ListEncodingsOptions)).WithParsed<AnalyzeOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Analyze.DoAnalyze(opts);
|
||||
}).WithParsed<CompareOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Compare.DoCompare(opts);
|
||||
}).WithParsed<ChecksumOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Checksum.DoChecksum(opts);
|
||||
}).WithParsed<EntropyOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Entropy.DoEntropy(opts);
|
||||
}).WithParsed<VerifyOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Verify.DoVerify(opts);
|
||||
}).WithParsed<PrintHexOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Commands.PrintHex.DoPrintHex(opts);
|
||||
}).WithParsed<DecodeOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Decode.DoDecode(opts);
|
||||
}).WithParsed<DeviceInfoOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
DeviceInfo.DoDeviceInfo(opts);
|
||||
}).WithParsed<MediaInfoOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
MediaInfo.DoMediaInfo(opts);
|
||||
}).WithParsed<MediaScanOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
MediaScan.DoMediaScan(opts);
|
||||
}).WithParsed<FormatsOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Formats.ListFormats(opts);
|
||||
}).WithParsed<BenchmarkOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Benchmark.DoBenchmark(opts);
|
||||
}).WithParsed<CreateSidecarOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
CreateSidecar.DoSidecar(opts);
|
||||
}).WithParsed<DumpMediaOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
DumpMedia.DoDumpMedia(opts);
|
||||
}).WithParsed<DeviceReportOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
DeviceReport.DoDeviceReport(opts);
|
||||
}).WithParsed<LsOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Ls.DoLs(opts);
|
||||
}).WithParsed<ExtractFilesOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
ExtractFiles.DoExtractFiles(opts);
|
||||
}).WithParsed<ListDevicesOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
ListDevices.DoListDevices(opts);
|
||||
}).WithParsed<ListEncodingsOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
ListEncodings.DoList();
|
||||
}).WithParsed<ConfigureOptions>(opts =>
|
||||
{
|
||||
PrintCopyright();
|
||||
Configure.DoConfigure();
|
||||
}).WithParsed<StatsOptions>(opts =>
|
||||
{
|
||||
PrintCopyright();
|
||||
Commands.Statistics.ShowStats();
|
||||
}).WithNotParsed(errs => Environment.Exit(1));
|
||||
typeof(ListEncodingsOptions), typeof(ListOptionsOptions))
|
||||
.WithParsed<AnalyzeOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Analyze.DoAnalyze(opts);
|
||||
}).WithParsed<CompareOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Compare.DoCompare(opts);
|
||||
}).WithParsed<ChecksumOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Checksum.DoChecksum(opts);
|
||||
}).WithParsed<EntropyOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Entropy.DoEntropy(opts);
|
||||
}).WithParsed<VerifyOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Verify.DoVerify(opts);
|
||||
}).WithParsed<PrintHexOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Commands.PrintHex.DoPrintHex(opts);
|
||||
}).WithParsed<DecodeOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Decode.DoDecode(opts);
|
||||
}).WithParsed<DeviceInfoOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
DeviceInfo.DoDeviceInfo(opts);
|
||||
}).WithParsed<MediaInfoOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
MediaInfo.DoMediaInfo(opts);
|
||||
}).WithParsed<MediaScanOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
MediaScan.DoMediaScan(opts);
|
||||
}).WithParsed<FormatsOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Formats.ListFormats(opts);
|
||||
}).WithParsed<BenchmarkOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Benchmark.DoBenchmark(opts);
|
||||
}).WithParsed<CreateSidecarOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
CreateSidecar.DoSidecar(opts);
|
||||
}).WithParsed<DumpMediaOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
DumpMedia.DoDumpMedia(opts);
|
||||
}).WithParsed<DeviceReportOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
DeviceReport.DoDeviceReport(opts);
|
||||
}).WithParsed<LsOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Ls.DoLs(opts);
|
||||
}).WithParsed<ExtractFilesOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
ExtractFiles.DoExtractFiles(opts);
|
||||
}).WithParsed<ListDevicesOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
ListDevices.DoListDevices(opts);
|
||||
}).WithParsed<ListEncodingsOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
ListEncodings.DoList();
|
||||
}).WithParsed<ListOptionsOptions>(opts =>
|
||||
{
|
||||
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
ListOptions.DoList();
|
||||
}).WithParsed<ConfigureOptions>(opts =>
|
||||
{
|
||||
PrintCopyright();
|
||||
Configure.DoConfigure();
|
||||
}).WithParsed<StatsOptions>(opts =>
|
||||
{
|
||||
PrintCopyright();
|
||||
Commands.Statistics.ShowStats();
|
||||
}).WithNotParsed(errs => Environment.Exit(1));
|
||||
|
||||
Statistics.SaveStats();
|
||||
}
|
||||
|
||||
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;
|
||||
attributes = typeof(MainClass).Assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
|
||||
Version assemblyVersion = typeof(MainClass).Assembly.GetName().Version;
|
||||
string assemblyCopyright = ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
|
||||
attributes =
|
||||
typeof(MainClass).Assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
|
||||
Version assemblyVersion = typeof(MainClass).Assembly.GetName().Version;
|
||||
string assemblyCopyright = ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
|
||||
|
||||
DicConsole.WriteLine("{0} {1}", assemblyTitle, assemblyVersion);
|
||||
DicConsole.WriteLine("{0}", assemblyCopyright);
|
||||
DicConsole.WriteLine("{0}", assemblyCopyright);
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +130,8 @@ namespace DiscImageChef
|
||||
public class EntropyOptions : CommonOptions
|
||||
{
|
||||
[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; }
|
||||
|
||||
[Option('t', "separated-tracks", Default = true, HelpText = "Calculates entropy for each track separately.")]
|
||||
@@ -201,7 +202,7 @@ namespace DiscImageChef
|
||||
public string DevicePath { get; set; }
|
||||
|
||||
[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; }
|
||||
}
|
||||
|
||||
@@ -212,7 +213,7 @@ namespace DiscImageChef
|
||||
public string DevicePath { get; set; }
|
||||
|
||||
[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; }
|
||||
}
|
||||
|
||||
@@ -223,11 +224,11 @@ namespace DiscImageChef
|
||||
public string DevicePath { get; set; }
|
||||
|
||||
[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; }
|
||||
|
||||
[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; }
|
||||
}
|
||||
|
||||
@@ -250,11 +251,11 @@ namespace DiscImageChef
|
||||
[Option('i', "input", Required = true, HelpText = "Disc image.")]
|
||||
public string InputFile { get; set; }
|
||||
[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).")]
|
||||
public bool Tape { get; set; }
|
||||
[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.")]
|
||||
public int BlockSize { get; set; }
|
||||
|
||||
@@ -272,7 +273,7 @@ namespace DiscImageChef
|
||||
public string OutputPrefix { get; set; }
|
||||
|
||||
[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; }
|
||||
|
||||
[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; }
|
||||
|
||||
[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; }
|
||||
|
||||
[Option('m', "resume", Default = true, HelpText = "Create/use resume mapfile.")]
|
||||
@@ -334,7 +335,7 @@ namespace DiscImageChef
|
||||
public string InputFile { get; set; }
|
||||
|
||||
[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; }
|
||||
|
||||
[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.")]
|
||||
public class ListEncodingsOptions : CommonOptions { }
|
||||
|
||||
[Verb("list-options", HelpText = "Lists all options supported by read-only filesystems.")]
|
||||
public class ListOptionsOptions : CommonOptions { }
|
||||
}
|
||||
@@ -3,4 +3,5 @@
|
||||
<package id="Claunia.Encoding" version="1.4.0" targetFramework="net40" />
|
||||
<package id="CommandLineParser" version="2.1.1-beta" targetFramework="net40" />
|
||||
<package id="SharpCompress" version="0.19.2" targetFramework="net40" />
|
||||
<package id="System.ValueTuple" version="4.4.0" targetFramework="net40" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user