diff --git a/TGZTest/TGZTest.cs b/TGZTest/TGZTest.cs index dc614e6f..6cfeda8b 100644 --- a/TGZTest/TGZTest.cs +++ b/TGZTest/TGZTest.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using SabreTools.Helper; +using SharpCompress.Common; namespace SabreTools { @@ -19,8 +20,6 @@ namespace SabreTools private ArchiveScanLevel _zip; private Logger _logger; - // We still need access permissions for each of the archive files as well, kind of like DATFromDir - /// /// Create a new TGZTest object /// @@ -229,7 +228,7 @@ namespace SabreTools { foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories)) { - newinputs.Add(Path.GetFullPath(input)); + newinputs.Add(Path.GetFullPath(file)); } } } @@ -248,10 +247,46 @@ namespace SabreTools { _logger.User("Processing file " + input); + // Get if the file should be scanned internally and externally + bool shouldExternalProcess = true; + bool shouldInternalProcess = true; + + ArchiveType? archiveType = ArchiveTools.GetCurrentArchiveType(input, _logger); + switch (archiveType) + { + case null: + shouldExternalProcess = true; + shouldInternalProcess = false; + break; + case ArchiveType.GZip: + shouldExternalProcess = (_gz != ArchiveScanLevel.Internal); + shouldInternalProcess = (_gz != ArchiveScanLevel.External); + break; + case ArchiveType.Rar: + shouldExternalProcess = (_rar != ArchiveScanLevel.Internal); + shouldInternalProcess = (_rar != ArchiveScanLevel.External); + break; + case ArchiveType.SevenZip: + shouldExternalProcess = (_7z != ArchiveScanLevel.Internal); + shouldInternalProcess = (_7z != ArchiveScanLevel.External); + break; + case ArchiveType.Zip: + shouldExternalProcess = (_zip != ArchiveScanLevel.Internal); + shouldInternalProcess = (_zip != ArchiveScanLevel.External); + break; + } + // Do an external scan of the file, if necessary - ArchiveTools.WriteTorrentGZ(input, _outdir, _romba, _logger); + if (shouldExternalProcess) + { + ArchiveTools.WriteTorrentGZ(input, _outdir, _romba, _logger); + } // Process the file as an archive, if necessary + if (shouldInternalProcess) + { + // DO THINGS + } // Delete the soruce file if we're supposed to if (_delete) @@ -268,6 +303,19 @@ namespace SabreTools } } + // Now one final delete of the temp directory + while (Directory.Exists(_tempdir)) + { + try + { + Directory.Delete(_tempdir, true); + } + catch + { + continue; + } + } + return true; } } diff --git a/TGZTest/TGZTest.csproj b/TGZTest/TGZTest.csproj index 9d0567e9..b7c4f519 100644 --- a/TGZTest/TGZTest.csproj +++ b/TGZTest/TGZTest.csproj @@ -53,6 +53,10 @@ true + + ..\packages\SharpCompress.0.12.4\lib\net45\SharpCompress.dll + True + @@ -68,6 +72,7 @@ + diff --git a/TGZTest/packages.config b/TGZTest/packages.config new file mode 100644 index 00000000..6d513b53 --- /dev/null +++ b/TGZTest/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file