mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Update packages, fix build
This commit is contained in:
@@ -6,10 +6,9 @@ using System.Text.RegularExpressions;
|
||||
using Compress;
|
||||
using Compress.gZip;
|
||||
using Compress.Support.Compression.Deflate;
|
||||
using SabreTools.Core;
|
||||
using SabreTools.Core.Tools;
|
||||
using SabreTools.Hashing;
|
||||
using SabreTools.IO;
|
||||
using SabreTools.IO.Extensions;
|
||||
|
||||
namespace SabreTools.FileTypes.Archives
|
||||
{
|
||||
@@ -295,7 +294,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();
|
||||
@@ -356,7 +355,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
public BaseFile? GetTorrentGZFileInfo()
|
||||
{
|
||||
// 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();
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
SharpCompress.Archives.Rar.RarArchive ra = SharpCompress.Archives.Rar.RarArchive.Open(this.Filename, new ReaderOptions { LeaveStreamOpen = false, });
|
||||
foreach (RarArchiveEntry entry in ra.Entries)
|
||||
{
|
||||
if (entry != null && !entry.IsDirectory && entry.Key.Contains(entryName))
|
||||
if (entry?.Key != null && !entry.IsDirectory && entry.Key.Contains(entryName))
|
||||
{
|
||||
// Write the file out
|
||||
realEntry = entry.Key;
|
||||
@@ -248,19 +248,19 @@ namespace SabreTools.FileTypes.Archives
|
||||
string? lastRarEntry = null;
|
||||
foreach (RarArchiveEntry entry in rarEntries)
|
||||
{
|
||||
if (entry != null)
|
||||
if (entry?.Key == null)
|
||||
continue;
|
||||
|
||||
// If the current is a superset of last, we skip it
|
||||
if (lastRarEntry != null && lastRarEntry.StartsWith(entry.Key))
|
||||
{
|
||||
// If the current is a superset of last, we skip it
|
||||
if (lastRarEntry != null && lastRarEntry.StartsWith(entry.Key))
|
||||
{
|
||||
// No-op
|
||||
}
|
||||
// If the entry is a directory, we add it
|
||||
else if (entry.IsDirectory)
|
||||
{
|
||||
empties.Add(entry.Key);
|
||||
lastRarEntry = entry.Key;
|
||||
}
|
||||
// No-op
|
||||
}
|
||||
// If the entry is a directory, we add it
|
||||
else if (entry.IsDirectory)
|
||||
{
|
||||
empties.Add(entry.Key);
|
||||
lastRarEntry = entry.Key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace SabreTools.FileTypes.Archives
|
||||
TarArchive ta = TarArchive.Open(this.Filename!, new ReaderOptions { LeaveStreamOpen = false, });
|
||||
foreach (TarArchiveEntry entry in ta.Entries)
|
||||
{
|
||||
if (entry != null && !entry.IsDirectory && entry.Key.Contains(entryName))
|
||||
if (entry?.Key != null && !entry.IsDirectory && entry.Key.Contains(entryName))
|
||||
{
|
||||
// Write the file out
|
||||
realEntry = entry.Key;
|
||||
@@ -237,19 +237,19 @@ namespace SabreTools.FileTypes.Archives
|
||||
string? lastTarEntry = null;
|
||||
foreach (TarArchiveEntry entry in tarEntries)
|
||||
{
|
||||
if (entry != null)
|
||||
if (entry?.Key == null)
|
||||
continue;
|
||||
|
||||
// If the current is a superset of last, we skip it
|
||||
if (lastTarEntry != null && lastTarEntry.StartsWith(entry.Key))
|
||||
{
|
||||
// If the current is a superset of last, we skip it
|
||||
if (lastTarEntry != null && lastTarEntry.StartsWith(entry.Key))
|
||||
{
|
||||
// No-op
|
||||
}
|
||||
// If the entry is a directory, we add it
|
||||
else if (entry.IsDirectory)
|
||||
{
|
||||
empties.Add(entry.Key);
|
||||
lastTarEntry = entry.Key;
|
||||
}
|
||||
// No-op
|
||||
}
|
||||
// If the entry is a directory, we add it
|
||||
else if (entry.IsDirectory)
|
||||
{
|
||||
empties.Add(entry.Key);
|
||||
lastTarEntry = entry.Key;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -315,7 +315,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;
|
||||
|
||||
// Copy the input stream to the output
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using SabreTools.Core;
|
||||
using SabreTools.Core.Tools;
|
||||
using SabreTools.Hashing;
|
||||
using SabreTools.IO;
|
||||
using SabreTools.IO.Extensions;
|
||||
#if NET462_OR_GREATER || NETCOREAPP
|
||||
using SharpCompress.Compressors.Xz;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user