mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add support for setting sector size on IWritableImage.
This commit is contained in:
@@ -793,7 +793,8 @@ namespace DiscImageChef.DiscImages
|
|||||||
public bool IsWriting { get; private set; }
|
public bool IsWriting { get; private set; }
|
||||||
public string ErrorMessage { get; private set; }
|
public string ErrorMessage { get; private set; }
|
||||||
|
|
||||||
public bool Create(string path, MediaType mediaType, Dictionary<string, string> options, ulong sectors)
|
public bool Create(string path, MediaType mediaType, Dictionary<string, string> options, ulong sectors,
|
||||||
|
uint sectorSize)
|
||||||
{
|
{
|
||||||
header = new Dc42Header();
|
header = new Dc42Header();
|
||||||
bool tags = false;
|
bool tags = false;
|
||||||
@@ -802,6 +803,12 @@ namespace DiscImageChef.DiscImages
|
|||||||
if(options != null && options.TryGetValue("macosx", out string tmpOption))
|
if(options != null && options.TryGetValue("macosx", out string tmpOption))
|
||||||
bool.TryParse(tmpOption, out macosx);
|
bool.TryParse(tmpOption, out macosx);
|
||||||
|
|
||||||
|
if(sectorSize != 512)
|
||||||
|
{
|
||||||
|
ErrorMessage = "Unsupported sector size";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
switch(mediaType)
|
switch(mediaType)
|
||||||
{
|
{
|
||||||
case MediaType.AppleFileWare:
|
case MediaType.AppleFileWare:
|
||||||
|
|||||||
@@ -74,8 +74,10 @@ namespace DiscImageChef.DiscImages
|
|||||||
/// <param name="mediaType"><see cref="MediaType" /> that will be written in the image</param>
|
/// <param name="mediaType"><see cref="MediaType" /> that will be written in the image</param>
|
||||||
/// <param name="options">Options to be used when creating new image</param>
|
/// <param name="options">Options to be used when creating new image</param>
|
||||||
/// <param name="sectors">How many sectors the media has.</param>
|
/// <param name="sectors">How many sectors the media has.</param>
|
||||||
|
/// <param name="sectorSize"></param>
|
||||||
/// <returns><c>true</c> if operating completed successfully, <c>false</c> otherwise</returns>
|
/// <returns><c>true</c> if operating completed successfully, <c>false</c> otherwise</returns>
|
||||||
bool Create(string path, MediaType mediaType, Dictionary<string, string> options, ulong sectors);
|
bool Create(string path, MediaType mediaType, Dictionary<string, string> options, ulong sectors,
|
||||||
|
uint sectorSize);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes a media tag to the image
|
/// Writes a media tag to the image
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ namespace DiscImageChef.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!outputFormat.Create(options.OutputFile, inputFormat.Info.MediaType, new Dictionary<string, string>(),
|
if(!outputFormat.Create(options.OutputFile, inputFormat.Info.MediaType, new Dictionary<string, string>(),
|
||||||
inputFormat.Info.Sectors))
|
inputFormat.Info.Sectors, inputFormat.Info.SectorSize))
|
||||||
{
|
{
|
||||||
DicConsole.ErrorWriteLine("Error {0} creating output image.", outputFormat.ErrorMessage);
|
DicConsole.ErrorWriteLine("Error {0} creating output image.", outputFormat.ErrorMessage);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user