mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Implement abortion in image convertion process.
This commit is contained in:
@@ -15,6 +15,8 @@ public partial class Convert
|
||||
/// <returns>Error if required features not supported and data would be lost</returns>
|
||||
ErrorNumber ValidateMediaCapabilities()
|
||||
{
|
||||
if(_aborted) return ErrorNumber.NoError;
|
||||
|
||||
if(!_outputImage.SupportedMediaTypes.Contains(_mediaType))
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(UI.Output_format_does_not_support_media_type);
|
||||
@@ -22,8 +24,11 @@ public partial class Convert
|
||||
return ErrorNumber.UnsupportedMedia;
|
||||
}
|
||||
|
||||
foreach(MediaTagType mediaTag in _inputImage.Info.ReadableMediaTags.Where(mediaTag =>
|
||||
!_outputImage.SupportedMediaTags.Contains(mediaTag) && !_force))
|
||||
foreach(MediaTagType mediaTag in _inputImage.Info.ReadableMediaTags
|
||||
.Where(mediaTag =>
|
||||
!_outputImage.SupportedMediaTags.Contains(mediaTag) &&
|
||||
!_force)
|
||||
.TakeWhile(_ => !_aborted))
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(string.Format(UI.Converting_image_will_lose_media_tag_0 +
|
||||
Environment.NewLine +
|
||||
@@ -36,17 +41,23 @@ public partial class Convert
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validates sector tag compatibility between formats
|
||||
/// Sets useLong flag based on sector tag support to determine sector size (512 vs 2352 bytes)
|
||||
/// Some tags like CD flags/ISRC don't require long sectors; subchannel data does
|
||||
/// In force mode, skips unsupported tags; otherwise reports error if data would be lost
|
||||
/// </summary>
|
||||
/// <param name="useLong"></param>
|
||||
ErrorNumber ValidateSectorTags(out bool useLong)
|
||||
{
|
||||
// Validates sector tag compatibility between formats
|
||||
// Sets useLong flag based on sector tag support to determine sector size (512 vs 2352 bytes)
|
||||
// Some tags like CD flags/ISRC don't require long sectors; subchannel data does
|
||||
// In force mode, skips unsupported tags; otherwise reports error if data would be lost
|
||||
|
||||
useLong = _inputImage.Info.ReadableSectorTags.Count != 0;
|
||||
|
||||
foreach(SectorTagType sectorTag in _inputImage.Info.ReadableSectorTags.Where(sectorTag =>
|
||||
!_outputImage.SupportedSectorTags.Contains(sectorTag)))
|
||||
if(_aborted) return ErrorNumber.NoError;
|
||||
|
||||
foreach(SectorTagType sectorTag in _inputImage.Info.ReadableSectorTags
|
||||
.Where(sectorTag =>
|
||||
!_outputImage.SupportedSectorTags.Contains(sectorTag))
|
||||
.TakeWhile(_ => !_aborted))
|
||||
{
|
||||
if(_force)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user