🎨Supported options in IReadOnlyFilesystem is better set as a property.

This commit is contained in:
2017-12-28 18:08:15 +00:00
parent c3609c6f77
commit ecd2db76a8
7 changed files with 18 additions and 28 deletions

View File

@@ -57,10 +57,8 @@ 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() public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
{ new(string name, Type type, string description)[] { };
return new(string name, Type type, string description)[] { };
}
static Dictionary<string, string> GetDefaultOptions() static Dictionary<string, string> GetDefaultOptions()
{ {

View File

@@ -67,15 +67,13 @@ namespace DiscImageChef.Filesystems.AppleMFS
public Guid Id => new Guid("36405F8D-0D26-4066-6538-5DBF5D065C3A"); public Guid Id => new Guid("36405F8D-0D26-4066-6538-5DBF5D065C3A");
public Encoding Encoding { get; private set; } public Encoding Encoding { get; private set; }
// TODO: Implement Finder namespace (requires decoding Desktop database)
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
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()}};
} }
// 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,10 +117,8 @@ 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() public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
{ new(string name, Type type, string description)[] { };
return new(string name, Type type, string description)[] { };
}
static Dictionary<string, string> GetDefaultOptions() static Dictionary<string, string> GetDefaultOptions()
{ {

View File

@@ -44,6 +44,11 @@ namespace DiscImageChef.Filesystems
/// </summary> /// </summary>
public interface IReadOnlyFilesystem : IFilesystem public interface IReadOnlyFilesystem : IFilesystem
{ {
/// <summary>
/// Retrieves a list of options supported by the filesystem, with name, type and description
/// </summary>
IEnumerable<(string name, Type type, string description)> SupportedOptions { get; }
/// <summary> /// <summary>
/// Initializates whatever internal structures the filesystem plugin needs to be able to read files and directories /// Initializates whatever internal structures the filesystem plugin needs to be able to read files and directories
/// from the filesystem. /// from the filesystem.
@@ -130,10 +135,5 @@ 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

@@ -57,10 +57,8 @@ namespace DiscImageChef.Filesystems.LisaFS
public FileSystemType XmlFsType { get; private set; } public FileSystemType XmlFsType { get; private set; }
// TODO: Implement Lisa 7/7 namespace (needs decoding {!CATALOG} file) // TODO: Implement Lisa 7/7 namespace (needs decoding {!CATALOG} file)
public (string name, Type type, string description)[] ListOptions() public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
{ new(string name, Type type, string description)[] { };
return new(string name, Type type, string description)[] { };
}
static Dictionary<string, string> GetDefaultOptions() static Dictionary<string, string> GetDefaultOptions()
{ {

View File

@@ -73,10 +73,8 @@ namespace DiscImageChef.Filesystems.UCSDPascal
return Errno.NotSupported; return Errno.NotSupported;
} }
public (string name, Type type, string description)[] ListOptions() public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
{ new(string name, Type type, string description)[] { };
return new(string name, Type type, string description)[] { };
}
static Dictionary<string, string> GetDefaultOptions() static Dictionary<string, string> GetDefaultOptions()
{ {

View File

@@ -47,7 +47,7 @@ namespace DiscImageChef.Commands
foreach(KeyValuePair<string, IReadOnlyFilesystem> kvp in plugins.ReadOnlyFilesystems) foreach(KeyValuePair<string, IReadOnlyFilesystem> kvp in plugins.ReadOnlyFilesystems)
{ {
List<(string name, Type type, string description)> options = kvp.Value.ListOptions().ToList(); List<(string name, Type type, string description)> options = kvp.Value.SupportedOptions.ToList();
options.Add(("debug", typeof(bool), "Enables debug features if available")); options.Add(("debug", typeof(bool), "Enables debug features if available"));
DicConsole.WriteLine("Options for {0}:", kvp.Value.Name); DicConsole.WriteLine("Options for {0}:", kvp.Value.Name);