Skip to content

Commit

Permalink
Properly detect if RAR is complete at the end or not
Browse files Browse the repository at this point in the history
  • Loading branch information
BrendanGrant committed Feb 13, 2021
1 parent 53393e7 commit 5b86c40
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/SharpCompress/Archives/Rar/RarArchiveEntry.cs
Expand Up @@ -72,7 +72,7 @@ public bool IsComplete
{
get
{
return parts.Select(fp => fp.FileHeader).Any(fh => !fh.IsSplitAfter);
return parts.Select(fp => fp.FileHeader).Any(fh => !fh.IsSplitBefore && !fh.IsSplitAfter);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/SharpCompress/Common/Rar/Headers/FileHeader.cs
Expand Up @@ -437,6 +437,7 @@ internal uint FileCrc
internal long DataStartPosition { get; set; }
public Stream PackedStream { get; set; }

public bool IsSplitBefore => IsRar5 ? HasHeaderFlag(HeaderFlagsV5.SPLIT_BEFORE) : HasFlag(FileFlagsV4.SPLIT_BEFORE);
public bool IsSplitAfter => IsRar5 ? HasHeaderFlag(HeaderFlagsV5.SPLIT_AFTER) : HasFlag(FileFlagsV4.SPLIT_AFTER);

public bool IsDirectory => HasFlag(IsRar5 ? FileFlagsV5.DIRECTORY : FileFlagsV4.DIRECTORY);
Expand Down

0 comments on commit 5b86c40

Please sign in to comment.