mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[TGZTest] Set up archive handling; fix directory inputs
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using SabreTools.Helper;
|
using SabreTools.Helper;
|
||||||
|
using SharpCompress.Common;
|
||||||
|
|
||||||
namespace SabreTools
|
namespace SabreTools
|
||||||
{
|
{
|
||||||
@@ -19,8 +20,6 @@ namespace SabreTools
|
|||||||
private ArchiveScanLevel _zip;
|
private ArchiveScanLevel _zip;
|
||||||
private Logger _logger;
|
private Logger _logger;
|
||||||
|
|
||||||
// We still need access permissions for each of the archive files as well, kind of like DATFromDir
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new TGZTest object
|
/// Create a new TGZTest object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -229,7 +228,7 @@ namespace SabreTools
|
|||||||
{
|
{
|
||||||
foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories))
|
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);
|
_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
|
// Do an external scan of the file, if necessary
|
||||||
|
if (shouldExternalProcess)
|
||||||
|
{
|
||||||
ArchiveTools.WriteTorrentGZ(input, _outdir, _romba, _logger);
|
ArchiveTools.WriteTorrentGZ(input, _outdir, _romba, _logger);
|
||||||
|
}
|
||||||
|
|
||||||
// Process the file as an archive, if necessary
|
// Process the file as an archive, if necessary
|
||||||
|
if (shouldInternalProcess)
|
||||||
|
{
|
||||||
|
// DO THINGS
|
||||||
|
}
|
||||||
|
|
||||||
// Delete the soruce file if we're supposed to
|
// Delete the soruce file if we're supposed to
|
||||||
if (_delete)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,10 @@
|
|||||||
<Prefer32Bit>true</Prefer32Bit>
|
<Prefer32Bit>true</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="SharpCompress, Version=0.12.4.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\SharpCompress.0.12.4\lib\net45\SharpCompress.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
@@ -68,6 +72,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\SabreTools.Helper\SabreTools.Helper.csproj">
|
<ProjectReference Include="..\SabreTools.Helper\SabreTools.Helper.csproj">
|
||||||
|
|||||||
4
TGZTest/packages.config
Normal file
4
TGZTest/packages.config
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="SharpCompress" version="0.12.4" targetFramework="net452" />
|
||||||
|
</packages>
|
||||||
Reference in New Issue
Block a user