Add default value for writable image options.

This commit is contained in:
2018-09-30 22:28:59 +01:00
parent c899915153
commit fac608b8d3
32 changed files with 146 additions and 184 deletions

View File

@@ -65,7 +65,7 @@ namespace DiscImageChef.CommonTypes.Interfaces
/// <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; }
IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions { get; }
/// <summary>
/// Gets a list of known extensions for format auto-chosing
/// </summary>

View File

@@ -135,8 +135,8 @@ namespace DiscImageChef.DiscImages
MediaType.NeoGeoCD, MediaType.PCFX, MediaType.CDTV, MediaType.CD32, MediaType.Nuon,
MediaType.Playdia, MediaType.Pippin, MediaType.FMTOWNS, MediaType.MilCD
};
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions => new[] {".mds"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -80,8 +80,8 @@ namespace DiscImageChef.DiscImages
MediaType.CompactFlash, MediaType.CompactFlashType2, MediaType.PCCardTypeI, MediaType.PCCardTypeII,
MediaType.PCCardTypeIII, MediaType.PCCardTypeIV
};
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions => new[] {".fdi", ".hdi"};
public bool IsWriting { get; private set; }

View File

@@ -71,8 +71,8 @@ namespace DiscImageChef.DiscImages
MediaType.CompactFlash, MediaType.CompactFlashType2, MediaType.PCCardTypeI, MediaType.PCCardTypeII,
MediaType.PCCardTypeIII, MediaType.PCCardTypeIV
};
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions => new[] {".2mg"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -64,8 +64,8 @@ namespace DiscImageChef.DiscImages
public IEnumerable<MediaTagType> SupportedMediaTags => new MediaTagType[] { };
public IEnumerable<SectorTagType> SupportedSectorTags => new SectorTagType[] { };
public IEnumerable<MediaType> SupportedMediaTypes => new[] {MediaType.Apple33SS};
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions => new[] {".do", ".po"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -75,8 +75,8 @@ namespace DiscImageChef.DiscImages
MediaType.FDFORMAT_525_DD, MediaType.FDFORMAT_525_HD, MediaType.RX50, MediaType.XDF_35,
MediaType.XDF_525
};
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new[] {("compress", typeof(bool), "Enable Apridisk compression.")};
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new[] {("compress", typeof(bool), "Enable Apridisk compression.", (object)false)};
public IEnumerable<string> KnownExtensions => new[] {".dsk"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -64,8 +64,8 @@ namespace DiscImageChef.DiscImages
MediaType.Unknown, MediaType.FlashDrive, MediaType.CompactFlash, MediaType.CompactFlashType2,
MediaType.PCCardTypeI, MediaType.PCCardTypeII, MediaType.PCCardTypeIII, MediaType.PCCardTypeIV
};
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions => new[] {".blu"}; // Just invented
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -117,8 +117,8 @@ namespace DiscImageChef.DiscImages
MediaType.CDTV, MediaType.CD32, MediaType.Nuon, MediaType.Playdia, MediaType.Pippin,
MediaType.FMTOWNS
};
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new[] {("separate", typeof(bool), "Write each track to a separate file.")};
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new[] {("separate", typeof(bool), "Write each track to a separate file.", (object)false)};
public IEnumerable<string> KnownExtensions => new[] {".toc"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -122,8 +122,8 @@ namespace DiscImageChef.DiscImages
MediaType.NeoGeoCD, MediaType.PCFX, MediaType.CDTV, MediaType.CD32, MediaType.Nuon,
MediaType.Playdia, MediaType.Pippin, MediaType.FMTOWNS, MediaType.MilCD
};
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new[] {("separate", typeof(bool), "Write each track to a separate file.")};
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new[] {("separate", typeof(bool), "Write each track to a separate file.", (object)false)};
public IEnumerable<string> KnownExtensions => new[] {".cue"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -64,8 +64,8 @@ namespace DiscImageChef.DiscImages
MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_DS_DD_9,
MediaType.DOS_525_HD, MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_9
};
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions => new[] {".dcf"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -70,8 +70,8 @@ namespace DiscImageChef.DiscImages
MediaType.CDTV, MediaType.CD32, MediaType.Nuon, MediaType.Playdia, MediaType.Pippin,
MediaType.FMTOWNS, MediaType.MilCD
};
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions => new[] {".ccd"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -57,22 +57,24 @@ namespace DiscImageChef.DiscImages
public IEnumerable<SectorTagType> SupportedSectorTags =>
Enum.GetValues(typeof(SectorTagType)).Cast<SectorTagType>();
public IEnumerable<MediaType> SupportedMediaTypes => Enum.GetValues(typeof(MediaType)).Cast<MediaType>();
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new[]
{
("sectors_per_block", typeof(uint),
"How many sectors to store per block (will be rounded to next power of two)"),
("dictionary", typeof(uint), "Size, in bytes, of the LZMA dictionary"),
"How many sectors to store per block (will be rounded to next power of two)", 4096U),
("dictionary", typeof(uint), "Size, in bytes, of the LZMA dictionary", (uint)(1 << 25)),
("max_ddt_size", typeof(uint),
"Maximum size, in mebibytes, for in-memory DDT. If image needs a bigger one, it will be on-disk"),
("md5", typeof(bool), "Calculate and store MD5 of image's user data"),
("sha1", typeof(bool), "Calculate and store SHA1 of image's user data"),
("sha256", typeof(bool), "Calculate and store SHA256 of image's user data"),
("spamsum", typeof(bool), "Calculate and store SpamSum of image's user data"),
"Maximum size, in mebibytes, for in-memory DDT. If image needs a bigger one, it will be on-disk",
256U),
("md5", typeof(bool), "Calculate and store MD5 of image's user data", (object)false),
("sha1", typeof(bool), "Calculate and store SHA1 of image's user data", (object)false),
("sha256", typeof(bool), "Calculate and store SHA256 of image's user data", (object)false),
("spamsum", typeof(bool), "Calculate and store SpamSum of image's user data", (object)false),
("deduplicate", typeof(bool),
"Store only unique sectors. This consumes more memory and is slower, but it's enabled by default"),
"Store only unique sectors. This consumes more memory and is slower, but it's enabled by default",
(object)true),
("nocompress", typeof(bool),
"Don't compress user data blocks. Other blocks will still be compressed")
"Don't compress user data blocks. Other blocks will still be compressed", (object)false)
};
public IEnumerable<string> KnownExtensions => new[] {".dicf"};
public bool IsWriting { get; private set; }

View File

@@ -68,8 +68,8 @@ namespace DiscImageChef.DiscImages
MediaType.AppleSonySS, MediaType.AppleWidget, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD,
MediaType.DMF
};
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new[] {("macosx", typeof(bool), "Use Mac OS X format byte")};
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new[] {("macosx", typeof(bool), "Use Mac OS X format byte", (object)false)};
public IEnumerable<string> KnownExtensions => new[] {".dc42", ".diskcopy42", ".image"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -74,8 +74,8 @@ namespace DiscImageChef.DiscImages
MediaType.FDFORMAT_525_DD, MediaType.FDFORMAT_525_HD, MediaType.RX50, MediaType.XDF_35,
MediaType.XDF_525
};
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions => new[] {".dsk"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -74,8 +74,8 @@ namespace DiscImageChef.DiscImages
MediaType.FDFORMAT_525_DD, MediaType.FDFORMAT_525_HD, MediaType.RX50, MediaType.XDF_35,
MediaType.XDF_525
};
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions => new[] {".hdk"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -63,8 +63,8 @@ namespace DiscImageChef.DiscImages
public IEnumerable<SectorTagType> SupportedSectorTags => new SectorTagType[] { };
public IEnumerable<MediaType> SupportedMediaTypes => new[] {MediaType.GENERIC_HDD, MediaType.Unknown};
// TODO: Support dynamic images
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions => new[] {".nhd"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -69,8 +69,8 @@ namespace DiscImageChef.DiscImages
MediaType.PCCardTypeIV
};
// TODO: Add cluster size option
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions => new[] {".hdd"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -68,8 +68,8 @@ namespace DiscImageChef.DiscImages
MediaType.CompactFlashType2, MediaType.PCCardTypeI, MediaType.PCCardTypeII, MediaType.PCCardTypeIII,
MediaType.PCCardTypeIV
};
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions => new[] {".qcow", ".qc"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -69,8 +69,8 @@ namespace DiscImageChef.DiscImages
MediaType.CompactFlashType2, MediaType.PCCardTypeI, MediaType.PCCardTypeII, MediaType.PCCardTypeIII,
MediaType.PCCardTypeIV
};
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions => new[] {".qcow2", ".qc2", ".qcow3", ".qc3"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -33,8 +33,10 @@
using System;
using System.Collections.Generic;
using DiscImageChef.CommonTypes;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
using DiscImageChef.CommonTypes.Structs;
using Schemas;
namespace DiscImageChef.DiscImages
{
@@ -55,5 +57,24 @@ namespace DiscImageChef.DiscImages
public List<Session> Sessions =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public List<DumpHardwareType> DumpHardware => null;
public CICMMetadataType CicmMetadata => null;
public IEnumerable<MediaTagType> SupportedMediaTags => new MediaTagType[] { };
public IEnumerable<SectorTagType> SupportedSectorTags => new SectorTagType[] { };
public IEnumerable<MediaType> SupportedMediaTypes =>
new[]
{
MediaType.Unknown, MediaType.GENERIC_HDD, MediaType.FlashDrive, MediaType.CompactFlash,
MediaType.CompactFlashType2, MediaType.PCCardTypeI, MediaType.PCCardTypeII, MediaType.PCCardTypeIII,
MediaType.PCCardTypeIV
};
// TODO: Add cluster size option
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions => new[] {".qed"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }
}
}

View File

@@ -40,7 +40,6 @@ using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Exceptions;
using DiscImageChef.CommonTypes.Interfaces;
using DiscImageChef.CommonTypes.Structs;
using DiscImageChef.Console;
using Schemas;
namespace DiscImageChef.DiscImages
@@ -92,83 +91,49 @@ namespace DiscImageChef.DiscImages
};
}
public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag)
{
public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
public byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag)
{
public byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
public byte[] ReadDiskTag(MediaTagType tag)
{
public byte[] ReadDiskTag(MediaTagType tag) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
public byte[] ReadSector(ulong sectorAddress, uint track)
{
public byte[] ReadSector(ulong sectorAddress, uint track) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
public byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag)
{
public byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
public byte[] ReadSectors(ulong sectorAddress, uint length, uint track)
{
public byte[] ReadSectors(ulong sectorAddress, uint length, uint track) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
public byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag)
{
public byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
public byte[] ReadSectorLong(ulong sectorAddress)
{
public byte[] ReadSectorLong(ulong sectorAddress) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
public byte[] ReadSectorLong(ulong sectorAddress, uint track)
{
public byte[] ReadSectorLong(ulong sectorAddress, uint track) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
public byte[] ReadSectorsLong(ulong sectorAddress, uint length)
{
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
public byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track)
{
public byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
public List<Track> GetSessionTracks(Session session)
{
public List<Track> GetSessionTracks(Session session) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
public List<Track> GetSessionTracks(ushort session)
{
public List<Track> GetSessionTracks(ushort session) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
public bool? VerifySector(ulong sectorAddress)
{
return null;
}
public bool? VerifySector(ulong sectorAddress) => null;
public bool? VerifySector(ulong sectorAddress, uint track)
{
public bool? VerifySector(ulong sectorAddress, uint track) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
@@ -181,34 +146,10 @@ namespace DiscImageChef.DiscImages
}
public bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
out List<ulong> unknownLbas)
{
out List<ulong> unknownLbas) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
public bool? VerifyMediaImage()
{
return null;
}
public List<DumpHardwareType> DumpHardware => null;
public CICMMetadataType CicmMetadata => null;
public IEnumerable<MediaTagType> SupportedMediaTags => new MediaTagType[] { };
public IEnumerable<SectorTagType> SupportedSectorTags => new SectorTagType[] { };
public IEnumerable<MediaType> SupportedMediaTypes =>
new[]
{
MediaType.Unknown, MediaType.GENERIC_HDD, MediaType.FlashDrive, MediaType.CompactFlash,
MediaType.CompactFlashType2, MediaType.PCCardTypeI, MediaType.PCCardTypeII, MediaType.PCCardTypeIII,
MediaType.PCCardTypeIV
};
// TODO: Add cluster size option
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<string> KnownExtensions => new[] {".qed"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }
public bool? VerifyMediaImage() => null;
public bool Create(string path, MediaType mediaType, Dictionary<string, string> options, ulong sectors,
uint sectorSize)
@@ -437,16 +378,9 @@ namespace DiscImageChef.DiscImages
return true;
}
public bool SetMetadata(ImageInfo metadata)
{
return true;
}
public bool SetMetadata(ImageInfo metadata) => true;
public bool SetGeometry(uint cylinders, uint heads, uint sectorsPerTrack)
{
// Not stored in image
return true;
}
public bool SetGeometry(uint cylinders, uint heads, uint sectorsPerTrack) => true;
public bool WriteSectorTag(byte[] data, ulong sectorAddress, SectorTagType tag)
{
@@ -460,17 +394,9 @@ namespace DiscImageChef.DiscImages
return false;
}
public bool SetDumpHardware(List<DumpHardwareType> dumpHardware)
{
// Not supported
return false;
}
public bool SetDumpHardware(List<DumpHardwareType> dumpHardware) => false;
public bool SetCicmMetadata(CICMMetadataType metadata)
{
// Not supported
return false;
}
public bool SetCicmMetadata(CICMMetadataType metadata) => false;
static bool IsPowerOfTwo(uint x)
{

View File

@@ -74,8 +74,8 @@ namespace DiscImageChef.DiscImages
MediaType.FDFORMAT_525_DD, MediaType.FDFORMAT_525_HD, MediaType.RX50, MediaType.XDF_35,
MediaType.XDF_525
};
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions => new[] {".dim"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -68,8 +68,8 @@ namespace DiscImageChef.DiscImages
MediaType.CompactFlashType2, MediaType.PCCardTypeI, MediaType.PCCardTypeII, MediaType.PCCardTypeIII,
MediaType.PCCardTypeIV
};
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions => new[] {".ide"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -74,8 +74,8 @@ namespace DiscImageChef.DiscImages
MediaType.FDFORMAT_525_DD, MediaType.FDFORMAT_525_HD, MediaType.RX50, MediaType.XDF_35,
MediaType.XDF_525
};
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions => new[] {".dsk"};
public bool IsWriting { get; private set; }

View File

@@ -67,8 +67,8 @@ namespace DiscImageChef.DiscImages
MediaType.CompactFlashType2, MediaType.PCCardTypeI, MediaType.PCCardTypeII, MediaType.PCCardTypeIII,
MediaType.PCCardTypeIV
};
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions => new[] {".t98"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -69,8 +69,8 @@ namespace DiscImageChef.DiscImages
MediaType.CompactFlashType2, MediaType.PCCardTypeI, MediaType.PCCardTypeII, MediaType.PCCardTypeIII,
MediaType.PCCardTypeIV
};
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions => new[] {".dmg"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -70,8 +70,8 @@ namespace DiscImageChef.DiscImages
MediaType.PCCardTypeIV
};
// TODO: Add cluster size option
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions => new[] {".vdi"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -83,8 +83,8 @@ namespace DiscImageChef.DiscImages
MediaType.PCCardTypeIV
};
// TODO: Support dynamic images
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions => new[] {".vhd"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -69,13 +69,14 @@ namespace DiscImageChef.DiscImages
MediaType.CompactFlashType2, MediaType.PCCardTypeI, MediaType.PCCardTypeII, MediaType.PCCardTypeIII,
MediaType.PCCardTypeIV
};
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new[]
{
("adapter_type", typeof(string),
"Type of adapter type. Possible values: ide, lsilogic, buslogic, legacyESX."),
("hwversion", typeof(uint), "VDMK hardware version."),
("sparse", typeof(bool), "Use sparse extents."), ("split", typeof(bool), "Split data file at 2GiB.")
"Type of adapter type. Possible values: ide, lsilogic, buslogic, legacyESX.", "ide"),
("hwversion", typeof(uint), "VDMK hardware version.", 4),
("sparse", typeof(bool), "Use sparse extents.", (object)false),
("split", typeof(bool), "Split data file at 2GiB.", (object)false)
};
public IEnumerable<string> KnownExtensions => new[] {".vmdk"};
public bool IsWriting { get; private set; }

View File

@@ -67,8 +67,8 @@ namespace DiscImageChef.DiscImages
MediaType.CompactFlashType2, MediaType.PCCardTypeI, MediaType.PCCardTypeII, MediaType.PCCardTypeIII,
MediaType.PCCardTypeIV
};
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions => new[] {".v98"};
public bool IsWriting { get; private set; }
public string ErrorMessage { get; private set; }

View File

@@ -60,7 +60,11 @@ namespace DiscImageChef.DiscImages
Track trk = new Track
{
TrackBytesPerSector = rawCompactDisc ? (mode2 ? 2336 : 2048) : (int)imageInfo.SectorSize,
TrackBytesPerSector = rawCompactDisc
? mode2
? 2336
: 2048
: (int)imageInfo.SectorSize,
TrackEndSector = imageInfo.Sectors - 1,
TrackFile = rawImageFilter.GetFilename(),
TrackFileOffset = 0,
@@ -71,7 +75,9 @@ namespace DiscImageChef.DiscImages
TrackSubchannelType =
hasSubchannel ? TrackSubchannelType.RawInterleaved : TrackSubchannelType.None,
TrackType = rawCompactDisc
? (mode2 ? TrackType.CdMode2Formless : TrackType.CdMode1)
? mode2
? TrackType.CdMode2Formless
: TrackType.CdMode1
: TrackType.Data,
TrackSession = 1
};
@@ -114,7 +120,11 @@ namespace DiscImageChef.DiscImages
Length = imageInfo.Sectors,
Offset = 0,
Sequence = 0,
Type = rawCompactDisc ? (mode2 ? "MODE2/2352" : "MODE1/2352") : "MODE1/2048",
Type = rawCompactDisc
? mode2
? "MODE2/2352"
: "MODE1/2352"
: "MODE1/2048",
Size = imageInfo.Sectors * imageInfo.SectorSize
};
parts.Add(part);
@@ -161,8 +171,8 @@ namespace DiscImageChef.DiscImages
}
}
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
new (string name, Type type, string description, object @default)[] { };
public IEnumerable<string> KnownExtensions =>
new[] {".adf", ".adl", ".d81", ".dsk", ".hdf", ".ima", ".img", ".iso", ".ssd", ".st"};
public bool IsWriting { get; private set; }

View File

@@ -65,14 +65,16 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Read/Write media images options:");
foreach(KeyValuePair<string, IWritableImage> kvp in plugins.WritableImages)
{
List<(string name, Type type, string description)> options = kvp.Value.SupportedOptions.ToList();
List<(string name, Type type, string description, object @default)> options =
kvp.Value.SupportedOptions.ToList();
if(options.Count == 0) continue;
DicConsole.WriteLine("\tOptions for {0}:", kvp.Value.Name);
DicConsole.WriteLine("\t\t{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("\t\t{0,-16} {1,-16} {2,-8}", option.name, TypeToString(option.type),
option.description);
DicConsole.WriteLine("\t\t{0,-20} {1,-10} {2,-12} {3,-8}", "Name", "Type", "Default", "Description");
foreach((string name, Type type, string description, object @default) option in
options.OrderBy(t => t.name))
DicConsole.WriteLine("\t\t{0,-20} {1,-10} {2,-12} {3,-8}", option.name, TypeToString(option.type),
option.@default, option.description);
DicConsole.WriteLine();
}
}
@@ -89,7 +91,7 @@ namespace DiscImageChef.Commands
if(type == typeof(float) || type == typeof(double)) return "float number";
if(type == typeof(Guid)) return "float number";
if(type == typeof(Guid)) return "uuid";
return type == typeof(string) ? "string" : type.ToString();
}