mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add filesystem namespaces.
This commit is contained in:
@@ -50,6 +50,7 @@ namespace DiscImageChef.Commands
|
||||
string encodingName;
|
||||
bool extractXattrs;
|
||||
string inputFile;
|
||||
string @namespace;
|
||||
string outputDir;
|
||||
string pluginOptions;
|
||||
bool showHelp;
|
||||
@@ -74,6 +75,7 @@ namespace DiscImageChef.Commands
|
||||
s => outputDir = s
|
||||
},
|
||||
{"xattrs|x", "Extract extended attributes if present.", b => extractXattrs = b != null},
|
||||
{"namespace|n=", "Namespace to use for filenames.", s => @namespace = s},
|
||||
{"help|h|?", "Show this message and exit.", v => showHelp = v != null}
|
||||
};
|
||||
}
|
||||
@@ -230,7 +232,7 @@ namespace DiscImageChef.Commands
|
||||
.GetConstructor(Type.EmptyTypes)
|
||||
?.Invoke(new object[] { });
|
||||
|
||||
error = fs.Mount(imageFormat, partitions[i], encoding, parsedOptions);
|
||||
error = fs.Mount(imageFormat, partitions[i], encoding, parsedOptions, @namespace);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
string volumeName =
|
||||
@@ -254,7 +256,7 @@ namespace DiscImageChef.Commands
|
||||
IReadOnlyFilesystem fs = (IReadOnlyFilesystem)plugin
|
||||
.GetType().GetConstructor(Type.EmptyTypes)
|
||||
?.Invoke(new object[] { });
|
||||
error = fs.Mount(imageFormat, partitions[i], encoding, parsedOptions);
|
||||
error = fs.Mount(imageFormat, partitions[i], encoding, parsedOptions, @namespace);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
string volumeName = string.IsNullOrEmpty(fs.XmlFsType.VolumeName)
|
||||
@@ -290,7 +292,7 @@ namespace DiscImageChef.Commands
|
||||
IReadOnlyFilesystem fs = (IReadOnlyFilesystem)plugin
|
||||
.GetType().GetConstructor(Type.EmptyTypes)
|
||||
?.Invoke(new object[] { });
|
||||
error = fs.Mount(imageFormat, wholePart, encoding, parsedOptions);
|
||||
error = fs.Mount(imageFormat, wholePart, encoding, parsedOptions, @namespace);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
string volumeName = string.IsNullOrEmpty(fs.XmlFsType.VolumeName)
|
||||
@@ -310,7 +312,7 @@ namespace DiscImageChef.Commands
|
||||
DicConsole.WriteLine($"Identified by {plugin.Name}.");
|
||||
IReadOnlyFilesystem fs =
|
||||
(IReadOnlyFilesystem)plugin.GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { });
|
||||
error = fs.Mount(imageFormat, wholePart, encoding, parsedOptions);
|
||||
error = fs.Mount(imageFormat, wholePart, encoding, parsedOptions, @namespace);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
string volumeName = string.IsNullOrEmpty(fs.XmlFsType.VolumeName)
|
||||
|
||||
103
DiscImageChef/Commands/ListNamespaces.cs
Normal file
103
DiscImageChef/Commands/ListNamespaces.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
// /***************************************************************************
|
||||
// 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-2019 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using DiscImageChef.CommonTypes;
|
||||
using DiscImageChef.CommonTypes.Enums;
|
||||
using DiscImageChef.CommonTypes.Interfaces;
|
||||
using DiscImageChef.Console;
|
||||
using DiscImageChef.Core;
|
||||
using Mono.Options;
|
||||
|
||||
namespace DiscImageChef.Commands
|
||||
{
|
||||
class ListNamespacesCommand : Command
|
||||
{
|
||||
bool showHelp;
|
||||
|
||||
public ListNamespacesCommand() : base("list-namespaces",
|
||||
"Lists all namespaces supported by read-only filesystems.")
|
||||
{
|
||||
Options = new OptionSet
|
||||
{
|
||||
$"{MainClass.AssemblyTitle} {MainClass.AssemblyVersion?.InformationalVersion}",
|
||||
$"{MainClass.AssemblyCopyright}",
|
||||
"",
|
||||
$"usage: DiscImageChef {Name}",
|
||||
"",
|
||||
Help,
|
||||
{"help|h|?", "Show this message and exit.", v => showHelp = v != null}
|
||||
};
|
||||
}
|
||||
|
||||
public override int Invoke(IEnumerable<string> arguments)
|
||||
{
|
||||
List<string> extra = Options.Parse(arguments);
|
||||
|
||||
if(showHelp)
|
||||
{
|
||||
Options.WriteOptionDescriptions(CommandSet.Out);
|
||||
return (int)ErrorNumber.HelpRequested;
|
||||
}
|
||||
|
||||
MainClass.PrintCopyright();
|
||||
if(MainClass.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(MainClass.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
|
||||
if(extra.Count > 0)
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Too many arguments.");
|
||||
return (int)ErrorNumber.UnexpectedArgumentCount;
|
||||
}
|
||||
|
||||
DicConsole.DebugWriteLine("List-Namespaces command", "--debug={0}", MainClass.Debug);
|
||||
DicConsole.DebugWriteLine("List-Namespaces command", "--verbose={0}", MainClass.Verbose);
|
||||
Statistics.AddCommand("list-namespaces");
|
||||
|
||||
PluginBase plugins = GetPluginBase.Instance;
|
||||
|
||||
foreach(KeyValuePair<string, IReadOnlyFilesystem> kvp in plugins.ReadOnlyFilesystems)
|
||||
{
|
||||
if(kvp.Value.Namespaces is null) continue;
|
||||
|
||||
DicConsole.WriteLine("\tNamespaces for {0}:", kvp.Value.Name);
|
||||
DicConsole.WriteLine("\t\t{0,-16} {1,-16}", "Namespace", "Description");
|
||||
foreach(KeyValuePair<string, string> @namespace in kvp.Value.Namespaces.OrderBy(t => t.Key))
|
||||
DicConsole.WriteLine("\t\t{0,-16} {1,-16}", @namespace.Key, @namespace.Value);
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
return (int)ErrorNumber.NoError;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,7 @@ namespace DiscImageChef.Commands
|
||||
string encodingName;
|
||||
string inputFile;
|
||||
bool longFormat;
|
||||
string @namespace;
|
||||
string pluginOptions;
|
||||
bool showHelp;
|
||||
|
||||
@@ -68,7 +69,8 @@ namespace DiscImageChef.Commands
|
||||
"options|O=", "Comma separated name=value pairs of options to pass to filesystem plugin.",
|
||||
s => pluginOptions = s
|
||||
},
|
||||
{"help|h|?", "Show this message and exit.", v => showHelp = v != null}
|
||||
{"namespace|n=", "Namespace to use for filenames.", s => @namespace = s},
|
||||
{"help|h|?", "Show this message and exit.", v => showHelp = v != null}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -215,7 +217,7 @@ namespace DiscImageChef.Commands
|
||||
|
||||
if(fs == null) continue;
|
||||
|
||||
error = fs.Mount(imageFormat, partitions[i], encoding, parsedOptions);
|
||||
error = fs.Mount(imageFormat, partitions[i], encoding, parsedOptions, @namespace);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
ListFilesInDir("/", fs);
|
||||
@@ -238,7 +240,7 @@ namespace DiscImageChef.Commands
|
||||
?.Invoke(new object[] { });
|
||||
if(fs == null) continue;
|
||||
|
||||
error = fs.Mount(imageFormat, partitions[i], encoding, parsedOptions);
|
||||
error = fs.Mount(imageFormat, partitions[i], encoding, parsedOptions, @namespace);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
ListFilesInDir("/", fs);
|
||||
@@ -272,7 +274,7 @@ namespace DiscImageChef.Commands
|
||||
?.Invoke(new object[] { });
|
||||
if(fs == null) continue;
|
||||
|
||||
error = fs.Mount(imageFormat, wholePart, encoding, parsedOptions);
|
||||
error = fs.Mount(imageFormat, wholePart, encoding, parsedOptions, @namespace);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
ListFilesInDir("/", fs);
|
||||
@@ -293,7 +295,7 @@ namespace DiscImageChef.Commands
|
||||
.GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { });
|
||||
if(fs != null)
|
||||
{
|
||||
error = fs.Mount(imageFormat, wholePart, encoding, parsedOptions);
|
||||
error = fs.Mount(imageFormat, wholePart, encoding, parsedOptions, @namespace);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
ListFilesInDir("/", fs);
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
<Compile Include="Commands\ConvertImage.cs" />
|
||||
<Compile Include="Commands\Gui.cs" />
|
||||
<Compile Include="Commands\ImageInfo.cs" />
|
||||
<Compile Include="Commands\ListNamespaces.cs" />
|
||||
<Compile Include="Commands\ListOptions.cs" />
|
||||
<Compile Include="Commands\Update.cs" />
|
||||
<Compile Include="Main.cs" />
|
||||
|
||||
@@ -135,6 +135,7 @@ namespace DiscImageChef
|
||||
currentPlatform == PlatformID.Win32NT) commands.Add(new ListDevicesCommand());
|
||||
|
||||
commands.Add(new ListEncodingsCommand());
|
||||
commands.Add(new ListNamespacesCommand());
|
||||
commands.Add(new ListOptionsCommand());
|
||||
commands.Add(new LsCommand());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user