[FileTools, SimpleSort, ZipFile/Entry] TorrentZip works! Mostly!

Writing to torrentzip works but for some reason the compressed streams are not being generated at the correct size. This is odd and seems to only affect newly added files and not ones copied from other archives. Also, found some glaring flaws in the headered output that explains why I was having issues previously. Typos D=
This commit is contained in:
Matt Nadareski
2016-09-16 11:37:55 -07:00
parent 444fc1696b
commit c69dddbc26
4 changed files with 313 additions and 286 deletions

View File

@@ -86,6 +86,10 @@ namespace SabreTools.Helper
{
return _entries[i].SHA1;
}
public bool Contains(string n)
{
return _entries.Contains(new ZipFileEntry(new MemoryStream(), n, true));
}
#endregion
@@ -658,6 +662,8 @@ namespace SabreTools.Helper
torrentZip &= zfe.TorrentZip;
}
_centerDirSize = (ulong)_zipstream.Position - _centerDirStart;
// Then get the central directory hash
OptimizedCRC ocrc = new OptimizedCRC();
byte[] buffer = new byte[_centerDirSize];
@@ -674,7 +680,6 @@ namespace SabreTools.Helper
_zipstream.Position = currentPosition;
// Now set more of the information
_centerDirSize = (ulong)_zipstream.Position - _centerDirStart;
_fileComment = (torrentZip ? Encoding.ASCII.GetBytes(("TORRENTZIPPED-" + calculatedCrc).ToCharArray()) : new byte[0]);
_zipStatus = (torrentZip ? ZipStatus.TorrentZip : ZipStatus.None);