mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add support for negative sectors to read and write sector calls in images.
This commit is contained in:
@@ -146,7 +146,7 @@ public sealed partial class Qed
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool WriteSector(byte[] data, ulong sectorAddress, SectorStatus sectorStatus)
|
||||
public bool WriteSector(byte[] data, ulong sectorAddress, bool negative, SectorStatus sectorStatus)
|
||||
{
|
||||
if(!IsWriting)
|
||||
{
|
||||
@@ -155,6 +155,13 @@ public sealed partial class Qed
|
||||
return false;
|
||||
}
|
||||
|
||||
if(negative)
|
||||
{
|
||||
ErrorMessage = Localization.Unsupported_feature;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if(data.Length != _imageInfo.SectorSize)
|
||||
{
|
||||
ErrorMessage = Localization.Incorrect_data_size;
|
||||
@@ -225,7 +232,7 @@ public sealed partial class Qed
|
||||
|
||||
// TODO: This can be optimized
|
||||
/// <inheritdoc />
|
||||
public bool WriteSectors(byte[] data, ulong sectorAddress, uint length, SectorStatus[] sectorStatus)
|
||||
public bool WriteSectors(byte[] data, ulong sectorAddress, bool negative, uint length, SectorStatus[] sectorStatus)
|
||||
{
|
||||
if(!IsWriting)
|
||||
{
|
||||
@@ -234,6 +241,13 @@ public sealed partial class Qed
|
||||
return false;
|
||||
}
|
||||
|
||||
if(negative)
|
||||
{
|
||||
ErrorMessage = Localization.Unsupported_feature;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if(data.Length % _imageInfo.SectorSize != 0)
|
||||
{
|
||||
ErrorMessage = Localization.Incorrect_data_size;
|
||||
@@ -256,7 +270,7 @@ public sealed partial class Qed
|
||||
var tmp = new byte[_imageInfo.SectorSize];
|
||||
Array.Copy(data, i * _imageInfo.SectorSize, tmp, 0, _imageInfo.SectorSize);
|
||||
|
||||
if(!WriteSector(tmp, sectorAddress + i, sectorStatus[i])) return false;
|
||||
if(!WriteSector(tmp, sectorAddress + i, false, sectorStatus[i])) return false;
|
||||
}
|
||||
|
||||
ErrorMessage = "";
|
||||
@@ -265,7 +279,7 @@ public sealed partial class Qed
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool WriteSectorLong(byte[] data, ulong sectorAddress, SectorStatus sectorStatus)
|
||||
public bool WriteSectorLong(byte[] data, ulong sectorAddress, bool negative, SectorStatus sectorStatus)
|
||||
{
|
||||
ErrorMessage = Localization.Writing_sectors_with_tags_is_not_supported;
|
||||
|
||||
@@ -273,7 +287,8 @@ public sealed partial class Qed
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool WriteSectorsLong(byte[] data, ulong sectorAddress, uint length, SectorStatus[] sectorStatus)
|
||||
public bool WriteSectorsLong(byte[] data, ulong sectorAddress, bool negative, uint length,
|
||||
SectorStatus[] sectorStatus)
|
||||
{
|
||||
ErrorMessage = Localization.Writing_sectors_with_tags_is_not_supported;
|
||||
|
||||
@@ -316,7 +331,7 @@ public sealed partial class Qed
|
||||
public bool SetGeometry(uint cylinders, uint heads, uint sectorsPerTrack) => true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool WriteSectorTag(byte[] data, ulong sectorAddress, SectorTagType tag)
|
||||
public bool WriteSectorTag(byte[] data, ulong sectorAddress, bool negative, SectorTagType tag)
|
||||
{
|
||||
ErrorMessage = Localization.Writing_sectors_with_tags_is_not_supported;
|
||||
|
||||
@@ -324,7 +339,7 @@ public sealed partial class Qed
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool WriteSectorsTag(byte[] data, ulong sectorAddress, uint length, SectorTagType tag)
|
||||
public bool WriteSectorsTag(byte[] data, ulong sectorAddress, bool negative, uint length, SectorTagType tag)
|
||||
{
|
||||
ErrorMessage = Localization.Writing_sectors_with_tags_is_not_supported;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user