mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Validate tape status before adding files and partitions
This commit is contained in:
@@ -12,6 +12,13 @@ public sealed partial class AaruFormat
|
||||
/// <inheritdoc />
|
||||
public bool AddFile(TapeFile file)
|
||||
{
|
||||
if(!IsTape)
|
||||
{
|
||||
ErrorMessage = "Image is not a tape";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Status res = aaruf_set_tape_file(_context, file.Partition, file.File, file.FirstBlock, file.LastBlock);
|
||||
|
||||
ErrorMessage = StatusToErrorMessage(res);
|
||||
@@ -22,6 +29,13 @@ public sealed partial class AaruFormat
|
||||
/// <inheritdoc />
|
||||
public bool AddPartition(TapePartition partition)
|
||||
{
|
||||
if(!IsTape)
|
||||
{
|
||||
ErrorMessage = "Image is not a tape";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Status res = aaruf_set_tape_partition(_context, partition.Number, partition.FirstBlock, partition.LastBlock);
|
||||
|
||||
ErrorMessage = StatusToErrorMessage(res);
|
||||
|
||||
Reference in New Issue
Block a user