mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-11-15 17:02:03 +00:00
Doing some resharper clean up
This commit is contained in:
@@ -61,18 +61,12 @@ namespace SharpCompress.Archives
|
||||
|
||||
void IArchiveExtractionListener.FireEntryExtractionBegin(IArchiveEntry entry)
|
||||
{
|
||||
if (EntryExtractionBegin != null)
|
||||
{
|
||||
EntryExtractionBegin(this, new ArchiveExtractionEventArgs<IArchiveEntry>(entry));
|
||||
}
|
||||
EntryExtractionBegin?.Invoke(this, new ArchiveExtractionEventArgs<IArchiveEntry>(entry));
|
||||
}
|
||||
|
||||
void IArchiveExtractionListener.FireEntryExtractionEnd(IArchiveEntry entry)
|
||||
{
|
||||
if (EntryExtractionEnd != null)
|
||||
{
|
||||
EntryExtractionEnd(this, new ArchiveExtractionEventArgs<IArchiveEntry>(entry));
|
||||
}
|
||||
EntryExtractionEnd?.Invoke(this, new ArchiveExtractionEventArgs<IArchiveEntry>(entry));
|
||||
}
|
||||
|
||||
private static Stream CheckStreams(Stream stream)
|
||||
@@ -129,27 +123,21 @@ namespace SharpCompress.Archives
|
||||
|
||||
void IExtractionListener.FireCompressedBytesRead(long currentPartCompressedBytes, long compressedReadBytes)
|
||||
{
|
||||
if (CompressedBytesRead != null)
|
||||
CompressedBytesRead?.Invoke(this, new CompressedBytesReadEventArgs
|
||||
{
|
||||
CompressedBytesRead(this, new CompressedBytesReadEventArgs
|
||||
{
|
||||
CurrentFilePartCompressedBytesRead = currentPartCompressedBytes,
|
||||
CompressedBytesRead = compressedReadBytes
|
||||
});
|
||||
}
|
||||
CurrentFilePartCompressedBytesRead = currentPartCompressedBytes,
|
||||
CompressedBytesRead = compressedReadBytes
|
||||
});
|
||||
}
|
||||
|
||||
void IExtractionListener.FireFilePartExtractionBegin(string name, long size, long compressedSize)
|
||||
{
|
||||
if (FilePartExtractionBegin != null)
|
||||
FilePartExtractionBegin?.Invoke(this, new FilePartExtractionBeginEventArgs
|
||||
{
|
||||
FilePartExtractionBegin(this, new FilePartExtractionBeginEventArgs
|
||||
{
|
||||
CompressedSize = compressedSize,
|
||||
Size = size,
|
||||
Name = name
|
||||
});
|
||||
}
|
||||
CompressedSize = compressedSize,
|
||||
Size = size,
|
||||
Name = name
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace SharpCompress.Archives.GZip
|
||||
|
||||
public IArchive Archive { get; }
|
||||
|
||||
public bool IsComplete { get { return true; } }
|
||||
public bool IsComplete => true;
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -22,31 +22,31 @@ namespace SharpCompress.Archives.GZip
|
||||
this.closeStream = closeStream;
|
||||
}
|
||||
|
||||
public override long Crc { get { return 0; } }
|
||||
public override long Crc => 0;
|
||||
|
||||
public override string Key { get; }
|
||||
|
||||
public override long CompressedSize { get { return 0; } }
|
||||
public override long CompressedSize => 0;
|
||||
|
||||
public override long Size { get; }
|
||||
|
||||
public override DateTime? LastModifiedTime { get; }
|
||||
|
||||
public override DateTime? CreatedTime { get { return null; } }
|
||||
public override DateTime? CreatedTime => null;
|
||||
|
||||
public override DateTime? LastAccessedTime { get { return null; } }
|
||||
public override DateTime? LastAccessedTime => null;
|
||||
|
||||
public override DateTime? ArchivedTime { get { return null; } }
|
||||
public override DateTime? ArchivedTime => null;
|
||||
|
||||
public override bool IsEncrypted { get { return false; } }
|
||||
public override bool IsEncrypted => false;
|
||||
|
||||
public override bool IsDirectory { get { return false; } }
|
||||
public override bool IsDirectory => false;
|
||||
|
||||
public override bool IsSplit { get { return false; } }
|
||||
public override bool IsSplit => false;
|
||||
|
||||
internal override IEnumerable<FilePart> Parts { get { throw new NotImplementedException(); } }
|
||||
internal override IEnumerable<FilePart> Parts => throw new NotImplementedException();
|
||||
|
||||
Stream IWritableArchiveEntry.Stream { get { return stream; } }
|
||||
Stream IWritableArchiveEntry.Stream => stream;
|
||||
|
||||
public override Stream OpenEntryStream()
|
||||
{
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace SharpCompress.Archives.Rar
|
||||
return RarReader.Open(stream, ReaderOptions);
|
||||
}
|
||||
|
||||
public override bool IsSolid { get { return Volumes.First().IsSolidArchive; } }
|
||||
public override bool IsSolid => Volumes.First().IsSolidArchive;
|
||||
|
||||
#region Creation
|
||||
|
||||
|
||||
@@ -20,13 +20,13 @@ namespace SharpCompress.Archives.Rar
|
||||
this.archive = archive;
|
||||
}
|
||||
|
||||
public override CompressionType CompressionType { get { return CompressionType.Rar; } }
|
||||
public override CompressionType CompressionType => CompressionType.Rar;
|
||||
|
||||
public IArchive Archive { get { return archive; } }
|
||||
public IArchive Archive => archive;
|
||||
|
||||
internal override IEnumerable<FilePart> Parts { get { return parts.Cast<FilePart>(); } }
|
||||
internal override IEnumerable<FilePart> Parts => parts.Cast<FilePart>();
|
||||
|
||||
internal override FileHeader FileHeader { get { return parts.First().FileHeader; } }
|
||||
internal override FileHeader FileHeader => parts.First().FileHeader;
|
||||
|
||||
public override long Crc
|
||||
{
|
||||
|
||||
@@ -28,6 +28,6 @@ namespace SharpCompress.Archives.Rar
|
||||
return stream;
|
||||
}
|
||||
|
||||
internal override string FilePartName { get { return "Unknown Stream - File Entry: " + FileHeader.FileName; } }
|
||||
internal override string FilePartName => "Unknown Stream - File Entry: " + FileHeader.FileName;
|
||||
}
|
||||
}
|
||||
@@ -171,7 +171,7 @@ namespace SharpCompress.Archives.SevenZip
|
||||
this.archive = archive;
|
||||
}
|
||||
|
||||
public override SevenZipVolume Volume { get { return archive.Volumes.Single(); } }
|
||||
public override SevenZipVolume Volume => archive.Volumes.Single();
|
||||
|
||||
internal override IEnumerable<SevenZipEntry> GetEntries(Stream stream)
|
||||
{
|
||||
|
||||
@@ -18,11 +18,11 @@ namespace SharpCompress.Archives.SevenZip
|
||||
|
||||
public IArchive Archive { get; }
|
||||
|
||||
public bool IsComplete { get { return true; } }
|
||||
public bool IsComplete => true;
|
||||
|
||||
/// <summary>
|
||||
/// This is a 7Zip Anti item
|
||||
/// </summary>
|
||||
public bool IsAnti { get { return FilePart.Header.IsAnti; } }
|
||||
public bool IsAnti => FilePart.Header.IsAnti;
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ namespace SharpCompress.Archives.Tar
|
||||
|
||||
public IArchive Archive { get; }
|
||||
|
||||
public bool IsComplete { get { return true; } }
|
||||
public bool IsComplete => true;
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -22,30 +22,30 @@ namespace SharpCompress.Archives.Tar
|
||||
this.closeStream = closeStream;
|
||||
}
|
||||
|
||||
public override long Crc { get { return 0; } }
|
||||
public override long Crc => 0;
|
||||
|
||||
public override string Key { get; }
|
||||
|
||||
public override long CompressedSize { get { return 0; } }
|
||||
public override long CompressedSize => 0;
|
||||
|
||||
public override long Size { get; }
|
||||
|
||||
public override DateTime? LastModifiedTime { get; }
|
||||
|
||||
public override DateTime? CreatedTime { get { return null; } }
|
||||
public override DateTime? CreatedTime => null;
|
||||
|
||||
public override DateTime? LastAccessedTime { get { return null; } }
|
||||
public override DateTime? LastAccessedTime => null;
|
||||
|
||||
public override DateTime? ArchivedTime { get { return null; } }
|
||||
public override DateTime? ArchivedTime => null;
|
||||
|
||||
public override bool IsEncrypted { get { return false; } }
|
||||
public override bool IsEncrypted => false;
|
||||
|
||||
public override bool IsDirectory { get { return false; } }
|
||||
public override bool IsDirectory => false;
|
||||
|
||||
public override bool IsSplit { get { return false; } }
|
||||
public override bool IsSplit => false;
|
||||
|
||||
internal override IEnumerable<FilePart> Parts { get { throw new NotImplementedException(); } }
|
||||
Stream IWritableArchiveEntry.Stream { get { return stream; } }
|
||||
internal override IEnumerable<FilePart> Parts => throw new NotImplementedException();
|
||||
Stream IWritableArchiveEntry.Stream => stream;
|
||||
|
||||
public override Stream OpenEntryStream()
|
||||
{
|
||||
|
||||
@@ -21,10 +21,10 @@ namespace SharpCompress.Archives.Zip
|
||||
|
||||
public IArchive Archive { get; }
|
||||
|
||||
public bool IsComplete { get { return true; } }
|
||||
public bool IsComplete => true;
|
||||
|
||||
#endregion
|
||||
|
||||
public string Comment { get { return (Parts.Single() as SeekableZipFilePart).Comment; } }
|
||||
public string Comment => (Parts.Single() as SeekableZipFilePart).Comment;
|
||||
}
|
||||
}
|
||||
@@ -23,31 +23,31 @@ namespace SharpCompress.Archives.Zip
|
||||
this.closeStream = closeStream;
|
||||
}
|
||||
|
||||
public override long Crc { get { return 0; } }
|
||||
public override long Crc => 0;
|
||||
|
||||
public override string Key { get; }
|
||||
|
||||
public override long CompressedSize { get { return 0; } }
|
||||
public override long CompressedSize => 0;
|
||||
|
||||
public override long Size { get; }
|
||||
|
||||
public override DateTime? LastModifiedTime { get; }
|
||||
|
||||
public override DateTime? CreatedTime { get { return null; } }
|
||||
public override DateTime? CreatedTime => null;
|
||||
|
||||
public override DateTime? LastAccessedTime { get { return null; } }
|
||||
public override DateTime? LastAccessedTime => null;
|
||||
|
||||
public override DateTime? ArchivedTime { get { return null; } }
|
||||
public override DateTime? ArchivedTime => null;
|
||||
|
||||
public override bool IsEncrypted { get { return false; } }
|
||||
public override bool IsEncrypted => false;
|
||||
|
||||
public override bool IsDirectory { get { return false; } }
|
||||
public override bool IsDirectory => false;
|
||||
|
||||
public override bool IsSplit { get { return false; } }
|
||||
public override bool IsSplit => false;
|
||||
|
||||
internal override IEnumerable<FilePart> Parts { get { throw new NotImplementedException(); } }
|
||||
internal override IEnumerable<FilePart> Parts => throw new NotImplementedException();
|
||||
|
||||
Stream IWritableArchiveEntry.Stream { get { return stream; } }
|
||||
Stream IWritableArchiveEntry.Stream => stream;
|
||||
|
||||
public override Stream OpenEntryStream()
|
||||
{
|
||||
|
||||
@@ -75,6 +75,6 @@ namespace SharpCompress.Common
|
||||
/// <summary>
|
||||
/// Entry file attribute.
|
||||
/// </summary>
|
||||
public virtual int? Attrib { get { throw new NotImplementedException(); } }
|
||||
public virtual int? Attrib => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -44,20 +44,20 @@ namespace SharpCompress.Common
|
||||
stream.Dispose();
|
||||
}
|
||||
|
||||
public override bool CanRead { get { return true; } }
|
||||
public override bool CanRead => true;
|
||||
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite { get { return false; } }
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override long Length { get { throw new NotSupportedException(); } }
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
public override long Position { get { throw new NotSupportedException(); } set { throw new NotSupportedException(); } }
|
||||
public override long Position { get => throw new NotSupportedException(); set => throw new NotSupportedException(); }
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
|
||||
@@ -13,31 +13,31 @@ namespace SharpCompress.Common.GZip
|
||||
this.filePart = filePart;
|
||||
}
|
||||
|
||||
public override CompressionType CompressionType { get { return CompressionType.GZip; } }
|
||||
public override CompressionType CompressionType => CompressionType.GZip;
|
||||
|
||||
public override long Crc { get { return 0; } }
|
||||
public override long Crc => 0;
|
||||
|
||||
public override string Key { get { return filePart.FilePartName; } }
|
||||
public override string Key => filePart.FilePartName;
|
||||
|
||||
public override long CompressedSize { get { return 0; } }
|
||||
public override long CompressedSize => 0;
|
||||
|
||||
public override long Size { get { return 0; } }
|
||||
public override long Size => 0;
|
||||
|
||||
public override DateTime? LastModifiedTime { get { return filePart.DateModified; } }
|
||||
public override DateTime? LastModifiedTime => filePart.DateModified;
|
||||
|
||||
public override DateTime? CreatedTime { get { return null; } }
|
||||
public override DateTime? CreatedTime => null;
|
||||
|
||||
public override DateTime? LastAccessedTime { get { return null; } }
|
||||
public override DateTime? LastAccessedTime => null;
|
||||
|
||||
public override DateTime? ArchivedTime { get { return null; } }
|
||||
public override DateTime? ArchivedTime => null;
|
||||
|
||||
public override bool IsEncrypted { get { return false; } }
|
||||
public override bool IsEncrypted => false;
|
||||
|
||||
public override bool IsDirectory { get { return false; } }
|
||||
public override bool IsDirectory => false;
|
||||
|
||||
public override bool IsSplit { get { return false; } }
|
||||
public override bool IsSplit => false;
|
||||
|
||||
internal override IEnumerable<FilePart> Parts { get { return filePart.AsEnumerable<FilePart>(); } }
|
||||
internal override IEnumerable<FilePart> Parts => filePart.AsEnumerable<FilePart>();
|
||||
|
||||
internal static IEnumerable<GZipEntry> GetEntries(Stream stream)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace SharpCompress.Common.GZip
|
||||
|
||||
internal DateTime? DateModified { get; private set; }
|
||||
|
||||
internal override string FilePartName { get { return name; } }
|
||||
internal override string FilePartName => name;
|
||||
|
||||
internal override Stream GetCompressedStream()
|
||||
{
|
||||
|
||||
@@ -18,8 +18,8 @@ namespace SharpCompress.Common.GZip
|
||||
}
|
||||
#endif
|
||||
|
||||
public override bool IsFirstVolume { get { return true; } }
|
||||
public override bool IsFirstVolume => true;
|
||||
|
||||
public override bool IsMultiVolume { get { return true; } }
|
||||
public override bool IsMultiVolume => true;
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ namespace SharpCompress.Common.Rar.Headers
|
||||
}
|
||||
}
|
||||
|
||||
internal ArchiveFlags ArchiveHeaderFlags { get { return (ArchiveFlags)Flags; } }
|
||||
internal ArchiveFlags ArchiveHeaderFlags => (ArchiveFlags)Flags;
|
||||
|
||||
internal short HighPosAv { get; private set; }
|
||||
|
||||
@@ -25,6 +25,6 @@ namespace SharpCompress.Common.Rar.Headers
|
||||
|
||||
internal byte EncryptionVersion { get; private set; }
|
||||
|
||||
public bool HasPassword { get { return ArchiveHeaderFlags.HasFlag(ArchiveFlags.PASSWORD); } }
|
||||
public bool HasPassword => ArchiveHeaderFlags.HasFlag(ArchiveFlags.PASSWORD);
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ namespace SharpCompress.Common.Rar.Headers
|
||||
}
|
||||
}
|
||||
|
||||
internal EndArchiveFlags EndArchiveFlags { get { return (EndArchiveFlags)Flags; } }
|
||||
internal EndArchiveFlags EndArchiveFlags => (EndArchiveFlags)Flags;
|
||||
|
||||
internal int? ArchiveCRC { get; private set; }
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ namespace SharpCompress.Common.Rar.Headers
|
||||
|
||||
internal int FileAttributes { get; private set; }
|
||||
|
||||
internal FileFlags FileFlags { get { return (FileFlags)Flags; } }
|
||||
internal FileFlags FileFlags => (FileFlags)Flags;
|
||||
|
||||
internal long CompressedSize { get; private set; }
|
||||
internal long UncompressedSize { get; private set; }
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace SharpCompress.Common.Rar.Headers
|
||||
Mark = reader.ReadBytes(8);
|
||||
}
|
||||
|
||||
internal uint DataSize { get { return AdditionalSize; } }
|
||||
internal uint DataSize => AdditionalSize;
|
||||
internal byte Version { get; private set; }
|
||||
internal ushort RecSectors { get; private set; }
|
||||
internal uint TotalBlocks { get; private set; }
|
||||
|
||||
@@ -12,17 +12,17 @@ namespace SharpCompress.Common.Rar {
|
||||
|
||||
public ushort GetCrc()
|
||||
{
|
||||
return (ushort)~this.currentCrc;
|
||||
return (ushort)~currentCrc;
|
||||
}
|
||||
|
||||
public void ResetCrc()
|
||||
{
|
||||
this.currentCrc = 0xffffffff;
|
||||
currentCrc = 0xffffffff;
|
||||
}
|
||||
|
||||
protected void UpdateCrc(byte b)
|
||||
{
|
||||
this.currentCrc = RarCRC.CheckCrc(this.currentCrc, b);
|
||||
currentCrc = RarCRC.CheckCrc(currentCrc, b);
|
||||
}
|
||||
|
||||
protected byte[] ReadBytesNoCrc(int count)
|
||||
@@ -33,7 +33,7 @@ namespace SharpCompress.Common.Rar {
|
||||
public override byte[] ReadBytes(int count)
|
||||
{
|
||||
var result = base.ReadBytes(count);
|
||||
this.currentCrc = RarCRC.CheckCrc(this.currentCrc, result, 0, result.Length);
|
||||
currentCrc = RarCRC.CheckCrc(currentCrc, result, 0, result.Length);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,44 +10,44 @@ namespace SharpCompress.Common.Rar
|
||||
/// <summary>
|
||||
/// The File's 32 bit CRC Hash
|
||||
/// </summary>
|
||||
public override long Crc { get { return FileHeader.FileCRC; } }
|
||||
public override long Crc => FileHeader.FileCRC;
|
||||
|
||||
/// <summary>
|
||||
/// The path of the file internal to the Rar Archive.
|
||||
/// </summary>
|
||||
public override string Key { get { return FileHeader.FileName; } }
|
||||
public override string Key => FileHeader.FileName;
|
||||
|
||||
/// <summary>
|
||||
/// The entry last modified time in the archive, if recorded
|
||||
/// </summary>
|
||||
public override DateTime? LastModifiedTime { get { return FileHeader.FileLastModifiedTime; } }
|
||||
public override DateTime? LastModifiedTime => FileHeader.FileLastModifiedTime;
|
||||
|
||||
/// <summary>
|
||||
/// The entry create time in the archive, if recorded
|
||||
/// </summary>
|
||||
public override DateTime? CreatedTime { get { return FileHeader.FileCreatedTime; } }
|
||||
public override DateTime? CreatedTime => FileHeader.FileCreatedTime;
|
||||
|
||||
/// <summary>
|
||||
/// The entry last accessed time in the archive, if recorded
|
||||
/// </summary>
|
||||
public override DateTime? LastAccessedTime { get { return FileHeader.FileLastAccessedTime; } }
|
||||
public override DateTime? LastAccessedTime => FileHeader.FileLastAccessedTime;
|
||||
|
||||
/// <summary>
|
||||
/// The entry time whend archived, if recorded
|
||||
/// </summary>
|
||||
public override DateTime? ArchivedTime { get { return FileHeader.FileArchivedTime; } }
|
||||
public override DateTime? ArchivedTime => FileHeader.FileArchivedTime;
|
||||
|
||||
/// <summary>
|
||||
/// Entry is password protected and encrypted and cannot be extracted.
|
||||
/// </summary>
|
||||
public override bool IsEncrypted { get { return FileHeader.FileFlags.HasFlag(FileFlags.PASSWORD); } }
|
||||
public override bool IsEncrypted => FileHeader.FileFlags.HasFlag(FileFlags.PASSWORD);
|
||||
|
||||
/// <summary>
|
||||
/// Entry is password protected and encrypted and cannot be extracted.
|
||||
/// </summary>
|
||||
public override bool IsDirectory { get { return FileHeader.FileFlags.HasFlag(FileFlags.DIRECTORY); } }
|
||||
public override bool IsDirectory => FileHeader.FileFlags.HasFlag(FileFlags.DIRECTORY);
|
||||
|
||||
public override bool IsSplit { get { return FileHeader.FileFlags.HasFlag(FileFlags.SPLIT_AFTER); } }
|
||||
public override bool IsSplit => FileHeader.FileFlags.HasFlag(FileFlags.SPLIT_AFTER);
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace SharpCompress.Common.Rar
|
||||
headerFactory = new RarHeaderFactory(mode, options);
|
||||
}
|
||||
|
||||
internal StreamingMode Mode { get { return headerFactory.StreamingMode; } }
|
||||
internal StreamingMode Mode => headerFactory.StreamingMode;
|
||||
|
||||
internal abstract IEnumerable<RarFilePart> ReadFileParts();
|
||||
|
||||
|
||||
@@ -1339,20 +1339,20 @@ namespace SharpCompress.Common.SevenZip
|
||||
|
||||
#region Stream
|
||||
|
||||
public override bool CanRead { get { return true; } }
|
||||
public override bool CanRead => true;
|
||||
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite { get { return false; } }
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override long Length { get { throw new NotSupportedException(); } }
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
public override long Position { get { throw new NotSupportedException(); } set { throw new NotSupportedException(); } }
|
||||
public override long Position { get => throw new NotSupportedException(); set => throw new NotSupportedException(); }
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
|
||||
@@ -12,9 +12,9 @@ namespace SharpCompress.Common.SevenZip
|
||||
public bool HasStream { get; internal set; }
|
||||
public bool IsDir { get; internal set; }
|
||||
|
||||
public bool CrcDefined { get { return Crc != null; } }
|
||||
public bool CrcDefined => Crc != null;
|
||||
|
||||
public bool AttribDefined { get { return Attrib != null; } }
|
||||
public bool AttribDefined => Attrib != null;
|
||||
|
||||
public void SetAttrib(uint attrib)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace SharpCompress.Common.SevenZip
|
||||
internal List<long> UnpackSizes = new List<long>();
|
||||
internal uint? UnpackCRC;
|
||||
|
||||
internal bool UnpackCRCDefined { get { return UnpackCRC != null; } }
|
||||
internal bool UnpackCRCDefined => UnpackCRC != null;
|
||||
|
||||
public long GetUnpackSize()
|
||||
{
|
||||
|
||||
@@ -12,32 +12,32 @@ namespace SharpCompress.Common.SevenZip
|
||||
|
||||
internal SevenZipFilePart FilePart { get; }
|
||||
|
||||
public override CompressionType CompressionType { get { return FilePart.CompressionType; } }
|
||||
public override CompressionType CompressionType => FilePart.CompressionType;
|
||||
|
||||
public override long Crc { get { return FilePart.Header.Crc ?? 0; } }
|
||||
public override long Crc => FilePart.Header.Crc ?? 0;
|
||||
|
||||
public override string Key { get { return FilePart.Header.Name; } }
|
||||
public override string Key => FilePart.Header.Name;
|
||||
|
||||
public override long CompressedSize { get { return 0; } }
|
||||
public override long CompressedSize => 0;
|
||||
|
||||
public override long Size { get { return FilePart.Header.Size; } }
|
||||
public override long Size => FilePart.Header.Size;
|
||||
|
||||
public override DateTime? LastModifiedTime { get { return FilePart.Header.MTime; } }
|
||||
public override DateTime? LastModifiedTime => FilePart.Header.MTime;
|
||||
|
||||
public override DateTime? CreatedTime { get { return null; } }
|
||||
public override DateTime? CreatedTime => null;
|
||||
|
||||
public override DateTime? LastAccessedTime { get { return null; } }
|
||||
public override DateTime? LastAccessedTime => null;
|
||||
|
||||
public override DateTime? ArchivedTime { get { return null; } }
|
||||
public override DateTime? ArchivedTime => null;
|
||||
|
||||
public override bool IsEncrypted { get { return false; } }
|
||||
public override bool IsEncrypted => false;
|
||||
|
||||
public override bool IsDirectory { get { return FilePart.Header.IsDir; } }
|
||||
public override bool IsDirectory => FilePart.Header.IsDir;
|
||||
|
||||
public override bool IsSplit { get { return false; } }
|
||||
public override bool IsSplit => false;
|
||||
|
||||
public override int? Attrib { get { return (int)FilePart.Header.Attrib; } }
|
||||
public override int? Attrib => (int)FilePart.Header.Attrib;
|
||||
|
||||
internal override IEnumerable<FilePart> Parts { get { return FilePart.AsEnumerable<FilePart>(); } }
|
||||
internal override IEnumerable<FilePart> Parts => FilePart.AsEnumerable<FilePart>();
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ namespace SharpCompress.Common.SevenZip
|
||||
internal CFolder Folder { get; }
|
||||
internal int Index { get; }
|
||||
|
||||
internal override string FilePartName { get { return Header.Name; } }
|
||||
internal override string FilePartName => Header.Name;
|
||||
|
||||
internal override Stream GetRawStream()
|
||||
{
|
||||
|
||||
@@ -18,29 +18,29 @@ namespace SharpCompress.Common.Tar
|
||||
|
||||
public override CompressionType CompressionType { get; }
|
||||
|
||||
public override long Crc { get { return 0; } }
|
||||
public override long Crc => 0;
|
||||
|
||||
public override string Key { get { return filePart.Header.Name; } }
|
||||
public override string Key => filePart.Header.Name;
|
||||
|
||||
public override long CompressedSize { get { return filePart.Header.Size; } }
|
||||
public override long CompressedSize => filePart.Header.Size;
|
||||
|
||||
public override long Size { get { return filePart.Header.Size; } }
|
||||
public override long Size => filePart.Header.Size;
|
||||
|
||||
public override DateTime? LastModifiedTime { get { return filePart.Header.LastModifiedTime; } }
|
||||
public override DateTime? LastModifiedTime => filePart.Header.LastModifiedTime;
|
||||
|
||||
public override DateTime? CreatedTime { get { return null; } }
|
||||
public override DateTime? CreatedTime => null;
|
||||
|
||||
public override DateTime? LastAccessedTime { get { return null; } }
|
||||
public override DateTime? LastAccessedTime => null;
|
||||
|
||||
public override DateTime? ArchivedTime { get { return null; } }
|
||||
public override DateTime? ArchivedTime => null;
|
||||
|
||||
public override bool IsEncrypted { get { return false; } }
|
||||
public override bool IsEncrypted => false;
|
||||
|
||||
public override bool IsDirectory { get { return filePart.Header.EntryType == EntryType.Directory; } }
|
||||
public override bool IsDirectory => filePart.Header.EntryType == EntryType.Directory;
|
||||
|
||||
public override bool IsSplit { get { return false; } }
|
||||
public override bool IsSplit => false;
|
||||
|
||||
internal override IEnumerable<FilePart> Parts { get { return filePart.AsEnumerable<FilePart>(); } }
|
||||
internal override IEnumerable<FilePart> Parts => filePart.AsEnumerable<FilePart>();
|
||||
|
||||
internal static IEnumerable<TarEntry> GetEntries(StreamingMode mode, Stream stream,
|
||||
CompressionType compressionType)
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace SharpCompress.Common.Tar
|
||||
|
||||
internal TarHeader Header { get; }
|
||||
|
||||
internal override string FilePartName { get { return Header.Name; } }
|
||||
internal override string FilePartName => Header.Name;
|
||||
|
||||
internal override Stream GetCompressedStream()
|
||||
{
|
||||
|
||||
@@ -42,20 +42,20 @@ namespace SharpCompress.Common.Tar
|
||||
|
||||
public Stream Stream { get; }
|
||||
|
||||
public override bool CanRead { get { return true; } }
|
||||
public override bool CanRead => true;
|
||||
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite { get { return false; } }
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override long Length { get { throw new NotSupportedException(); } }
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
public override long Position { get { throw new NotSupportedException(); } set { throw new NotSupportedException(); } }
|
||||
public override long Position { get => throw new NotSupportedException(); set => throw new NotSupportedException(); }
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace SharpCompress.Common
|
||||
ReaderOptions = readerOptions;
|
||||
}
|
||||
|
||||
internal Stream Stream { get { return new NonDisposingStream(actualStream); } }
|
||||
internal Stream Stream => new NonDisposingStream(actualStream);
|
||||
|
||||
protected ReaderOptions ReaderOptions { get; }
|
||||
|
||||
@@ -22,12 +22,12 @@ namespace SharpCompress.Common
|
||||
/// RarArchive is the first volume of a multi-part archive.
|
||||
/// Only Rar 3.0 format and higher
|
||||
/// </summary>
|
||||
public virtual bool IsFirstVolume { get { return true; } }
|
||||
public virtual bool IsFirstVolume => true;
|
||||
|
||||
/// <summary>
|
||||
/// RarArchive is part of a multi-part archive.
|
||||
/// </summary>
|
||||
public virtual bool IsMultiVolume { get { return true; } }
|
||||
public virtual bool IsMultiVolume => true;
|
||||
|
||||
private bool disposed;
|
||||
|
||||
|
||||
@@ -49,14 +49,8 @@ namespace SharpCompress.Common.Zip.Headers
|
||||
|
||||
public ushort TotalNumberOfEntries { get; private set; }
|
||||
|
||||
public bool IsZip64
|
||||
{
|
||||
get
|
||||
{
|
||||
return TotalNumberOfEntriesInDisk == ushort.MaxValue
|
||||
|| DirectorySize == uint.MaxValue
|
||||
|| DirectoryStartOffsetRelativeToDisk == uint.MaxValue;
|
||||
}
|
||||
}
|
||||
public bool IsZip64 => TotalNumberOfEntriesInDisk == ushort.MaxValue
|
||||
|| DirectorySize == uint.MaxValue
|
||||
|| DirectoryStartOffsetRelativeToDisk == uint.MaxValue;
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ namespace SharpCompress.Common.Zip.Headers
|
||||
|
||||
internal class ExtraUnicodePathExtraField : ExtraData
|
||||
{
|
||||
internal byte Version { get { return DataBytes[0]; } }
|
||||
internal byte Version => DataBytes[0];
|
||||
|
||||
internal byte[] NameCRC32
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace SharpCompress.Common.Zip.Headers
|
||||
|
||||
internal override void Write(BinaryWriter writer)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public long SizeOfDirectoryEndRecord { get; private set; }
|
||||
|
||||
@@ -113,6 +113,6 @@ namespace SharpCompress.Common.Zip.Headers
|
||||
|
||||
internal ZipFilePart Part { get; set; }
|
||||
|
||||
internal bool IsZip64 { get { return CompressedSize == uint.MaxValue; } }
|
||||
internal bool IsZip64 => CompressedSize == uint.MaxValue;
|
||||
}
|
||||
}
|
||||
@@ -23,15 +23,15 @@ namespace SharpCompress.Common.Zip
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
public override bool CanRead { get { return (mode == CryptoMode.Decrypt); } }
|
||||
public override bool CanRead => (mode == CryptoMode.Decrypt);
|
||||
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite { get { return (mode == CryptoMode.Encrypt); } }
|
||||
public override bool CanWrite => (mode == CryptoMode.Encrypt);
|
||||
|
||||
public override long Length { get { throw new NotSupportedException(); } }
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
public override long Position { get { throw new NotSupportedException(); } set { throw new NotSupportedException(); } }
|
||||
public override long Position { get => throw new NotSupportedException(); set => throw new NotSupportedException(); }
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace SharpCompress.Common.Zip
|
||||
return base.GetCompressedStream();
|
||||
}
|
||||
|
||||
internal string Comment { get { return (Header as DirectoryEntryHeader).Comment; } }
|
||||
internal string Comment => (Header as DirectoryEntryHeader).Comment;
|
||||
|
||||
private void LoadLocalHeader()
|
||||
{
|
||||
|
||||
@@ -52,28 +52,28 @@ namespace SharpCompress.Common.Zip
|
||||
}
|
||||
}
|
||||
|
||||
public override long Crc { get { return filePart.Header.Crc; } }
|
||||
public override long Crc => filePart.Header.Crc;
|
||||
|
||||
public override string Key { get { return filePart.Header.Name; } }
|
||||
public override string Key => filePart.Header.Name;
|
||||
|
||||
public override long CompressedSize { get { return filePart.Header.CompressedSize; } }
|
||||
public override long CompressedSize => filePart.Header.CompressedSize;
|
||||
|
||||
public override long Size { get { return filePart.Header.UncompressedSize; } }
|
||||
public override long Size => filePart.Header.UncompressedSize;
|
||||
|
||||
public override DateTime? LastModifiedTime { get; }
|
||||
|
||||
public override DateTime? CreatedTime { get { return null; } }
|
||||
public override DateTime? CreatedTime => null;
|
||||
|
||||
public override DateTime? LastAccessedTime { get { return null; } }
|
||||
public override DateTime? LastAccessedTime => null;
|
||||
|
||||
public override DateTime? ArchivedTime { get { return null; } }
|
||||
public override DateTime? ArchivedTime => null;
|
||||
|
||||
public override bool IsEncrypted { get { return FlagUtility.HasFlag(filePart.Header.Flags, HeaderFlags.Encrypted); } }
|
||||
public override bool IsEncrypted => FlagUtility.HasFlag(filePart.Header.Flags, HeaderFlags.Encrypted);
|
||||
|
||||
public override bool IsDirectory { get { return filePart.Header.IsDirectory; } }
|
||||
public override bool IsDirectory => filePart.Header.IsDirectory;
|
||||
|
||||
public override bool IsSplit { get { return false; } }
|
||||
public override bool IsSplit => false;
|
||||
|
||||
internal override IEnumerable<FilePart> Parts { get { return filePart.AsEnumerable<FilePart>(); } }
|
||||
internal override IEnumerable<FilePart> Parts => filePart.AsEnumerable<FilePart>();
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ namespace SharpCompress.Common.Zip
|
||||
internal Stream BaseStream { get; private set; }
|
||||
internal ZipFileEntry Header { get; set; }
|
||||
|
||||
internal override string FilePartName { get { return Header.Name; } }
|
||||
internal override string FilePartName => Header.Name;
|
||||
|
||||
internal override Stream GetCompressedStream()
|
||||
{
|
||||
@@ -51,7 +51,7 @@ namespace SharpCompress.Common.Zip
|
||||
|
||||
protected abstract Stream CreateBaseStream();
|
||||
|
||||
protected bool LeaveStreamOpen { get { return FlagUtility.HasFlag(Header.Flags, HeaderFlags.UsePostDataDescriptor) || Header.IsZip64; } }
|
||||
protected bool LeaveStreamOpen => FlagUtility.HasFlag(Header.Flags, HeaderFlags.UsePostDataDescriptor) || Header.IsZip64;
|
||||
|
||||
protected Stream CreateDecompressionStream(Stream stream)
|
||||
{
|
||||
|
||||
@@ -73,15 +73,15 @@ namespace SharpCompress.Compressors.ADC
|
||||
this.stream = stream;
|
||||
}
|
||||
|
||||
public override bool CanRead { get { return stream.CanRead; } }
|
||||
public override bool CanRead => stream.CanRead;
|
||||
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite { get { return false; } }
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override long Length { get { throw new NotSupportedException(); } }
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
public override long Position { get { return position; } set { throw new NotSupportedException(); } }
|
||||
public override long Position { get => position; set => throw new NotSupportedException(); }
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
|
||||
@@ -48,20 +48,20 @@ namespace SharpCompress.Compressors.BZip2
|
||||
|
||||
public CompressionMode Mode { get; }
|
||||
|
||||
public override bool CanRead { get { return stream.CanRead; } }
|
||||
public override bool CanRead => stream.CanRead;
|
||||
|
||||
public override bool CanSeek { get { return stream.CanSeek; } }
|
||||
public override bool CanSeek => stream.CanSeek;
|
||||
|
||||
public override bool CanWrite { get { return stream.CanWrite; } }
|
||||
public override bool CanWrite => stream.CanWrite;
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
stream.Flush();
|
||||
}
|
||||
|
||||
public override long Length { get { return stream.Length; } }
|
||||
public override long Length => stream.Length;
|
||||
|
||||
public override long Position { get { return stream.Position; } set { stream.Position = value; } }
|
||||
public override long Position { get => stream.Position; set => stream.Position = value; }
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
|
||||
@@ -1092,13 +1092,13 @@ namespace SharpCompress.Compressors.BZip2
|
||||
{
|
||||
}
|
||||
|
||||
public override bool CanRead { get { return true; } }
|
||||
public override bool CanRead => true;
|
||||
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite { get { return false; } }
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override long Length { get { return 0; } }
|
||||
public override long Length => 0;
|
||||
|
||||
public override long Position { get { return 0; } set { } }
|
||||
}
|
||||
|
||||
@@ -1956,13 +1956,13 @@ namespace SharpCompress.Compressors.BZip2
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanRead { get { return false; } }
|
||||
public override bool CanRead => false;
|
||||
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite { get { return true; } }
|
||||
public override bool CanWrite => true;
|
||||
|
||||
public override long Length { get { return 0; } }
|
||||
public override long Length => 0;
|
||||
|
||||
public override long Position { get { return 0; } set { } }
|
||||
}
|
||||
|
||||
@@ -92,14 +92,7 @@ namespace SharpCompress.Compressors.Deflate
|
||||
/// <summary>
|
||||
/// Indicates the current CRC for all blocks slurped in.
|
||||
/// </summary>
|
||||
public Int32 Crc32Result
|
||||
{
|
||||
get
|
||||
{
|
||||
// return one's complement of the running result
|
||||
return unchecked((Int32)(~runningCrc32Result));
|
||||
}
|
||||
}
|
||||
public Int32 Crc32Result => unchecked((Int32)(~runningCrc32Result));
|
||||
|
||||
/// <summary>
|
||||
/// Returns the CRC32 for the specified stream.
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace SharpCompress.Compressors.Deflate
|
||||
/// </remarks>
|
||||
public virtual FlushType FlushMode
|
||||
{
|
||||
get { return (_baseStream._flushMode); }
|
||||
get => (_baseStream._flushMode);
|
||||
set
|
||||
{
|
||||
if (_disposed)
|
||||
@@ -80,7 +80,7 @@ namespace SharpCompress.Compressors.Deflate
|
||||
/// </remarks>
|
||||
public int BufferSize
|
||||
{
|
||||
get { return _baseStream._bufferSize; }
|
||||
get => _baseStream._bufferSize;
|
||||
set
|
||||
{
|
||||
if (_disposed)
|
||||
@@ -111,7 +111,7 @@ namespace SharpCompress.Compressors.Deflate
|
||||
/// </remarks>
|
||||
public CompressionStrategy Strategy
|
||||
{
|
||||
get { return _baseStream.Strategy; }
|
||||
get => _baseStream.Strategy;
|
||||
set
|
||||
{
|
||||
if (_disposed)
|
||||
@@ -123,10 +123,10 @@ namespace SharpCompress.Compressors.Deflate
|
||||
}
|
||||
|
||||
/// <summary> Returns the total number of bytes input so far.</summary>
|
||||
public virtual long TotalIn { get { return _baseStream._z.TotalBytesIn; } }
|
||||
public virtual long TotalIn => _baseStream._z.TotalBytesIn;
|
||||
|
||||
/// <summary> Returns the total number of bytes output so far.</summary>
|
||||
public virtual long TotalOut { get { return _baseStream._z.TotalBytesOut; } }
|
||||
public virtual long TotalOut => _baseStream._z.TotalBytesOut;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace SharpCompress.Compressors.Deflate
|
||||
/// <remarks>
|
||||
/// Always returns false.
|
||||
/// </remarks>
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the stream can be written.
|
||||
@@ -179,7 +179,7 @@ namespace SharpCompress.Compressors.Deflate
|
||||
/// <summary>
|
||||
/// Reading this property always throws a <see cref="NotImplementedException"/>.
|
||||
/// </summary>
|
||||
public override long Length { get { throw new NotSupportedException(); } }
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
/// <summary>
|
||||
/// The position of the stream pointer.
|
||||
@@ -206,7 +206,7 @@ namespace SharpCompress.Compressors.Deflate
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
set { throw new NotSupportedException(); }
|
||||
set => throw new NotSupportedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -342,13 +342,7 @@ namespace SharpCompress.Compressors.Deflate
|
||||
|
||||
#endregion
|
||||
|
||||
public MemoryStream InputBuffer
|
||||
{
|
||||
get
|
||||
{
|
||||
return new MemoryStream(_baseStream._z.InputBuffer, _baseStream._z.NextIn,
|
||||
_baseStream._z.AvailableBytesIn);
|
||||
}
|
||||
}
|
||||
public MemoryStream InputBuffer => new MemoryStream(_baseStream._z.InputBuffer, _baseStream._z.NextIn,
|
||||
_baseStream._z.AvailableBytesIn);
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ namespace SharpCompress.Compressors.Deflate
|
||||
|
||||
public virtual FlushType FlushMode
|
||||
{
|
||||
get { return (BaseStream._flushMode); }
|
||||
get => (BaseStream._flushMode);
|
||||
set
|
||||
{
|
||||
if (disposed)
|
||||
@@ -84,7 +84,7 @@ namespace SharpCompress.Compressors.Deflate
|
||||
|
||||
public int BufferSize
|
||||
{
|
||||
get { return BaseStream._bufferSize; }
|
||||
get => BaseStream._bufferSize;
|
||||
set
|
||||
{
|
||||
if (disposed)
|
||||
@@ -105,9 +105,9 @@ namespace SharpCompress.Compressors.Deflate
|
||||
}
|
||||
}
|
||||
|
||||
internal virtual long TotalIn { get { return BaseStream._z.TotalBytesIn; } }
|
||||
internal virtual long TotalIn => BaseStream._z.TotalBytesIn;
|
||||
|
||||
internal virtual long TotalOut { get { return BaseStream._z.TotalBytesOut; } }
|
||||
internal virtual long TotalOut => BaseStream._z.TotalBytesOut;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace SharpCompress.Compressors.Deflate
|
||||
/// <remarks>
|
||||
/// Always returns false.
|
||||
/// </remarks>
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the stream can be written.
|
||||
@@ -160,7 +160,7 @@ namespace SharpCompress.Compressors.Deflate
|
||||
/// <summary>
|
||||
/// Reading this property always throws a <see cref="NotImplementedException"/>.
|
||||
/// </summary>
|
||||
public override long Length { get { throw new NotSupportedException(); } }
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
/// <summary>
|
||||
/// The position of the stream pointer.
|
||||
@@ -188,7 +188,7 @@ namespace SharpCompress.Compressors.Deflate
|
||||
return 0;
|
||||
}
|
||||
|
||||
set { throw new NotSupportedException(); }
|
||||
set => throw new NotSupportedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -350,7 +350,7 @@ namespace SharpCompress.Compressors.Deflate
|
||||
|
||||
public String Comment
|
||||
{
|
||||
get { return comment; }
|
||||
get => comment;
|
||||
set
|
||||
{
|
||||
if (disposed)
|
||||
@@ -363,7 +363,7 @@ namespace SharpCompress.Compressors.Deflate
|
||||
|
||||
public string FileName
|
||||
{
|
||||
get { return fileName; }
|
||||
get => fileName;
|
||||
set
|
||||
{
|
||||
if (disposed)
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace SharpCompress.Compressors.Deflate
|
||||
}
|
||||
}
|
||||
|
||||
protected internal bool _wantCompress { get { return (_compressionMode == CompressionMode.Compress); } }
|
||||
protected internal bool _wantCompress => (_compressionMode == CompressionMode.Compress);
|
||||
|
||||
private ZlibCodec z
|
||||
{
|
||||
@@ -630,15 +630,15 @@ namespace SharpCompress.Compressors.Deflate
|
||||
return rc;
|
||||
}
|
||||
|
||||
public override Boolean CanRead { get { return _stream.CanRead; } }
|
||||
public override Boolean CanRead => _stream.CanRead;
|
||||
|
||||
public override Boolean CanSeek { get { return _stream.CanSeek; } }
|
||||
public override Boolean CanSeek => _stream.CanSeek;
|
||||
|
||||
public override Boolean CanWrite { get { return _stream.CanWrite; } }
|
||||
public override Boolean CanWrite => _stream.CanWrite;
|
||||
|
||||
public override Int64 Length { get { return _stream.Length; } }
|
||||
public override Int64 Length => _stream.Length;
|
||||
|
||||
public override long Position { get { throw new NotSupportedException(); } set { throw new NotSupportedException(); } }
|
||||
public override long Position { get => throw new NotSupportedException(); set => throw new NotSupportedException(); }
|
||||
|
||||
internal enum StreamMode
|
||||
{
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace SharpCompress.Compressors.Deflate
|
||||
/// <summary>
|
||||
/// The Adler32 checksum on the data transferred through the codec so far. You probably don't need to look at this.
|
||||
/// </summary>
|
||||
public int Adler32 { get { return (int)_Adler32; } }
|
||||
public int Adler32 => (int)_Adler32;
|
||||
|
||||
/// <summary>
|
||||
/// Create a ZlibCodec.
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace SharpCompress.Compressors.Deflate
|
||||
/// </summary>
|
||||
public virtual FlushType FlushMode
|
||||
{
|
||||
get { return (_baseStream._flushMode); }
|
||||
get => (_baseStream._flushMode);
|
||||
set
|
||||
{
|
||||
if (_disposed)
|
||||
@@ -93,7 +93,7 @@ namespace SharpCompress.Compressors.Deflate
|
||||
/// </remarks>
|
||||
public int BufferSize
|
||||
{
|
||||
get { return _baseStream._bufferSize; }
|
||||
get => _baseStream._bufferSize;
|
||||
set
|
||||
{
|
||||
if (_disposed)
|
||||
@@ -115,10 +115,10 @@ namespace SharpCompress.Compressors.Deflate
|
||||
}
|
||||
|
||||
/// <summary> Returns the total number of bytes input so far.</summary>
|
||||
public virtual long TotalIn { get { return _baseStream._z.TotalBytesIn; } }
|
||||
public virtual long TotalIn => _baseStream._z.TotalBytesIn;
|
||||
|
||||
/// <summary> Returns the total number of bytes output so far.</summary>
|
||||
public virtual long TotalOut { get { return _baseStream._z.TotalBytesOut; } }
|
||||
public virtual long TotalOut => _baseStream._z.TotalBytesOut;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace SharpCompress.Compressors.Deflate
|
||||
/// <remarks>
|
||||
/// Always returns false.
|
||||
/// </remarks>
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the stream can be written.
|
||||
@@ -171,7 +171,7 @@ namespace SharpCompress.Compressors.Deflate
|
||||
/// <summary>
|
||||
/// Reading this property always throws a <see cref="NotImplementedException"/>.
|
||||
/// </summary>
|
||||
public override long Length { get { throw new NotSupportedException(); } }
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
/// <summary>
|
||||
/// The position of the stream pointer.
|
||||
@@ -199,7 +199,7 @@ namespace SharpCompress.Compressors.Deflate
|
||||
return 0;
|
||||
}
|
||||
|
||||
set { throw new NotSupportedException(); }
|
||||
set => throw new NotSupportedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -78,20 +78,20 @@ namespace SharpCompress.Compressors.Filters
|
||||
baseStream.Dispose();
|
||||
}
|
||||
|
||||
public override bool CanRead { get { return true; } }
|
||||
public override bool CanRead => true;
|
||||
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite { get { return false; } }
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override long Length { get { return baseStream.Length + data1.Length + data2.Length; } }
|
||||
public override long Length => baseStream.Length + data1.Length + data2.Length;
|
||||
|
||||
public override long Position { get { return position; } set { throw new NotSupportedException(); } }
|
||||
public override long Position { get => position; set => throw new NotSupportedException(); }
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
|
||||
@@ -34,20 +34,20 @@ namespace SharpCompress.Compressors.Filters
|
||||
baseStream.Dispose();
|
||||
}
|
||||
|
||||
public override bool CanRead { get { return !isEncoder; } }
|
||||
public override bool CanRead => !isEncoder;
|
||||
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite { get { return isEncoder; } }
|
||||
public override bool CanWrite => isEncoder;
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override long Length { get { return baseStream.Length; } }
|
||||
public override long Length => baseStream.Length;
|
||||
|
||||
public override long Position { get { return baseStream.Position; } set { throw new NotSupportedException(); } }
|
||||
public override long Position { get => baseStream.Position; set => throw new NotSupportedException(); }
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
|
||||
@@ -8,20 +8,20 @@ namespace SharpCompress.Compressors.LZMA
|
||||
{
|
||||
internal abstract class DecoderStream2 : Stream
|
||||
{
|
||||
public override bool CanRead { get { return true; } }
|
||||
public override bool CanRead => true;
|
||||
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite { get { return false; } }
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override long Length { get { throw new NotSupportedException(); } }
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
public override long Position { get { throw new NotSupportedException(); } set { throw new NotSupportedException(); } }
|
||||
public override long Position { get => throw new NotSupportedException(); set => throw new NotSupportedException(); }
|
||||
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
|
||||
@@ -178,6 +178,6 @@ namespace SharpCompress.Compressors.LZMA.LZ
|
||||
_streamPos -= (UInt32)subValue;
|
||||
}
|
||||
|
||||
public bool IsDataStarved { get { return _streamPos - _pos < _keepSizeAfter; } }
|
||||
public bool IsDataStarved => _streamPos - _pos < _keepSizeAfter;
|
||||
}
|
||||
}
|
||||
@@ -166,9 +166,9 @@ namespace SharpCompress.Compressors.LZMA.LZ
|
||||
Limit = Total + size;
|
||||
}
|
||||
|
||||
public bool HasSpace { get { return _pos < _windowSize && Total < Limit; } }
|
||||
public bool HasSpace => _pos < _windowSize && Total < Limit;
|
||||
|
||||
public bool HasPending { get { return _pendingLen > 0; } }
|
||||
public bool HasPending => _pendingLen > 0;
|
||||
|
||||
public int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
@@ -200,6 +200,6 @@ namespace SharpCompress.Compressors.LZMA.LZ
|
||||
}
|
||||
}
|
||||
|
||||
public int AvailableBytes { get { return _pos - _streamPos; } }
|
||||
public int AvailableBytes => _pos - _streamPos;
|
||||
}
|
||||
}
|
||||
@@ -69,9 +69,9 @@ namespace SharpCompress.Compressors.LZMA
|
||||
|
||||
// TODO: Both Length and Position are sometimes feasible, but would require
|
||||
// reading the output length when we initialize.
|
||||
public override long Length { get { throw new NotImplementedException(); } }
|
||||
public override long Length => throw new NotImplementedException();
|
||||
|
||||
public override long Position { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } }
|
||||
public override long Position { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count) => stream.Read(buffer, offset, count);
|
||||
|
||||
|
||||
@@ -118,11 +118,11 @@ namespace SharpCompress.Compressors.LZMA
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanRead { get { return encoder == null; } }
|
||||
public override bool CanRead => encoder == null;
|
||||
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite { get { return encoder != null; } }
|
||||
public override bool CanWrite => encoder != null;
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
@@ -149,9 +149,9 @@ namespace SharpCompress.Compressors.LZMA
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
public override long Length { get { return position + availableBytes; } }
|
||||
public override long Length => position + availableBytes;
|
||||
|
||||
public override long Position { get { return position; } set { throw new NotSupportedException(); } }
|
||||
public override long Position { get => position; set => throw new NotSupportedException(); }
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
|
||||
@@ -245,7 +245,7 @@ namespace SharpCompress.Compressors.LZMA.RangeCoder
|
||||
return symbol;
|
||||
}
|
||||
|
||||
public bool IsFinished { get { return Code == 0; } }
|
||||
public bool IsFinished => Code == 0;
|
||||
|
||||
// ulong GetProcessedSize() {return Stream.GetProcessedSize(); }
|
||||
}
|
||||
|
||||
@@ -40,19 +40,19 @@ namespace SharpCompress.Compressors.LZMA.Utilites
|
||||
return mCRC;
|
||||
}
|
||||
|
||||
public override bool CanRead { get { return false; } }
|
||||
public override bool CanRead => false;
|
||||
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite { get { return true; } }
|
||||
public override bool CanWrite => true;
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
}
|
||||
|
||||
public override long Length { get { throw new NotSupportedException(); } }
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
public override long Position { get { throw new NotSupportedException(); } set { throw new NotSupportedException(); } }
|
||||
public override long Position { get => throw new NotSupportedException(); set => throw new NotSupportedException(); }
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
@@ -122,20 +122,20 @@ namespace SharpCompress.Compressors.LZMA.Utilites
|
||||
return mCRC;
|
||||
}
|
||||
|
||||
public override bool CanRead { get { return mSource.CanRead; } }
|
||||
public override bool CanRead => mSource.CanRead;
|
||||
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite { get { return false; } }
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override long Length { get { throw new NotSupportedException(); } }
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
public override long Position { get { throw new NotSupportedException(); } set { throw new NotSupportedException(); } }
|
||||
public override long Position { get => throw new NotSupportedException(); set => throw new NotSupportedException(); }
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
|
||||
@@ -62,19 +62,19 @@ namespace SharpCompress.Compressors.LZMA.Utilites
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanRead { get { return false; } }
|
||||
public override bool CanRead => false;
|
||||
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite { get { return true; } }
|
||||
public override bool CanWrite => true;
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
}
|
||||
|
||||
public override long Length { get { throw new NotSupportedException(); } }
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
public override long Position { get { throw new NotSupportedException(); } set { throw new NotSupportedException(); } }
|
||||
public override long Position { get => throw new NotSupportedException(); set => throw new NotSupportedException(); }
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace SharpCompress.Compressors.PPMd.H
|
||||
{
|
||||
}
|
||||
|
||||
internal int SummFreq { get { return DataConverter.LittleEndian.GetInt16(Memory, Address) & 0xffff; } set { DataConverter.LittleEndian.PutBytes(Memory, Address, (short)value); } }
|
||||
internal int SummFreq { get => DataConverter.LittleEndian.GetInt16(Memory, Address) & 0xffff; set => DataConverter.LittleEndian.PutBytes(Memory, Address, (short)value); }
|
||||
|
||||
internal FreqData Initialize(byte[] mem)
|
||||
{
|
||||
|
||||
@@ -22,33 +22,33 @@ namespace SharpCompress.Compressors.PPMd.H
|
||||
|
||||
public SubAllocator SubAlloc { get; } = new SubAllocator();
|
||||
|
||||
public virtual SEE2Context DummySEE2Cont { get { return dummySEE2Cont; } }
|
||||
public virtual SEE2Context DummySEE2Cont => dummySEE2Cont;
|
||||
|
||||
public virtual int InitRL { get { return initRL; } }
|
||||
public virtual int InitRL => initRL;
|
||||
|
||||
public virtual int EscCount { get { return escCount; } set { escCount = value & 0xff; } }
|
||||
public virtual int EscCount { get => escCount; set => escCount = value & 0xff; }
|
||||
|
||||
public virtual int[] CharMask { get { return charMask; } }
|
||||
public virtual int[] CharMask => charMask;
|
||||
|
||||
public virtual int NumMasked { get { return numMasked; } set { numMasked = value; } }
|
||||
public virtual int NumMasked { get => numMasked; set => numMasked = value; }
|
||||
|
||||
public virtual int PrevSuccess { get { return prevSuccess; } set { prevSuccess = value & 0xff; } }
|
||||
public virtual int PrevSuccess { get => prevSuccess; set => prevSuccess = value & 0xff; }
|
||||
|
||||
public virtual int InitEsc { get { return initEsc; } set { initEsc = value; } }
|
||||
public virtual int InitEsc { get => initEsc; set => initEsc = value; }
|
||||
|
||||
public virtual int RunLength { get { return runLength; } set { runLength = value; } }
|
||||
public virtual int RunLength { get => runLength; set => runLength = value; }
|
||||
|
||||
public virtual int HiBitsFlag { get { return hiBitsFlag; } set { hiBitsFlag = value & 0xff; } }
|
||||
public virtual int HiBitsFlag { get => hiBitsFlag; set => hiBitsFlag = value & 0xff; }
|
||||
|
||||
public virtual int[][] BinSumm { get { return binSumm; } }
|
||||
public virtual int[][] BinSumm => binSumm;
|
||||
|
||||
internal RangeCoder Coder { get; private set; }
|
||||
|
||||
internal State FoundState { get; private set; }
|
||||
|
||||
public virtual byte[] Heap { get { return SubAlloc.Heap; } }
|
||||
public virtual byte[] Heap => SubAlloc.Heap;
|
||||
|
||||
public virtual int OrderFall { get { return orderFall; } }
|
||||
public virtual int OrderFall => orderFall;
|
||||
|
||||
public const int MAX_O = 64; /* maximum allowed model order */
|
||||
|
||||
|
||||
@@ -8,8 +8,7 @@ namespace SharpCompress.Compressors.PPMd.H
|
||||
{
|
||||
internal FreqData FreqData
|
||||
{
|
||||
get { return freqData; }
|
||||
|
||||
get => freqData;
|
||||
set
|
||||
{
|
||||
freqData.SummFreq = value.SummFreq;
|
||||
@@ -131,7 +130,7 @@ namespace SharpCompress.Compressors.PPMd.H
|
||||
|
||||
internal override int Address
|
||||
{
|
||||
get { return base.Address; }
|
||||
get => base.Address;
|
||||
set
|
||||
{
|
||||
base.Address = value;
|
||||
|
||||
@@ -131,11 +131,11 @@ namespace SharpCompress.Compressors.PPMd.H
|
||||
Scale = Scale + dScale;
|
||||
}
|
||||
|
||||
internal long HighCount { get { return highCount; } set { highCount = value & RangeCoder.UintMask; } }
|
||||
internal long HighCount { get => highCount; set => highCount = value & RangeCoder.UintMask; }
|
||||
|
||||
internal long LowCount { get { return lowCount & RangeCoder.UintMask; } set { lowCount = value & RangeCoder.UintMask; } }
|
||||
internal long LowCount { get => lowCount & RangeCoder.UintMask; set => lowCount = value & RangeCoder.UintMask; }
|
||||
|
||||
internal long Scale { get { return scale; } set { scale = value & RangeCoder.UintMask; } }
|
||||
internal long Scale { get => scale; set => scale = value & RangeCoder.UintMask; }
|
||||
|
||||
// Debug
|
||||
public override String ToString()
|
||||
|
||||
@@ -15,11 +15,11 @@ namespace SharpCompress.Compressors.PPMd.H
|
||||
}
|
||||
}
|
||||
|
||||
public virtual int Count { get { return count; } set { count = value & 0xff; } }
|
||||
public virtual int Count { get => count; set => count = value & 0xff; }
|
||||
|
||||
public virtual int Shift { get { return shift; } set { shift = value & 0xff; } }
|
||||
public virtual int Shift { get => shift; set => shift = value & 0xff; }
|
||||
|
||||
public virtual int Summ { get { return summ; } set { summ = value & 0xffff; } }
|
||||
public virtual int Summ { get => summ; set => summ = value & 0xffff; }
|
||||
|
||||
public const int size = 4;
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ namespace SharpCompress.Compressors.PPMd.H
|
||||
{
|
||||
}
|
||||
|
||||
internal int Symbol { get { return Memory[Address] & 0xff; } set { Memory[Address] = (byte)value; } }
|
||||
internal int Symbol { get => Memory[Address] & 0xff; set => Memory[Address] = (byte)value; }
|
||||
|
||||
internal int Freq { get { return Memory[Address + 1] & 0xff; } set { Memory[Address + 1] = (byte)value; } }
|
||||
internal int Freq { get => Memory[Address + 1] & 0xff; set => Memory[Address + 1] = (byte)value; }
|
||||
|
||||
internal State Initialize(byte[] mem)
|
||||
{
|
||||
|
||||
@@ -11,9 +11,9 @@ namespace SharpCompress.Compressors.PPMd.H
|
||||
|
||||
private int successor; // pointer ppmcontext
|
||||
|
||||
internal int Symbol { get { return symbol; } set { symbol = value & 0xff; } }
|
||||
internal int Symbol { get => symbol; set => symbol = value & 0xff; }
|
||||
|
||||
internal int Freq { get { return freq; } set { freq = value & 0xff; } }
|
||||
internal int Freq { get => freq; set => freq = value & 0xff; }
|
||||
|
||||
internal State Values
|
||||
{
|
||||
|
||||
@@ -5,15 +5,15 @@ namespace SharpCompress.Compressors.PPMd.H
|
||||
{
|
||||
internal class SubAllocator
|
||||
{
|
||||
public virtual int FakeUnitsStart { get { return fakeUnitsStart; } set { fakeUnitsStart = value; } }
|
||||
public virtual int FakeUnitsStart { get => fakeUnitsStart; set => fakeUnitsStart = value; }
|
||||
|
||||
public virtual int HeapEnd { get { return heapEnd; } }
|
||||
public virtual int HeapEnd => heapEnd;
|
||||
|
||||
public virtual int PText { get { return pText; } set { pText = value; } }
|
||||
public virtual int PText { get => pText; set => pText = value; }
|
||||
|
||||
public virtual int UnitsStart { get { return unitsStart; } set { unitsStart = value; } }
|
||||
public virtual int UnitsStart { get => unitsStart; set => unitsStart = value; }
|
||||
|
||||
public virtual byte[] Heap { get { return heap; } }
|
||||
public virtual byte[] Heap => heap;
|
||||
|
||||
//UPGRADE_NOTE: Final was removed from the declaration of 'N4 '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
|
||||
public const int N1 = 4;
|
||||
|
||||
@@ -48,11 +48,8 @@ namespace SharpCompress.Compressors.PPMd.I1
|
||||
/// </summary>
|
||||
public uint Stamp
|
||||
{
|
||||
get
|
||||
{
|
||||
return Memory[Address] | ((uint)Memory[Address + 1]) << 8 | ((uint)Memory[Address + 2]) << 16 |
|
||||
((uint)Memory[Address + 3]) << 24;
|
||||
}
|
||||
get => Memory[Address] | ((uint)Memory[Address + 1]) << 8 | ((uint)Memory[Address + 2]) << 16 |
|
||||
((uint)Memory[Address + 3]) << 24;
|
||||
set
|
||||
{
|
||||
Memory[Address] = (byte)value;
|
||||
@@ -67,13 +64,9 @@ namespace SharpCompress.Compressors.PPMd.I1
|
||||
/// </summary>
|
||||
public MemoryNode Next
|
||||
{
|
||||
get
|
||||
{
|
||||
return
|
||||
new MemoryNode(
|
||||
Memory[Address + 4] | ((uint)Memory[Address + 5]) << 8 |
|
||||
((uint)Memory[Address + 6]) << 16 | ((uint)Memory[Address + 7]) << 24, Memory);
|
||||
}
|
||||
get => new MemoryNode(
|
||||
Memory[Address + 4] | ((uint)Memory[Address + 5]) << 8 |
|
||||
((uint)Memory[Address + 6]) << 16 | ((uint)Memory[Address + 7]) << 24, Memory);
|
||||
set
|
||||
{
|
||||
Memory[Address + 4] = (byte)value.Address;
|
||||
@@ -88,11 +81,8 @@ namespace SharpCompress.Compressors.PPMd.I1
|
||||
/// </summary>
|
||||
public uint UnitCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return Memory[Address + 8] | ((uint)Memory[Address + 9]) << 8 |
|
||||
((uint)Memory[Address + 10]) << 16 | ((uint)Memory[Address + 11]) << 24;
|
||||
}
|
||||
get => Memory[Address + 8] | ((uint)Memory[Address + 9]) << 8 |
|
||||
((uint)Memory[Address + 10]) << 16 | ((uint)Memory[Address + 11]) << 24;
|
||||
set
|
||||
{
|
||||
Memory[Address + 8] = (byte)value;
|
||||
@@ -105,7 +95,7 @@ namespace SharpCompress.Compressors.PPMd.I1
|
||||
/// <summary>
|
||||
/// Gets whether there is a next memory node available.
|
||||
/// </summary>
|
||||
public bool Available { get { return Next.Address != 0; } }
|
||||
public bool Available => Next.Address != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Link in the provided memory node.
|
||||
|
||||
@@ -34,19 +34,19 @@ namespace SharpCompress.Compressors.PPMd.I1
|
||||
/// <summary>
|
||||
/// Gets or sets the number statistics.
|
||||
/// </summary>
|
||||
public byte NumberStatistics { get { return Memory[Address]; } set { Memory[Address] = value; } }
|
||||
public byte NumberStatistics { get => Memory[Address]; set => Memory[Address] = value; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the flags.
|
||||
/// </summary>
|
||||
public byte Flags { get { return Memory[Address + 1]; } set { Memory[Address + 1] = value; } }
|
||||
public byte Flags { get => Memory[Address + 1]; set => Memory[Address + 1] = value; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the summary frequency.
|
||||
/// </summary>
|
||||
public ushort SummaryFrequency
|
||||
{
|
||||
get { return (ushort)(Memory[Address + 2] | Memory[Address + 3] << 8); }
|
||||
get => (ushort)(Memory[Address + 2] | Memory[Address + 3] << 8);
|
||||
set
|
||||
{
|
||||
Memory[Address + 2] = (byte)value;
|
||||
@@ -59,13 +59,9 @@ namespace SharpCompress.Compressors.PPMd.I1
|
||||
/// </summary>
|
||||
public PpmState Statistics
|
||||
{
|
||||
get
|
||||
{
|
||||
return
|
||||
new PpmState(
|
||||
Memory[Address + 4] | ((uint)Memory[Address + 5]) << 8 |
|
||||
((uint)Memory[Address + 6]) << 16 | ((uint)Memory[Address + 7]) << 24, Memory);
|
||||
}
|
||||
get => new PpmState(
|
||||
Memory[Address + 4] | ((uint)Memory[Address + 5]) << 8 |
|
||||
((uint)Memory[Address + 6]) << 16 | ((uint)Memory[Address + 7]) << 24, Memory);
|
||||
set
|
||||
{
|
||||
Memory[Address + 4] = (byte)value.Address;
|
||||
@@ -80,13 +76,9 @@ namespace SharpCompress.Compressors.PPMd.I1
|
||||
/// </summary>
|
||||
public PpmContext Suffix
|
||||
{
|
||||
get
|
||||
{
|
||||
return
|
||||
new PpmContext(
|
||||
Memory[Address + 8] | ((uint)Memory[Address + 9]) << 8 |
|
||||
((uint)Memory[Address + 10]) << 16 | ((uint)Memory[Address + 11]) << 24, Memory);
|
||||
}
|
||||
get => new PpmContext(
|
||||
Memory[Address + 8] | ((uint)Memory[Address + 9]) << 8 |
|
||||
((uint)Memory[Address + 10]) << 16 | ((uint)Memory[Address + 11]) << 24, Memory);
|
||||
set
|
||||
{
|
||||
Memory[Address + 8] = (byte)value.Address;
|
||||
@@ -121,21 +113,21 @@ namespace SharpCompress.Compressors.PPMd.I1
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
public PpmState FirstState { get { return new PpmState(Address + 2, Memory); } }
|
||||
public PpmState FirstState => new PpmState(Address + 2, Memory);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the symbol of the first PPM state. This is provided for convenience. The same
|
||||
/// information can be obtained using the Symbol property on the PPM state provided by the
|
||||
/// <see cref="FirstState"/> property.
|
||||
/// </summary>
|
||||
public byte FirstStateSymbol { get { return Memory[Address + 2]; } set { Memory[Address + 2] = value; } }
|
||||
public byte FirstStateSymbol { get => Memory[Address + 2]; set => Memory[Address + 2] = value; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the frequency of the first PPM state. This is provided for convenience. The same
|
||||
/// information can be obtained using the Frequency property on the PPM state provided by the
|
||||
///context.FirstState property.
|
||||
/// </summary>
|
||||
public byte FirstStateFrequency { get { return Memory[Address + 3]; } set { Memory[Address + 3] = value; } }
|
||||
public byte FirstStateFrequency { get => Memory[Address + 3]; set => Memory[Address + 3] = value; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the successor of the first PPM state. This is provided for convenience. The same
|
||||
@@ -143,13 +135,9 @@ namespace SharpCompress.Compressors.PPMd.I1
|
||||
/// </summary>
|
||||
public PpmContext FirstStateSuccessor
|
||||
{
|
||||
get
|
||||
{
|
||||
return
|
||||
new PpmContext(
|
||||
Memory[Address + 4] | ((uint)Memory[Address + 5]) << 8 |
|
||||
((uint)Memory[Address + 6]) << 16 | ((uint)Memory[Address + 7]) << 24, Memory);
|
||||
}
|
||||
get => new PpmContext(
|
||||
Memory[Address + 4] | ((uint)Memory[Address + 5]) << 8 |
|
||||
((uint)Memory[Address + 6]) << 16 | ((uint)Memory[Address + 7]) << 24, Memory);
|
||||
set
|
||||
{
|
||||
Memory[Address + 4] = (byte)value.Address;
|
||||
|
||||
@@ -38,25 +38,21 @@ namespace SharpCompress.Compressors.PPMd.I1
|
||||
/// <summary>
|
||||
/// Gets or sets the symbol.
|
||||
/// </summary>
|
||||
public byte Symbol { get { return Memory[Address]; } set { Memory[Address] = value; } }
|
||||
public byte Symbol { get => Memory[Address]; set => Memory[Address] = value; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the frequency.
|
||||
/// </summary>
|
||||
public byte Frequency { get { return Memory[Address + 1]; } set { Memory[Address + 1] = value; } }
|
||||
public byte Frequency { get => Memory[Address + 1]; set => Memory[Address + 1] = value; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the successor.
|
||||
/// </summary>
|
||||
public Model.PpmContext Successor
|
||||
{
|
||||
get
|
||||
{
|
||||
return
|
||||
new Model.PpmContext(
|
||||
Memory[Address + 2] | ((uint)Memory[Address + 3]) << 8 |
|
||||
((uint)Memory[Address + 4]) << 16 | ((uint)Memory[Address + 5]) << 24, Memory);
|
||||
}
|
||||
get => new Model.PpmContext(
|
||||
Memory[Address + 2] | ((uint)Memory[Address + 3]) << 8 |
|
||||
((uint)Memory[Address + 4]) << 16 | ((uint)Memory[Address + 5]) << 24, Memory);
|
||||
set
|
||||
{
|
||||
Memory[Address + 2] = (byte)value.Address;
|
||||
@@ -72,7 +68,7 @@ namespace SharpCompress.Compressors.PPMd.I1
|
||||
/// </summary>
|
||||
/// <param name="offset"></param>
|
||||
/// <returns></returns>
|
||||
public PpmState this[int offset] { get { return new PpmState((uint)(Address + offset * Size), Memory); } }
|
||||
public PpmState this[int offset] => new PpmState((uint)(Address + offset * Size), Memory);
|
||||
|
||||
/// <summary>
|
||||
/// Allow a pointer to be implicitly converted to a PPM state.
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace SharpCompress.Compressors.PPMd
|
||||
|
||||
public int AllocatorSize
|
||||
{
|
||||
get { return allocatorSize; }
|
||||
get => allocatorSize;
|
||||
set
|
||||
{
|
||||
allocatorSize = value;
|
||||
@@ -63,15 +63,8 @@ namespace SharpCompress.Compressors.PPMd
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] Properties
|
||||
{
|
||||
get
|
||||
{
|
||||
return
|
||||
DataConverter.LittleEndian.GetBytes(
|
||||
(ushort)
|
||||
((ModelOrder - 1) + (((AllocatorSize >> 20) - 1) << 4) + ((ushort)ModelRestorationMethod << 12)));
|
||||
}
|
||||
}
|
||||
public byte[] Properties => DataConverter.LittleEndian.GetBytes(
|
||||
(ushort)
|
||||
((ModelOrder - 1) + (((AllocatorSize >> 20) - 1) << 4) + ((ushort)ModelRestorationMethod << 12)));
|
||||
}
|
||||
}
|
||||
@@ -57,11 +57,11 @@ namespace SharpCompress.Compressors.PPMd
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanRead { get { return !compress; } }
|
||||
public override bool CanRead => !compress;
|
||||
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite { get { return compress; } }
|
||||
public override bool CanWrite => compress;
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
@@ -84,9 +84,9 @@ namespace SharpCompress.Compressors.PPMd
|
||||
base.Dispose(isDisposing);
|
||||
}
|
||||
|
||||
public override long Length { get { throw new NotSupportedException(); } }
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
public override long Position { get { return position; } set { throw new NotSupportedException(); } }
|
||||
public override long Position { get => position; set => throw new NotSupportedException(); }
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,6 @@ namespace SharpCompress.Compressors.Rar
|
||||
|
||||
private long currentPartTotalReadBytes;
|
||||
private long currentEntryTotalReadBytes;
|
||||
private uint currentCrc;
|
||||
|
||||
internal MultiVolumeReadOnlyStream(IEnumerable<RarFilePart> parts, IExtractionListener streamListener)
|
||||
{
|
||||
@@ -60,7 +59,7 @@ namespace SharpCompress.Compressors.Rar
|
||||
|
||||
currentPartTotalReadBytes = 0;
|
||||
|
||||
currentCrc = filePartEnumerator.Current.FileHeader.FileCRC;
|
||||
CurrentCrc = filePartEnumerator.Current.FileHeader.FileCRC;
|
||||
|
||||
streamListener.FireFilePartExtractionBegin(filePartEnumerator.Current.FilePartName,
|
||||
filePartEnumerator.Current.FileHeader.CompressedSize,
|
||||
@@ -116,22 +115,22 @@ namespace SharpCompress.Compressors.Rar
|
||||
return totalRead;
|
||||
}
|
||||
|
||||
public override bool CanRead { get { return true; } }
|
||||
public override bool CanRead => true;
|
||||
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite { get { return false; } }
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public uint CurrentCrc { get { return this.currentCrc; } }
|
||||
public uint CurrentCrc { get; private set; }
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override long Length { get { throw new NotSupportedException(); } }
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
public override long Position { get { throw new NotSupportedException(); } set { throw new NotSupportedException(); } }
|
||||
public override long Position { get => throw new NotSupportedException(); set => throw new NotSupportedException(); }
|
||||
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
|
||||
@@ -15,12 +15,12 @@ namespace SharpCompress.Compressors.Rar {
|
||||
|
||||
public uint GetCrc()
|
||||
{
|
||||
return ~this.currentCrc;
|
||||
return ~currentCrc;
|
||||
}
|
||||
|
||||
public void ResetCrc()
|
||||
{
|
||||
this.currentCrc = 0xffffffff;
|
||||
currentCrc = 0xffffffff;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,9 +29,9 @@ namespace SharpCompress.Compressors.Rar {
|
||||
var result = base.Read(buffer, offset, count);
|
||||
if (result != 0)
|
||||
{
|
||||
this.currentCrc = RarCRC.CheckCrc(this.currentCrc, buffer, offset, result);
|
||||
currentCrc = RarCRC.CheckCrc(currentCrc, buffer, offset, result);
|
||||
}
|
||||
else if (GetCrc() != this.readStream.CurrentCrc)
|
||||
else if (GetCrc() != readStream.CurrentCrc)
|
||||
{
|
||||
// NOTE: we use the last FileHeader in a multipart volume to check CRC
|
||||
throw new InvalidFormatException("file crc mismatch");
|
||||
|
||||
@@ -43,19 +43,19 @@ namespace SharpCompress.Compressors.Rar
|
||||
readStream.Dispose();
|
||||
}
|
||||
|
||||
public override bool CanRead { get { return true; } }
|
||||
public override bool CanRead => true;
|
||||
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite { get { return false; } }
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
}
|
||||
|
||||
public override long Length { get { return fileHeader.UncompressedSize; } }
|
||||
public override long Length => fileHeader.UncompressedSize;
|
||||
|
||||
public override long Position { get { return fileHeader.UncompressedSize - unpack.DestSize; } set { throw new NotSupportedException(); } }
|
||||
public override long Position { get => fileHeader.UncompressedSize - unpack.DestSize; set => throw new NotSupportedException(); }
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace SharpCompress.Compressors.Rar
|
||||
|
||||
public long DestSize
|
||||
{
|
||||
get { return destUnpSize; }
|
||||
get => destUnpSize;
|
||||
set
|
||||
{
|
||||
destUnpSize = value;
|
||||
@@ -40,7 +40,7 @@ namespace SharpCompress.Compressors.Rar
|
||||
}
|
||||
}
|
||||
|
||||
public bool Suspended { set { suspended = value; } }
|
||||
public bool Suspended { set => suspended = value; }
|
||||
|
||||
public int Char
|
||||
{
|
||||
|
||||
@@ -146,9 +146,9 @@ namespace SharpCompress.Converters
|
||||
return ret;
|
||||
}
|
||||
|
||||
static public DataConverter LittleEndian { get { return BitConverter.IsLittleEndian ? Native : SwapConv; } }
|
||||
static public DataConverter LittleEndian => BitConverter.IsLittleEndian ? Native : SwapConv;
|
||||
|
||||
static public DataConverter BigEndian { get { return BitConverter.IsLittleEndian ? SwapConv : Native; } }
|
||||
static public DataConverter BigEndian => BitConverter.IsLittleEndian ? SwapConv : Native;
|
||||
|
||||
static public DataConverter Native { get; } = new CopyConverter();
|
||||
|
||||
|
||||
@@ -577,9 +577,9 @@ namespace Org.BouncyCastle.Crypto.Engines
|
||||
throw new ArgumentException("invalid parameter passed to Rijndael init - " + parameters.GetType());
|
||||
}
|
||||
|
||||
public string AlgorithmName { get { return "Rijndael"; } }
|
||||
public string AlgorithmName => "Rijndael";
|
||||
|
||||
public bool IsPartialBlockOkay { get { return false; } }
|
||||
public bool IsPartialBlockOkay => false;
|
||||
|
||||
public int GetBlockSize()
|
||||
{
|
||||
|
||||
@@ -14,20 +14,20 @@ namespace SharpCompress.IO
|
||||
this.streams = new Queue<Stream>(streams);
|
||||
}
|
||||
|
||||
public override bool CanRead { get { return true; } }
|
||||
public override bool CanRead => true;
|
||||
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite { get { return false; } }
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override long Length { get { throw new NotImplementedException(); } }
|
||||
public override long Length => throw new NotImplementedException();
|
||||
|
||||
public override long Position { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } }
|
||||
public override long Position { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
|
||||
@@ -30,20 +30,20 @@ namespace SharpCompress.IO
|
||||
|
||||
public Stream Stream { get; }
|
||||
|
||||
public override bool CanRead { get { return true; } }
|
||||
public override bool CanRead => true;
|
||||
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite { get { return false; } }
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override long Length { get { throw new NotSupportedException(); } }
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
public override long Position { get { throw new NotSupportedException(); } set { throw new NotSupportedException(); } }
|
||||
public override long Position { get => throw new NotSupportedException(); set => throw new NotSupportedException(); }
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
|
||||
@@ -14,19 +14,19 @@ namespace SharpCompress.IO
|
||||
|
||||
public ulong Count { get; private set; }
|
||||
|
||||
public override bool CanRead { get { return false; } }
|
||||
public override bool CanRead => false;
|
||||
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite { get { return true; } }
|
||||
public override bool CanWrite => true;
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
}
|
||||
|
||||
public override long Length { get { throw new NotSupportedException(); } }
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
public override long Position { get { throw new NotSupportedException(); } set { throw new NotSupportedException(); } }
|
||||
public override long Position { get => throw new NotSupportedException(); set => throw new NotSupportedException(); }
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
|
||||
@@ -24,20 +24,20 @@ namespace SharpCompress.IO
|
||||
|
||||
public Stream Stream { get; }
|
||||
|
||||
public override bool CanRead { get { return Stream.CanRead; } }
|
||||
public override bool CanRead => Stream.CanRead;
|
||||
|
||||
public override bool CanSeek { get { return Stream.CanSeek; } }
|
||||
public override bool CanSeek => Stream.CanSeek;
|
||||
|
||||
public override bool CanWrite { get { return Stream.CanWrite; } }
|
||||
public override bool CanWrite => Stream.CanWrite;
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
Stream.Flush();
|
||||
}
|
||||
|
||||
public override long Length { get { return Stream.Length; } }
|
||||
public override long Length => Stream.Length;
|
||||
|
||||
public override long Position { get { return Stream.Position; } set { Stream.Position = value; } }
|
||||
public override long Position { get => Stream.Position; set => Stream.Position = value; }
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
|
||||
@@ -16,20 +16,20 @@ namespace SharpCompress.IO
|
||||
|
||||
public Stream Stream { get; }
|
||||
|
||||
public override bool CanRead { get { return Stream.CanRead; } }
|
||||
public override bool CanRead => Stream.CanRead;
|
||||
|
||||
public override bool CanSeek { get { return Stream.CanSeek; } }
|
||||
public override bool CanSeek => Stream.CanSeek;
|
||||
|
||||
public override bool CanWrite { get { return Stream.CanWrite; } }
|
||||
public override bool CanWrite => Stream.CanWrite;
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
Stream.Flush();
|
||||
}
|
||||
|
||||
public override long Length { get { return Stream.Length; } }
|
||||
public override long Length => Stream.Length;
|
||||
|
||||
public override long Position { get { return Stream.Position; } set { Stream.Position = value; } }
|
||||
public override long Position { get => Stream.Position; set => Stream.Position = value; }
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
|
||||
@@ -32,20 +32,20 @@ namespace SharpCompress.IO
|
||||
|
||||
public Stream Stream { get; }
|
||||
|
||||
public override bool CanRead { get { return true; } }
|
||||
public override bool CanRead => true;
|
||||
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite { get { return false; } }
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override long Length { get { throw new NotSupportedException(); } }
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
public override long Position { get { throw new NotSupportedException(); } set { throw new NotSupportedException(); } }
|
||||
public override long Position { get => throw new NotSupportedException(); set => throw new NotSupportedException(); }
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
|
||||
@@ -68,18 +68,18 @@ namespace SharpCompress.IO
|
||||
IsRecording = true;
|
||||
}
|
||||
|
||||
public override bool CanRead { get { return true; } }
|
||||
public override bool CanRead => true;
|
||||
|
||||
public override bool CanSeek => stream.CanSeek;
|
||||
|
||||
public override bool CanWrite { get { return false; } }
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override long Length { get { throw new NotSupportedException(); } }
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
public override long Position
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace SharpCompress
|
||||
|
||||
#region IEnumerator<T> Members
|
||||
|
||||
public T Current { get { return lazyReadOnlyCollection.backing[index]; } }
|
||||
public T Current => lazyReadOnlyCollection.backing[index];
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace SharpCompress
|
||||
|
||||
#region IEnumerator Members
|
||||
|
||||
object IEnumerator.Current { get { return Current; } }
|
||||
object IEnumerator.Current => Current;
|
||||
|
||||
public bool MoveNext()
|
||||
{
|
||||
@@ -120,7 +120,7 @@ namespace SharpCompress
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsReadOnly { get { return true; } }
|
||||
public bool IsReadOnly => true;
|
||||
|
||||
public bool Remove(T item)
|
||||
{
|
||||
|
||||
@@ -33,9 +33,9 @@ namespace SharpCompress
|
||||
collection.CopyTo(array, arrayIndex);
|
||||
}
|
||||
|
||||
public int Count { get { return collection.Count; } }
|
||||
public int Count => collection.Count;
|
||||
|
||||
public bool IsReadOnly { get { return true; } }
|
||||
public bool IsReadOnly => true;
|
||||
|
||||
public bool Remove(T item)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace SharpCompress.Readers
|
||||
/// <summary>
|
||||
/// Current file entry
|
||||
/// </summary>
|
||||
public TEntry Entry { get { return entriesForCurrentReadStream.Current; } }
|
||||
public TEntry Entry => entriesForCurrentReadStream.Current;
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
@@ -217,40 +217,29 @@ namespace SharpCompress.Readers
|
||||
|
||||
#endregion
|
||||
|
||||
IEntry IReader.Entry { get { return Entry; } }
|
||||
IEntry IReader.Entry => Entry;
|
||||
|
||||
void IExtractionListener.FireCompressedBytesRead(long currentPartCompressedBytes, long compressedReadBytes)
|
||||
{
|
||||
if (CompressedBytesRead != null)
|
||||
CompressedBytesRead?.Invoke(this, new CompressedBytesReadEventArgs
|
||||
{
|
||||
CompressedBytesRead(this, new CompressedBytesReadEventArgs
|
||||
{
|
||||
CurrentFilePartCompressedBytesRead = currentPartCompressedBytes,
|
||||
CompressedBytesRead = compressedReadBytes
|
||||
});
|
||||
}
|
||||
CurrentFilePartCompressedBytesRead = currentPartCompressedBytes,
|
||||
CompressedBytesRead = compressedReadBytes
|
||||
});
|
||||
}
|
||||
|
||||
void IExtractionListener.FireFilePartExtractionBegin(string name, long size, long compressedSize)
|
||||
{
|
||||
if (FilePartExtractionBegin != null)
|
||||
FilePartExtractionBegin?.Invoke(this, new FilePartExtractionBeginEventArgs
|
||||
{
|
||||
FilePartExtractionBegin(this, new FilePartExtractionBeginEventArgs
|
||||
{
|
||||
CompressedSize = compressedSize,
|
||||
Size = size,
|
||||
Name = name
|
||||
});
|
||||
}
|
||||
CompressedSize = compressedSize,
|
||||
Size = size,
|
||||
Name = name
|
||||
});
|
||||
}
|
||||
void IReaderExtractionListener.FireEntryExtractionProgress(Entry entry, long bytesTransferred, int iterations)
|
||||
{
|
||||
if (EntryExtractionProgress != null)
|
||||
{
|
||||
EntryExtractionProgress(this,
|
||||
new ReaderExtractionEventArgs<IEntry>(entry, new ReaderProgress(entry, bytesTransferred, iterations))
|
||||
);
|
||||
}
|
||||
EntryExtractionProgress?.Invoke(this, new ReaderExtractionEventArgs<IEntry>(entry, new ReaderProgress(entry, bytesTransferred, iterations)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ namespace SharpCompress.Readers.Rar
|
||||
{
|
||||
}
|
||||
|
||||
object IEnumerator.Current { get { return Current; } }
|
||||
object IEnumerator.Current => Current;
|
||||
|
||||
public bool MoveNext()
|
||||
{
|
||||
|
||||
@@ -16,6 +16,6 @@ namespace SharpCompress.Readers.Rar
|
||||
return FileHeader.PackedStream;
|
||||
}
|
||||
|
||||
internal override string FilePartName { get { return "Unknown Stream - File Entry: " + FileHeader.FileName; } }
|
||||
internal override string FilePartName => "Unknown Stream - File Entry: " + FileHeader.FileName;
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ namespace SharpCompress.Readers.Rar
|
||||
|
||||
internal abstract void ValidateArchive(RarVolume archive);
|
||||
|
||||
public override RarVolume Volume { get { return volume; } }
|
||||
public override RarVolume Volume => volume;
|
||||
|
||||
#region Open
|
||||
|
||||
|
||||
@@ -15,20 +15,20 @@ namespace SharpCompress.Readers.Rar
|
||||
|
||||
internal RarFilePart Part { get; }
|
||||
|
||||
internal override IEnumerable<FilePart> Parts { get { return Part.AsEnumerable<FilePart>(); } }
|
||||
internal override IEnumerable<FilePart> Parts => Part.AsEnumerable<FilePart>();
|
||||
|
||||
internal override FileHeader FileHeader { get { return Part.FileHeader; } }
|
||||
internal override FileHeader FileHeader => Part.FileHeader;
|
||||
|
||||
public override CompressionType CompressionType { get { return CompressionType.Rar; } }
|
||||
public override CompressionType CompressionType => CompressionType.Rar;
|
||||
|
||||
/// <summary>
|
||||
/// The compressed file size
|
||||
/// </summary>
|
||||
public override long CompressedSize { get { return Part.FileHeader.CompressedSize; } }
|
||||
public override long CompressedSize => Part.FileHeader.CompressedSize;
|
||||
|
||||
/// <summary>
|
||||
/// The uncompressed file size
|
||||
/// </summary>
|
||||
public override long Size { get { return Part.FileHeader.UncompressedSize; } }
|
||||
public override long Size => Part.FileHeader.UncompressedSize;
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ namespace SharpCompress.Writers.Zip
|
||||
private readonly string zipComment;
|
||||
private long streamPosition;
|
||||
private PpmdProperties ppmdProps;
|
||||
private bool isZip64;
|
||||
private readonly bool isZip64;
|
||||
|
||||
public ZipWriter(Stream destination, ZipWriterOptions zipWriterOptions)
|
||||
: base(ArchiveType.Zip)
|
||||
@@ -293,15 +293,15 @@ namespace SharpCompress.Writers.Zip
|
||||
writeStream = GetWriteStream(originalStream);
|
||||
}
|
||||
|
||||
public override bool CanRead { get { return false; } }
|
||||
public override bool CanRead => false;
|
||||
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite { get { return true; } }
|
||||
public override bool CanWrite => true;
|
||||
|
||||
public override long Length { get { throw new NotSupportedException(); } }
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
public override long Position { get { throw new NotSupportedException(); } set { throw new NotSupportedException(); } }
|
||||
public override long Position { get => throw new NotSupportedException(); set => throw new NotSupportedException(); }
|
||||
|
||||
private Stream GetWriteStream(Stream writeStream)
|
||||
{
|
||||
|
||||
@@ -126,13 +126,13 @@ namespace SharpCompress.Test
|
||||
|
||||
void archive_FilePartExtractionBegin(object sender, FilePartExtractionBeginEventArgs e)
|
||||
{
|
||||
this.partTotal = e.Size;
|
||||
partTotal = e.Size;
|
||||
Console.WriteLine("Initializing File Part Extraction: " + e.Name);
|
||||
}
|
||||
|
||||
void archive_EntryExtractionBegin(object sender, ArchiveExtractionEventArgs<IArchiveEntry> e)
|
||||
{
|
||||
this.entryTotal = e.Item.Size;
|
||||
entryTotal = e.Item.Size;
|
||||
Console.WriteLine("Initializing File Entry Extraction: " + e.Item.Key);
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace SharpCompress.Test
|
||||
ResetScratch();
|
||||
using (var archive = ArchiveFactory.Open(path))
|
||||
{
|
||||
this.totalSize = archive.TotalUncompressSize;
|
||||
totalSize = archive.TotalUncompressSize;
|
||||
archive.EntryExtractionBegin += Archive_EntryExtractionBeginEx;
|
||||
archive.EntryExtractionEnd += Archive_EntryExtractionEndEx;
|
||||
archive.CompressedBytesRead += Archive_CompressedBytesReadEx;
|
||||
@@ -179,19 +179,19 @@ namespace SharpCompress.Test
|
||||
|
||||
private void Archive_EntryExtractionEndEx(object sender, ArchiveExtractionEventArgs<IArchiveEntry> e)
|
||||
{
|
||||
this.partTotal += e.Item.Size;
|
||||
partTotal += e.Item.Size;
|
||||
}
|
||||
|
||||
private void Archive_CompressedBytesReadEx(object sender, CompressedBytesReadEventArgs e)
|
||||
{
|
||||
string percentage = this.entryTotal.HasValue ? this.CreatePercentage(e.CompressedBytesRead, this.entryTotal.Value).ToString() : "-";
|
||||
string tortalPercentage = this.CreatePercentage(this.partTotal + e.CompressedBytesRead, this.totalSize).ToString();
|
||||
string percentage = entryTotal.HasValue ? CreatePercentage(e.CompressedBytesRead, entryTotal.Value).ToString() : "-";
|
||||
string tortalPercentage = CreatePercentage(partTotal + e.CompressedBytesRead, totalSize).ToString();
|
||||
Console.WriteLine(@"Read Compressed File Progress: {0}% Total Progress {1}%", percentage, tortalPercentage);
|
||||
}
|
||||
|
||||
private void Archive_EntryExtractionBeginEx(object sender, ArchiveExtractionEventArgs<IArchiveEntry> e)
|
||||
{
|
||||
this.entryTotal = e.Item.Size;
|
||||
entryTotal = e.Item.Size;
|
||||
}
|
||||
|
||||
private int CreatePercentage(long n, long d)
|
||||
|
||||
@@ -31,15 +31,12 @@ namespace SharpCompress.Test
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override long Length
|
||||
{
|
||||
get { throw new NotSupportedException(); }
|
||||
}
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
public override long Position
|
||||
{
|
||||
get { throw new NotSupportedException(); }
|
||||
set { throw new NotSupportedException(); }
|
||||
get => throw new NotSupportedException();
|
||||
set => throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace SharpCompress.Test
|
||||
Assert.Equal(size, tarStream.Length);
|
||||
using (var entryStream = archiveEntry.OpenEntryStream())
|
||||
{
|
||||
var result = SharpCompress.Archives.Tar.TarArchive.IsTarFile(entryStream);
|
||||
var result = Archives.Tar.TarArchive.IsTarFile(entryStream);
|
||||
}
|
||||
Assert.Equal(size, tarStream.Length);
|
||||
using (var entryStream = archiveEntry.OpenEntryStream())
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace SharpCompress.Test.Rar
|
||||
/// </summary>
|
||||
public class RarHeaderFactoryTest : TestBase
|
||||
{
|
||||
private RarHeaderFactory rarHeaderFactory;
|
||||
private readonly RarHeaderFactory rarHeaderFactory;
|
||||
|
||||
public RarHeaderFactoryTest()
|
||||
{
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace SharpCompress.Test
|
||||
string scratchPath = Path.Combine(SCRATCH_FILES_PATH, "Tar.tar");
|
||||
string unmodified = Path.Combine(TEST_ARCHIVES_PATH, "Tar.noEmptyDirs.tar");
|
||||
|
||||
base.ResetScratch();
|
||||
ResetScratch();
|
||||
using (var archive = TarArchive.Create())
|
||||
{
|
||||
archive.AddAllFromDirectory(ORIGINAL_FILES_PATH);
|
||||
@@ -120,7 +120,7 @@ namespace SharpCompress.Test
|
||||
string unmodified = Path.Combine(TEST_ARCHIVES_PATH, "Tar.mod.tar");
|
||||
string modified = Path.Combine(TEST_ARCHIVES_PATH, "Tar.noEmptyDirs.tar");
|
||||
|
||||
base.ResetScratch();
|
||||
ResetScratch();
|
||||
using (var archive = TarArchive.Open(unmodified))
|
||||
{
|
||||
archive.AddEntry("jpg\\test.jpg", jpg);
|
||||
@@ -136,7 +136,7 @@ namespace SharpCompress.Test
|
||||
string modified = Path.Combine(TEST_ARCHIVES_PATH, "Tar.mod.tar");
|
||||
string unmodified = Path.Combine(TEST_ARCHIVES_PATH, "Tar.noEmptyDirs.tar");
|
||||
|
||||
base.ResetScratch();
|
||||
ResetScratch();
|
||||
using (var archive = TarArchive.Open(unmodified))
|
||||
{
|
||||
var entry = archive.Entries.Single(x => x.Key.EndsWith("jpg"));
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user