nocompress => !compress

This commit is contained in:
2020-03-10 00:04:19 +00:00
parent 563d391f5a
commit 0a0d458f91
3 changed files with 20 additions and 20 deletions

View File

@@ -92,6 +92,7 @@ namespace Aaru.DiscImages
MemoryStream blockStream;
/// <summary>Provides checksum for deduplication of sectors.</summary>
SHA256 checksumProvider;
bool compress;
/// <summary>Provides CRC64.</summary>
Crc64Context crc64;
/// <summary>Header of the currently writing block.</summary>
@@ -131,7 +132,6 @@ namespace Aaru.DiscImages
/// <summary>Cache of media tags.</summary>
Dictionary<MediaTagType, byte[]> mediaTags;
byte[] mode2Subheaders;
bool nocompress;
/// <summary>If DDT is on-disk, this is the image stream offset at which it starts.</summary>
long outMemoryDdtPosition;
bool rewinded;

View File

@@ -71,8 +71,8 @@ namespace Aaru.DiscImages
("deduplicate", typeof(bool),
"Store only unique sectors. This consumes more memory and is slower, but it's enabled by default",
(object)true),
("nocompress", typeof(bool), "Don't compress user data blocks. Other blocks will still be compressed",
(object)false)
("compress", typeof(bool), "Compress user data blocks. Other blocks will always be compressed",
(object)true)
};
public IEnumerable<string> KnownExtensions => new[]
{

View File

@@ -166,17 +166,17 @@ namespace Aaru.DiscImages
else
deduplicate = true;
if(options.TryGetValue("nocompress", out tmpValue))
if(options.TryGetValue("compress", out tmpValue))
{
if(!bool.TryParse(tmpValue, out nocompress))
if(!bool.TryParse(tmpValue, out compress))
{
ErrorMessage = "Invalid value for nocompress option";
ErrorMessage = "Invalid value for compress option";
return false;
}
}
else
nocompress = false;
compress = true;
}
else
{
@@ -188,7 +188,7 @@ namespace Aaru.DiscImages
doSha256 = false;
doSpamsum = false;
deduplicate = true;
nocompress = false;
compress = true;
}
// This really, cannot happen
@@ -1125,14 +1125,14 @@ namespace Aaru.DiscImages
{
currentBlockHeader = new BlockHeader
{
identifier = BlockType.DataBlock, type = DataType.UserData,
compression = nocompress ? CompressionType.None : CompressionType.Lzma,
sectorSize = (uint)data.Length
identifier = BlockType.DataBlock,
type = DataType.UserData,
compression = compress ? CompressionType.Lzma : CompressionType.None, sectorSize = (uint)data.Length
};
if(imageInfo.XmlMediaType == XmlMediaType.OpticalDisc &&
trk.TrackType == TrackType.Audio &&
!nocompress)
compress)
currentBlockHeader.compression = CompressionType.Flac;
// JaguarCD stores data in audio tracks. FLAC is too inefficient, use LZMA there.
@@ -1142,7 +1142,7 @@ namespace Aaru.DiscImages
imageInfo.MediaType == MediaType.VideoNowColor ||
imageInfo.MediaType == MediaType.VideoNowXp) &&
trk.TrackType == TrackType.Audio &&
!nocompress &&
compress &&
currentBlockHeader.compression == CompressionType.Flac)
currentBlockHeader.compression = CompressionType.Lzma;
@@ -2416,7 +2416,7 @@ namespace Aaru.DiscImages
byte[] lzmaProperties = null;
if(nocompress)
if(!compress)
{
prefixBlock.compression = CompressionType.None;
prefixBlock.cmpCrc64 = prefixBlock.crc64;
@@ -2479,7 +2479,7 @@ namespace Aaru.DiscImages
sectorSize = 288
};
if(nocompress)
if(!compress)
{
prefixBlock.compression = CompressionType.None;
prefixBlock.cmpCrc64 = prefixBlock.crc64;
@@ -2699,7 +2699,7 @@ namespace Aaru.DiscImages
lzmaProperties = null;
if(nocompress)
if(!compress)
{
prefixBlock.compression = CompressionType.None;
prefixBlock.cmpCrc64 = prefixBlock.crc64;
@@ -2766,7 +2766,7 @@ namespace Aaru.DiscImages
lzmaProperties = null;
if(nocompress)
if(!compress)
{
suffixBlock.compression = CompressionType.None;
suffixBlock.cmpCrc64 = suffixBlock.crc64;
@@ -2836,7 +2836,7 @@ namespace Aaru.DiscImages
byte[] lzmaProperties = null;
if(nocompress)
if(!compress)
{
subheaderBlock.compression = CompressionType.None;
subheaderBlock.cmpCrc64 = subheaderBlock.crc64;
@@ -2906,7 +2906,7 @@ namespace Aaru.DiscImages
byte[] lzmaProperties = null;
if(nocompress)
if(!compress)
{
subchannelBlock.compression = CompressionType.None;
subchannelBlock.cmpCrc64 = subchannelBlock.crc64;
@@ -3090,7 +3090,7 @@ namespace Aaru.DiscImages
byte[] lzmaProperties = null;
if(nocompress)
if(!compress)
{
subchannelBlock.compression = CompressionType.None;
subchannelBlock.cmpCrc64 = subchannelBlock.crc64;