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:
@@ -111,7 +111,7 @@ public sealed partial class Blu
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool WriteSector(byte[] data, ulong sectorAddress, SectorStatus sectorStatus)
|
||||
public bool WriteSector(byte[] data, ulong sectorAddress, bool negative, SectorStatus sectorStatus)
|
||||
{
|
||||
int longSectorSize = _imageInfo.MediaType == MediaType.PriamDataTower ? 536 : 532;
|
||||
|
||||
@@ -122,6 +122,13 @@ public sealed partial class Blu
|
||||
return false;
|
||||
}
|
||||
|
||||
if(negative)
|
||||
{
|
||||
ErrorMessage = Localization.Unsupported_feature;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if(data.Length != 512)
|
||||
{
|
||||
ErrorMessage = Localization.Incorrect_data_size;
|
||||
@@ -145,7 +152,7 @@ public sealed partial class Blu
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
int longSectorSize = _imageInfo.MediaType == MediaType.PriamDataTower ? 536 : 532;
|
||||
|
||||
@@ -156,6 +163,13 @@ public sealed partial class Blu
|
||||
return false;
|
||||
}
|
||||
|
||||
if(negative)
|
||||
{
|
||||
ErrorMessage = Localization.Unsupported_feature;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if(data.Length % 512 != 0)
|
||||
{
|
||||
ErrorMessage = Localization.Incorrect_data_size;
|
||||
@@ -179,7 +193,7 @@ public sealed partial class Blu
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool WriteSectorLong(byte[] data, ulong sectorAddress, SectorStatus sectorStatus)
|
||||
public bool WriteSectorLong(byte[] data, ulong sectorAddress, bool negative, SectorStatus sectorStatus)
|
||||
{
|
||||
if(!IsWriting)
|
||||
{
|
||||
@@ -188,6 +202,13 @@ public sealed partial class Blu
|
||||
return false;
|
||||
}
|
||||
|
||||
if(negative)
|
||||
{
|
||||
ErrorMessage = Localization.Unsupported_feature;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if(sectorAddress >= _imageInfo.Sectors)
|
||||
{
|
||||
ErrorMessage = Localization.Tried_to_write_past_image_size;
|
||||
@@ -269,7 +290,8 @@ public sealed partial class Blu
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
if(!IsWriting)
|
||||
{
|
||||
@@ -278,6 +300,13 @@ public sealed partial class Blu
|
||||
return false;
|
||||
}
|
||||
|
||||
if(negative)
|
||||
{
|
||||
ErrorMessage = Localization.Unsupported_feature;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if(sectorAddress + length > _imageInfo.Sectors)
|
||||
{
|
||||
ErrorMessage = Localization.Tried_to_write_past_image_size;
|
||||
@@ -444,7 +473,7 @@ public sealed partial class Blu
|
||||
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.Unsupported_feature;
|
||||
|
||||
@@ -452,7 +481,7 @@ public sealed partial class Blu
|
||||
}
|
||||
|
||||
/// <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.Unsupported_feature;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user