mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Handle as many warnings as possible
This commit is contained in:
@@ -92,16 +92,16 @@ namespace SabreTools.FileTypes.Archives
|
||||
FileStream outstream = File.Create(Path.Combine(outDir, Path.GetFileNameWithoutExtension(this.Filename)));
|
||||
var gz = new gZip();
|
||||
ZipReturn ret = gz.ZipFileOpen(this.Filename);
|
||||
ret = gz.ZipFileOpenReadStream(0, out Stream gzstream, out ulong streamSize);
|
||||
ret = gz.ZipFileOpenReadStream(0, out Stream? gzstream, out ulong streamSize);
|
||||
#if NET20 || NET35
|
||||
byte[] buffer = new byte[32768];
|
||||
int read;
|
||||
while ((read = gzstream.Read(buffer, 0, buffer.Length)) > 0)
|
||||
while ((read = gzstream!.Read(buffer, 0, buffer.Length)) > 0)
|
||||
{
|
||||
outstream.Write(buffer, 0, read);
|
||||
}
|
||||
#else
|
||||
gzstream.CopyTo(outstream);
|
||||
gzstream!.CopyTo(outstream);
|
||||
#endif
|
||||
|
||||
// Dispose of the streams
|
||||
@@ -189,12 +189,12 @@ namespace SabreTools.FileTypes.Archives
|
||||
realEntry = Path.GetFileNameWithoutExtension(this.Filename);
|
||||
var gz = new gZip();
|
||||
ZipReturn ret = gz.ZipFileOpen(this.Filename);
|
||||
ret = gz.ZipFileOpenReadStream(0, out Stream gzstream, out ulong streamSize);
|
||||
ret = gz.ZipFileOpenReadStream(0, out Stream? gzstream, out ulong streamSize);
|
||||
|
||||
// Write the file out
|
||||
byte[] gbuffer = new byte[_bufferSize];
|
||||
int glen;
|
||||
while ((glen = gzstream.Read(gbuffer, 0, _bufferSize)) > 0)
|
||||
while ((glen = gzstream!.Read(gbuffer, 0, _bufferSize)) > 0)
|
||||
{
|
||||
|
||||
ms.Write(gbuffer, 0, glen);
|
||||
@@ -260,12 +260,12 @@ namespace SabreTools.FileTypes.Archives
|
||||
{
|
||||
var gz = new gZip();
|
||||
ZipReturn ret = gz.ZipFileOpen(this.Filename);
|
||||
ret = gz.ZipFileOpenReadStream(0, out Stream gzstream, out ulong streamSize);
|
||||
ret = gz.ZipFileOpenReadStream(0, out Stream? gzstream, out ulong streamSize);
|
||||
gzipEntryRom = GetInfo(gzstream, hashes: this.AvailableHashTypes);
|
||||
gzipEntryRom.Filename = gz.GetLocalFile(0).Filename;
|
||||
gzipEntryRom.Parent = gamename;
|
||||
gzipEntryRom.Date = (gz.TimeStamp > 0 ? gz.TimeStamp.ToString() : null);
|
||||
gzstream.Dispose();
|
||||
gzstream!.Dispose();
|
||||
}
|
||||
|
||||
// Fill in comon details and add to the list
|
||||
|
||||
@@ -115,28 +115,28 @@ namespace SabreTools.FileTypes.Archives
|
||||
for (int i = 0; i < zf.LocalFilesCount() && zr == ZipReturn.ZipGood; i++)
|
||||
{
|
||||
// Open the read stream
|
||||
zr = zf.ZipFileOpenReadStream(i, out Stream readStream, out ulong streamsize);
|
||||
zr = zf.ZipFileOpenReadStream(i, out Stream? readStream, out ulong streamsize);
|
||||
|
||||
// Create the rest of the path, if needed
|
||||
if (!string.IsNullOrEmpty(Path.GetDirectoryName(zf.GetLocalFile(i).Filename)))
|
||||
Directory.CreateDirectory(Path.Combine(outDir, Path.GetDirectoryName(zf.GetLocalFile(i).Filename)!));
|
||||
|
||||
// If the entry ends with a directory separator, continue to the next item, if any
|
||||
if (zf.GetLocalFile(i).Filename.EndsWith(Path.DirectorySeparatorChar.ToString())
|
||||
|| zf.GetLocalFile(i).Filename.EndsWith(Path.AltDirectorySeparatorChar.ToString())
|
||||
|| zf.GetLocalFile(i).Filename.EndsWith(Path.PathSeparator.ToString()))
|
||||
if (zf.GetLocalFile(i).Filename!.EndsWith(Path.DirectorySeparatorChar.ToString())
|
||||
|| zf.GetLocalFile(i).Filename!.EndsWith(Path.AltDirectorySeparatorChar.ToString())
|
||||
|| zf.GetLocalFile(i).Filename!.EndsWith(Path.PathSeparator.ToString()))
|
||||
{
|
||||
zf.ZipFileCloseReadStream();
|
||||
continue;
|
||||
}
|
||||
|
||||
FileStream writeStream = File.Create(Path.Combine(outDir, zf.GetLocalFile(i).Filename));
|
||||
FileStream writeStream = File.Create(Path.Combine(outDir, zf.GetLocalFile(i).Filename!));
|
||||
|
||||
// If the stream is smaller than the buffer, just run one loop through to avoid issues
|
||||
if (streamsize < _bufferSize)
|
||||
{
|
||||
byte[] ibuffer = new byte[streamsize];
|
||||
int ilen = readStream.Read(ibuffer, 0, (int)streamsize);
|
||||
int ilen = readStream!.Read(ibuffer, 0, (int)streamsize);
|
||||
writeStream.Write(ibuffer, 0, ilen);
|
||||
writeStream.Flush();
|
||||
}
|
||||
@@ -146,7 +146,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
int realBufferSize = (streamsize < _bufferSize ? (int)streamsize : _bufferSize);
|
||||
byte[] ibuffer = new byte[realBufferSize];
|
||||
int ilen;
|
||||
while ((ilen = readStream.Read(ibuffer, 0, realBufferSize)) > 0)
|
||||
while ((ilen = readStream!.Read(ibuffer, 0, realBufferSize)) > 0)
|
||||
{
|
||||
writeStream.Write(ibuffer, 0, ilen);
|
||||
writeStream.Flush();
|
||||
@@ -241,17 +241,17 @@ namespace SabreTools.FileTypes.Archives
|
||||
|
||||
for (int i = 0; i < zf.LocalFilesCount() && zr == ZipReturn.ZipGood; i++)
|
||||
{
|
||||
if (zf.GetLocalFile(i).Filename.Contains(entryName))
|
||||
if (zf.GetLocalFile(i).Filename!.Contains(entryName))
|
||||
{
|
||||
// Open the read stream
|
||||
realEntry = zf.GetLocalFile(i).Filename;
|
||||
zr = zf.ZipFileOpenReadStream(i, out Stream readStream, out ulong streamsize);
|
||||
zr = zf.ZipFileOpenReadStream(i, out Stream? readStream, out ulong streamsize);
|
||||
|
||||
// If the stream is smaller than the buffer, just run one loop through to avoid issues
|
||||
if (streamsize < _bufferSize)
|
||||
{
|
||||
byte[] ibuffer = new byte[streamsize];
|
||||
int ilen = readStream.Read(ibuffer, 0, (int)streamsize);
|
||||
int ilen = readStream!.Read(ibuffer, 0, (int)streamsize);
|
||||
ms.Write(ibuffer, 0, ilen);
|
||||
ms.Flush();
|
||||
}
|
||||
@@ -262,13 +262,13 @@ namespace SabreTools.FileTypes.Archives
|
||||
int ilen;
|
||||
while (streamsize > _bufferSize)
|
||||
{
|
||||
ilen = readStream.Read(ibuffer, 0, _bufferSize);
|
||||
ilen = readStream!.Read(ibuffer, 0, _bufferSize);
|
||||
ms.Write(ibuffer, 0, ilen);
|
||||
ms.Flush();
|
||||
streamsize -= _bufferSize;
|
||||
}
|
||||
|
||||
ilen = readStream.Read(ibuffer, 0, (int)streamsize);
|
||||
ilen = readStream!.Read(ibuffer, 0, (int)streamsize);
|
||||
ms.Write(ibuffer, 0, ilen);
|
||||
ms.Flush();
|
||||
}
|
||||
@@ -317,15 +317,15 @@ namespace SabreTools.FileTypes.Archives
|
||||
{
|
||||
// If the entry is a directory (or looks like a directory), we don't want to open it
|
||||
if (zf.GetLocalFile(i).IsDirectory
|
||||
|| zf.GetLocalFile(i).Filename.EndsWith(Path.DirectorySeparatorChar.ToString())
|
||||
|| zf.GetLocalFile(i).Filename.EndsWith(Path.AltDirectorySeparatorChar.ToString())
|
||||
|| zf.GetLocalFile(i).Filename.EndsWith(Path.PathSeparator.ToString()))
|
||||
|| zf.GetLocalFile(i).Filename!.EndsWith(Path.DirectorySeparatorChar.ToString())
|
||||
|| zf.GetLocalFile(i).Filename!.EndsWith(Path.AltDirectorySeparatorChar.ToString())
|
||||
|| zf.GetLocalFile(i).Filename!.EndsWith(Path.PathSeparator.ToString()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Open the read stream
|
||||
zr = zf.ZipFileOpenReadStream(i, out Stream readStream, out ulong streamsize);
|
||||
zr = zf.ZipFileOpenReadStream(i, out Stream? readStream, out ulong streamsize);
|
||||
|
||||
// If we get a read error, log it and continue
|
||||
if (zr != ZipReturn.ZipGood)
|
||||
@@ -390,7 +390,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
List<(string, bool)> zipEntries = [];
|
||||
for (int i = 0; i < zf.LocalFilesCount(); i++)
|
||||
{
|
||||
zipEntries.Add((zf.GetLocalFile(i).Filename, zf.GetLocalFile(i).IsDirectory));
|
||||
zipEntries.Add((zf.GetLocalFile(i).Filename!, zf.GetLocalFile(i).IsDirectory));
|
||||
}
|
||||
|
||||
zipEntries = zipEntries.OrderBy(p => p.Item1, new NaturalReversedComparer()).ToList();
|
||||
@@ -528,7 +528,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
var oldZipFileContents = new List<string>();
|
||||
for (int i = 0; i < oldZipFile.LocalFilesCount(); i++)
|
||||
{
|
||||
oldZipFileContents.Add(oldZipFile.GetLocalFile(i).Filename);
|
||||
oldZipFileContents.Add(oldZipFile.GetLocalFile(i).Filename!);
|
||||
}
|
||||
|
||||
// If the old one doesn't contain the new file, then add it
|
||||
@@ -540,7 +540,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
// Then add all of the old entries to it too
|
||||
for (int i = 0; i < oldZipFile.LocalFilesCount(); i++)
|
||||
{
|
||||
inputIndexMap.Add(oldZipFile.GetLocalFile(i).Filename, i);
|
||||
inputIndexMap.Add(oldZipFile.GetLocalFile(i).Filename!, i);
|
||||
}
|
||||
|
||||
// If the number of entries is the same as the old archive, skip out
|
||||
@@ -600,15 +600,15 @@ namespace SabreTools.FileTypes.Archives
|
||||
else
|
||||
{
|
||||
// Instantiate the streams
|
||||
oldZipFile.ZipFileOpenReadStream(index, out Stream zreadStream, out ulong istreamSize);
|
||||
zipFile.ZipFileOpenWriteStream(false, true, oldZipFile.GetLocalFile(index).Filename, istreamSize, 0, out writeStream, null);
|
||||
oldZipFile.ZipFileOpenReadStream(index, out Stream? zreadStream, out ulong istreamSize);
|
||||
zipFile.ZipFileOpenWriteStream(false, true, oldZipFile.GetLocalFile(index).Filename!, istreamSize, 0, out writeStream, null);
|
||||
|
||||
// Copy the input stream to the output
|
||||
if (writeStream != null)
|
||||
{
|
||||
byte[] ibuffer = new byte[_bufferSize];
|
||||
int ilen;
|
||||
while ((ilen = zreadStream.Read(ibuffer, 0, _bufferSize)) > 0)
|
||||
while ((ilen = zreadStream!.Read(ibuffer, 0, _bufferSize)) > 0)
|
||||
{
|
||||
writeStream.Write(ibuffer, 0, ilen);
|
||||
writeStream.Flush();
|
||||
@@ -616,7 +616,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
}
|
||||
|
||||
oldZipFile.ZipFileCloseReadStream();
|
||||
zipFile.ZipFileCloseWriteStream(oldZipFile.GetLocalFile(index).CRC);
|
||||
zipFile.ZipFileCloseWriteStream(oldZipFile.GetLocalFile(index).CRC!);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -752,7 +752,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
var oldZipFileContents = new List<string>();
|
||||
for (int j = 0; j < oldZipFile.LocalFilesCount(); j++)
|
||||
{
|
||||
oldZipFileContents.Add(oldZipFile.GetLocalFile(j).Filename);
|
||||
oldZipFileContents.Add(oldZipFile.GetLocalFile(j).Filename!);
|
||||
}
|
||||
|
||||
// If the old one contains the new file, then just skip out
|
||||
@@ -767,7 +767,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
// Then add all of the old entries to it too
|
||||
for (int i = 0; i < oldZipFile.LocalFilesCount(); i++)
|
||||
{
|
||||
inputIndexMap.Add(oldZipFile.GetLocalFile(i).Filename, i);
|
||||
inputIndexMap.Add(oldZipFile.GetLocalFile(i).Filename!, i);
|
||||
}
|
||||
|
||||
// If the number of entries is the same as the old archive, skip out
|
||||
@@ -825,19 +825,19 @@ namespace SabreTools.FileTypes.Archives
|
||||
else
|
||||
{
|
||||
// Instantiate the streams
|
||||
oldZipFile.ZipFileOpenReadStream(index, out Stream zreadStream, out ulong istreamSize);
|
||||
zipFile.ZipFileOpenWriteStream(false, true, oldZipFile.GetLocalFile(index).Filename, istreamSize, 0, out writeStream, null);
|
||||
oldZipFile.ZipFileOpenReadStream(index, out Stream? zreadStream, out ulong istreamSize);
|
||||
zipFile.ZipFileOpenWriteStream(false, true, oldZipFile.GetLocalFile(index).Filename!, istreamSize, 0, out writeStream, null);
|
||||
|
||||
// Copy the input stream to the output
|
||||
byte[] ibuffer = new byte[_bufferSize];
|
||||
int ilen;
|
||||
while ((ilen = zreadStream.Read(ibuffer, 0, _bufferSize)) > 0)
|
||||
while ((ilen = zreadStream!.Read(ibuffer, 0, _bufferSize)) > 0)
|
||||
{
|
||||
writeStream!.Write(ibuffer, 0, ilen);
|
||||
writeStream.Flush();
|
||||
}
|
||||
|
||||
zipFile.ZipFileCloseWriteStream(oldZipFile.GetLocalFile(index).CRC);
|
||||
zipFile.ZipFileCloseWriteStream(oldZipFile.GetLocalFile(index).CRC!);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,10 +330,10 @@ namespace SabreTools.FileTypes.Archives
|
||||
oldTarFile = TarArchive.Open(archiveFileName);
|
||||
|
||||
// Get a list of all current entries
|
||||
List<string> entries = oldTarFile.Entries.Select(i => i.Key).ToList();
|
||||
var entries = oldTarFile.Entries.Select(i => i.Key).ToList();
|
||||
|
||||
// Map all inputs to index
|
||||
Dictionary<string, int> inputIndexMap = new();
|
||||
var inputIndexMap = new Dictionary<string, int>();
|
||||
|
||||
// If the old one doesn't contain the new file, then add it
|
||||
if (!entries.Contains(baseFile.Filename.Replace('\\', '/')))
|
||||
@@ -342,7 +342,11 @@ namespace SabreTools.FileTypes.Archives
|
||||
// Then add all of the old entries to it too
|
||||
for (int i = 0; i < entries.Count; i++)
|
||||
{
|
||||
inputIndexMap.Add(entries[i], i);
|
||||
var entry = entries[i];
|
||||
if (entry == null)
|
||||
continue;
|
||||
|
||||
inputIndexMap.Add(entry, i);
|
||||
}
|
||||
|
||||
// If the number of entries is the same as the old archive, skip out
|
||||
@@ -364,7 +368,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
|
||||
// Get temporary date-time if possible
|
||||
DateTime? usableDate = null;
|
||||
if (UseDates && !string.IsNullOrEmpty(baseFile.Date) && DateTime.TryParse(baseFile.Date.Replace('\\', '/'), out DateTime dt))
|
||||
if (UseDates && !string.IsNullOrEmpty(baseFile.Date) && DateTime.TryParse(baseFile.Date!.Replace('\\', '/'), out DateTime dt))
|
||||
usableDate = dt;
|
||||
|
||||
// If we have the input file, add it now
|
||||
@@ -498,10 +502,10 @@ namespace SabreTools.FileTypes.Archives
|
||||
oldTarFile = TarArchive.Open(archiveFileName);
|
||||
|
||||
// Get a list of all current entries
|
||||
List<string> entries = oldTarFile.Entries.Select(i => i.Key).ToList();
|
||||
var entries = oldTarFile.Entries.Select(i => i.Key).ToList();
|
||||
|
||||
// Map all inputs to index
|
||||
Dictionary<string, int> inputIndexMap = new();
|
||||
var inputIndexMap = new Dictionary<string, int>();
|
||||
for (int i = 0; i < inputFiles.Count; i++)
|
||||
{
|
||||
// If the old one contains the new file, then just skip out
|
||||
@@ -516,7 +520,11 @@ namespace SabreTools.FileTypes.Archives
|
||||
// Then add all of the old entries to it too
|
||||
for (int i = 0; i < entries.Count; i++)
|
||||
{
|
||||
inputIndexMap.Add(entries[i], i);
|
||||
var entry = entries[i];
|
||||
if (entry == null)
|
||||
continue;
|
||||
|
||||
inputIndexMap.Add(entry, i);
|
||||
}
|
||||
|
||||
// If the number of entries is the same as the old archive, skip out
|
||||
|
||||
@@ -268,7 +268,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
public override bool IsTorrent()
|
||||
{
|
||||
// Check for the file existing first
|
||||
if (!File.Exists(this.Filename))
|
||||
if (this.Filename == null || !File.Exists(this.Filename))
|
||||
return false;
|
||||
|
||||
string datum = Path.GetFileName(this.Filename).ToLowerInvariant();
|
||||
@@ -290,7 +290,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
public BaseFile? GetTorrentXZFileInfo()
|
||||
{
|
||||
// Check for the file existing first
|
||||
if (!File.Exists(this.Filename))
|
||||
if (this.Filename == null || !File.Exists(this.Filename))
|
||||
return null;
|
||||
|
||||
string datum = Path.GetFileName(this.Filename).ToLowerInvariant();
|
||||
|
||||
@@ -97,15 +97,15 @@ namespace SabreTools.FileTypes.Archives
|
||||
}
|
||||
|
||||
// If the entry ends with a directory separator, continue to the next item, if any
|
||||
if (zf.GetLocalFile(i).Filename.EndsWith(Path.DirectorySeparatorChar.ToString())
|
||||
|| zf.GetLocalFile(i).Filename.EndsWith(Path.AltDirectorySeparatorChar.ToString())
|
||||
|| zf.GetLocalFile(i).Filename.EndsWith(Path.PathSeparator.ToString()))
|
||||
if (zf.GetLocalFile(i).Filename!.EndsWith(Path.DirectorySeparatorChar.ToString())
|
||||
|| zf.GetLocalFile(i).Filename!.EndsWith(Path.AltDirectorySeparatorChar.ToString())
|
||||
|| zf.GetLocalFile(i).Filename!.EndsWith(Path.PathSeparator.ToString()))
|
||||
{
|
||||
zf.ZipFileCloseReadStream();
|
||||
continue;
|
||||
}
|
||||
|
||||
FileStream writeStream = File.Create(Path.Combine(outDir, zf.GetLocalFile(i).Filename));
|
||||
FileStream writeStream = File.Create(Path.Combine(outDir, zf.GetLocalFile(i).Filename!));
|
||||
|
||||
// If the stream is smaller than the buffer, just run one loop through to avoid issues
|
||||
if (streamsize < _bufferSize)
|
||||
@@ -212,7 +212,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
|
||||
for (int i = 0; i < zf.LocalFilesCount() && zr == ZipReturn.ZipGood; i++)
|
||||
{
|
||||
if (zf.GetLocalFile(i).Filename.Contains(entryName))
|
||||
if (zf.GetLocalFile(i).Filename!.Contains(entryName))
|
||||
{
|
||||
// Open the read stream
|
||||
realEntry = zf.GetLocalFile(i).Filename;
|
||||
@@ -283,9 +283,9 @@ namespace SabreTools.FileTypes.Archives
|
||||
{
|
||||
// If the entry is a directory (or looks like a directory), we don't want to open it
|
||||
if (zf.GetLocalFile(i).IsDirectory
|
||||
|| zf.GetLocalFile(i).Filename.EndsWith(Path.DirectorySeparatorChar.ToString())
|
||||
|| zf.GetLocalFile(i).Filename.EndsWith(Path.AltDirectorySeparatorChar.ToString())
|
||||
|| zf.GetLocalFile(i).Filename.EndsWith(Path.PathSeparator.ToString()))
|
||||
|| zf.GetLocalFile(i).Filename!.EndsWith(Path.DirectorySeparatorChar.ToString())
|
||||
|| zf.GetLocalFile(i).Filename!.EndsWith(Path.AltDirectorySeparatorChar.ToString())
|
||||
|| zf.GetLocalFile(i).Filename!.EndsWith(Path.PathSeparator.ToString()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -353,7 +353,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
List<(string, bool)> zipEntries = new();
|
||||
for (int i = 0; i < zf.LocalFilesCount(); i++)
|
||||
{
|
||||
zipEntries.Add((zf.GetLocalFile(i).Filename, zf.GetLocalFile(i).IsDirectory));
|
||||
zipEntries.Add((zf.GetLocalFile(i).Filename!, zf.GetLocalFile(i).IsDirectory));
|
||||
}
|
||||
|
||||
zipEntries = zipEntries.OrderBy(p => p.Item1, new NaturalReversedComparer()).ToList();
|
||||
@@ -484,7 +484,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
var oldZipFileContents = new List<string>();
|
||||
for (int i = 0; i < oldZipFile.LocalFilesCount(); i++)
|
||||
{
|
||||
oldZipFileContents.Add(oldZipFile.GetLocalFile(i).Filename);
|
||||
oldZipFileContents.Add(oldZipFile.GetLocalFile(i).Filename!);
|
||||
}
|
||||
|
||||
// If the old one doesn't contain the new file, then add it
|
||||
@@ -494,7 +494,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
// Then add all of the old entries to it too
|
||||
for (int i = 0; i < oldZipFile.LocalFilesCount(); i++)
|
||||
{
|
||||
inputIndexMap.Add(oldZipFile.GetLocalFile(i).Filename, i);
|
||||
inputIndexMap.Add(oldZipFile.GetLocalFile(i).Filename!, i);
|
||||
}
|
||||
|
||||
// If the number of entries is the same as the old archive, skip out
|
||||
@@ -554,7 +554,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
oldZipFile.ZipFileOpenReadStream(index, false, out Stream? zreadStream, out ulong istreamSize, out ushort icompressionMethod);
|
||||
long msDosDateTime = oldZipFile.GetLocalFile(index).LastModified;
|
||||
TimeStamps ts = new() { ModTime = msDosDateTime };
|
||||
zipFile.ZipFileOpenWriteStream(false, true, oldZipFile.GetLocalFile(index).Filename, istreamSize, (ushort)CompressionMethod.Deflated, out writeStream, ts);
|
||||
zipFile.ZipFileOpenWriteStream(false, true, oldZipFile.GetLocalFile(index).Filename!, istreamSize, (ushort)CompressionMethod.Deflated, out writeStream, ts);
|
||||
|
||||
// Copy the input stream to the output
|
||||
byte[] ibuffer = new byte[_bufferSize];
|
||||
@@ -566,7 +566,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
}
|
||||
|
||||
oldZipFile.ZipFileCloseReadStream();
|
||||
zipFile.ZipFileCloseWriteStream(oldZipFile.GetLocalFile(index).CRC);
|
||||
zipFile.ZipFileCloseWriteStream(oldZipFile.GetLocalFile(index).CRC!);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -704,7 +704,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
var oldZipFileContents = new List<string>();
|
||||
for (int j = 0; j < oldZipFile.LocalFilesCount(); j++)
|
||||
{
|
||||
oldZipFileContents.Add(oldZipFile.GetLocalFile(j).Filename);
|
||||
oldZipFileContents.Add(oldZipFile.GetLocalFile(j).Filename!);
|
||||
}
|
||||
|
||||
// If the old one contains the new file, then just skip out
|
||||
@@ -719,7 +719,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
// Then add all of the old entries to it too
|
||||
for (int i = 0; i < oldZipFile.LocalFilesCount(); i++)
|
||||
{
|
||||
inputIndexMap.Add(oldZipFile.GetLocalFile(i).Filename, i);
|
||||
inputIndexMap.Add(oldZipFile.GetLocalFile(i).Filename!, i);
|
||||
}
|
||||
|
||||
// If the number of entries is the same as the old archive, skip out
|
||||
@@ -780,7 +780,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
oldZipFile.ZipFileOpenReadStream(index, false, out Stream? zreadStream, out ulong istreamSize, out ushort icompressionMethod);
|
||||
long msDosDateTime = oldZipFile.GetLocalFile(index).LastModified;
|
||||
TimeStamps ts = new() { ModTime = msDosDateTime };
|
||||
zipFile.ZipFileOpenWriteStream(false, true, oldZipFile.GetLocalFile(index).Filename, istreamSize, (ushort)CompressionMethod.Deflated, out writeStream, ts);
|
||||
zipFile.ZipFileOpenWriteStream(false, true, oldZipFile.GetLocalFile(index).Filename!, istreamSize, (ushort)CompressionMethod.Deflated, out writeStream, ts);
|
||||
|
||||
// Copy the input stream to the output
|
||||
byte[] ibuffer = new byte[_bufferSize];
|
||||
@@ -791,7 +791,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
writeStream.Flush();
|
||||
}
|
||||
|
||||
zipFile.ZipFileCloseWriteStream(oldZipFile.GetLocalFile(index).CRC);
|
||||
zipFile.ZipFileCloseWriteStream(oldZipFile.GetLocalFile(index).CRC!);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user