Skip to content

Commit

Permalink
Merge pull request #697 from IngBertolini/rar_comment
Browse files Browse the repository at this point in the history
Added support for reading comment header for Rar v5 archives
  • Loading branch information
adamhathcock authored Sep 30, 2022
2 parents 3caf5a5 + c37ea5c commit 4f0840b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/SharpCompress/Common/Rar/RarVolume.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ internal IEnumerable<RarFilePart> GetVolumeFileParts()
yield return CreateFilePart(lastMarkHeader!, fh);
}
break;
case HeaderType.Service:
{
var fh = (FileHeader)header;
if (fh.FileName == "CMT")
{
var part = CreateFilePart(lastMarkHeader!, fh);
var buffer = new byte[fh.CompressedSize];
part.GetCompressedStream().Read(buffer, 0, buffer.Length);
Comment = System.Text.Encoding.UTF8.GetString(buffer, 0, buffer.Length - 1);
}
}
break;
}
}
}
Expand Down Expand Up @@ -145,5 +157,7 @@ public int MaxVersion
return 1;
}
}

public string? Comment { get; internal set; }
}
}

0 comments on commit 4f0840b

Please sign in to comment.