mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add option to not compress dicformat.
This commit is contained in:
@@ -190,6 +190,7 @@ namespace DiscImageChef.DiscImages
|
|||||||
/// <summary>In-memory deduplication table</summary>
|
/// <summary>In-memory deduplication table</summary>
|
||||||
ulong[] userDataDdt;
|
ulong[] userDataDdt;
|
||||||
bool writingLong;
|
bool writingLong;
|
||||||
|
bool nocompress;
|
||||||
|
|
||||||
public DiscImageChef()
|
public DiscImageChef()
|
||||||
{
|
{
|
||||||
@@ -1893,7 +1894,8 @@ namespace DiscImageChef.DiscImages
|
|||||||
("sha256", typeof(bool), "Calculate and store SHA256 of image's user data"),
|
("sha256", typeof(bool), "Calculate and store SHA256 of image's user data"),
|
||||||
("spamsum", typeof(bool), "Calculate and store SpamSum of image's user data"),
|
("spamsum", typeof(bool), "Calculate and store SpamSum of image's user data"),
|
||||||
("deduplicate", typeof(bool),
|
("deduplicate", typeof(bool),
|
||||||
"Store only unique sectors. This consumes more memory and is slower, but it's enabled by default")
|
"Store only unique sectors. This consumes more memory and is slower, but it's enabled by default"),
|
||||||
|
("nocompress", typeof(bool), "Don't compress user data blocks. Other blocks will still be compressed")
|
||||||
};
|
};
|
||||||
public IEnumerable<string> KnownExtensions => new[] {".dicf"};
|
public IEnumerable<string> KnownExtensions => new[] {".dicf"};
|
||||||
public bool IsWriting { get; private set; }
|
public bool IsWriting { get; private set; }
|
||||||
@@ -1991,6 +1993,16 @@ namespace DiscImageChef.DiscImages
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else deduplicate = true;
|
else deduplicate = true;
|
||||||
|
|
||||||
|
if(options.TryGetValue("nocompress", out tmpValue))
|
||||||
|
{
|
||||||
|
if(!bool.TryParse(tmpValue, out nocompress))
|
||||||
|
{
|
||||||
|
ErrorMessage = "Invalid value for nocompress option";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else nocompress = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2002,6 +2014,7 @@ namespace DiscImageChef.DiscImages
|
|||||||
doSha256 = false;
|
doSha256 = false;
|
||||||
doSpamsum = false;
|
doSpamsum = false;
|
||||||
deduplicate = true;
|
deduplicate = true;
|
||||||
|
nocompress = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This really, cannot happen
|
// This really, cannot happen
|
||||||
@@ -2688,7 +2701,7 @@ namespace DiscImageChef.DiscImages
|
|||||||
Array.Copy(blockStream.GetBuffer(), 0, buffer, 0, realLength);
|
Array.Copy(blockStream.GetBuffer(), 0, buffer, 0, realLength);
|
||||||
blockStream = new MemoryStream(buffer);
|
blockStream = new MemoryStream(buffer);
|
||||||
}
|
}
|
||||||
else
|
else if(currentBlockHeader.compression == CompressionType.Lzma)
|
||||||
{
|
{
|
||||||
lzmaProperties = lzmaBlockStream.Properties;
|
lzmaProperties = lzmaBlockStream.Properties;
|
||||||
lzmaBlockStream.Close();
|
lzmaBlockStream.Close();
|
||||||
@@ -2741,11 +2754,11 @@ namespace DiscImageChef.DiscImages
|
|||||||
{
|
{
|
||||||
identifier = BlockType.DataBlock,
|
identifier = BlockType.DataBlock,
|
||||||
type = DataType.UserData,
|
type = DataType.UserData,
|
||||||
compression = CompressionType.Lzma,
|
compression = nocompress ? CompressionType.None : CompressionType.Lzma,
|
||||||
sectorSize = (uint)data.Length
|
sectorSize = (uint)data.Length
|
||||||
};
|
};
|
||||||
|
|
||||||
if(imageInfo.XmlMediaType == XmlMediaType.OpticalDisc && trk.TrackType == TrackType.Audio)
|
if(imageInfo.XmlMediaType == XmlMediaType.OpticalDisc && trk.TrackType == TrackType.Audio && !nocompress)
|
||||||
currentBlockHeader.compression = CompressionType.Flac;
|
currentBlockHeader.compression = CompressionType.Flac;
|
||||||
|
|
||||||
blockStream = new MemoryStream();
|
blockStream = new MemoryStream();
|
||||||
@@ -2767,6 +2780,7 @@ namespace DiscImageChef.DiscImages
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
decompressedStream.Write(data, 0, data.Length);
|
decompressedStream.Write(data, 0, data.Length);
|
||||||
|
if(currentBlockHeader.compression == CompressionType.Lzma)
|
||||||
lzmaBlockStream.Write(data, 0, data.Length);
|
lzmaBlockStream.Write(data, 0, data.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3110,7 +3124,7 @@ namespace DiscImageChef.DiscImages
|
|||||||
Array.Copy(blockStream.GetBuffer(), 0, buffer, 0, realLength);
|
Array.Copy(blockStream.GetBuffer(), 0, buffer, 0, realLength);
|
||||||
blockStream = new MemoryStream(buffer);
|
blockStream = new MemoryStream(buffer);
|
||||||
}
|
}
|
||||||
else
|
else if(currentBlockHeader.compression == CompressionType.Lzma)
|
||||||
{
|
{
|
||||||
lzmaProperties = lzmaBlockStream.Properties;
|
lzmaProperties = lzmaBlockStream.Properties;
|
||||||
lzmaBlockStream.Close();
|
lzmaBlockStream.Close();
|
||||||
|
|||||||
Reference in New Issue
Block a user