mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[Enums, FileTypes/, Utilities] Use new enum, new class
Add a new "BaseFile" class for potential future use. This should be the "base" for all future files and folders that could exist. This is likely to change over time.
This commit is contained in:
@@ -96,13 +96,21 @@
|
|||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
|
|
||||||
|
// Bare types
|
||||||
|
CHD,
|
||||||
|
Folder,
|
||||||
|
|
||||||
// Archival types
|
// Archival types
|
||||||
SevenZipArchive,
|
SevenZipArchive,
|
||||||
CHD,
|
|
||||||
GZipArchive,
|
GZipArchive,
|
||||||
|
LRZipArchive,
|
||||||
|
LZ4Archive,
|
||||||
RarArchive,
|
RarArchive,
|
||||||
TarArchive,
|
TapeArchive,
|
||||||
|
XZArchive,
|
||||||
ZipArchive,
|
ZipArchive,
|
||||||
|
ZPAQArchive,
|
||||||
|
ZstdArchive,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -9,20 +9,16 @@ using System.IO;
|
|||||||
using MemoryStream = System.IO.MemoryStream;
|
using MemoryStream = System.IO.MemoryStream;
|
||||||
using Stream = System.IO.Stream;
|
using Stream = System.IO.Stream;
|
||||||
#endif
|
#endif
|
||||||
using SharpCompress.Common;
|
|
||||||
|
|
||||||
namespace SabreTools.Library.FileTypes
|
namespace SabreTools.Library.FileTypes
|
||||||
{
|
{
|
||||||
public abstract class BaseArchive
|
public abstract class BaseArchive : BaseFile
|
||||||
{
|
{
|
||||||
#region Protected instance variables
|
#region Protected instance variables
|
||||||
|
|
||||||
// Buffer size used by archives
|
// Buffer size used by archives
|
||||||
protected const int _bufferSize = 4096 * 128;
|
protected const int _bufferSize = 4096 * 128;
|
||||||
|
|
||||||
protected ArchiveType _archiveType;
|
|
||||||
protected string _filename;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Construtors
|
#region Construtors
|
||||||
@@ -39,8 +35,8 @@ namespace SabreTools.Library.FileTypes
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filename">Name of the file to use as an archive</param>
|
/// <param name="filename">Name of the file to use as an archive</param>
|
||||||
public BaseArchive(string filename)
|
public BaseArchive(string filename)
|
||||||
|
: base(filename)
|
||||||
{
|
{
|
||||||
_filename = filename;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
92
SabreTools.Library/FileTypes/BaseFile.cs
Normal file
92
SabreTools.Library/FileTypes/BaseFile.cs
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using SabreTools.Library.Data;
|
||||||
|
|
||||||
|
namespace SabreTools.Library.FileTypes
|
||||||
|
{
|
||||||
|
public abstract class BaseFile
|
||||||
|
{
|
||||||
|
#region Protected instance variables
|
||||||
|
|
||||||
|
protected FileType _fileType;
|
||||||
|
protected string _filename;
|
||||||
|
protected List<BaseFile> _children;
|
||||||
|
|
||||||
|
// External hash values for the file
|
||||||
|
protected long? _size;
|
||||||
|
protected byte[] _crc;
|
||||||
|
protected byte[] _md5;
|
||||||
|
protected byte[] _sha1;
|
||||||
|
protected byte[] _sha256;
|
||||||
|
protected byte[] _sha384;
|
||||||
|
protected byte[] _sha512;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Publicly facing variables
|
||||||
|
|
||||||
|
// TODO: Get all of these values automatically so there is no public "set"
|
||||||
|
public string Filename
|
||||||
|
{
|
||||||
|
get { return _filename; }
|
||||||
|
set { _filename = value; }
|
||||||
|
}
|
||||||
|
public long? Size
|
||||||
|
{
|
||||||
|
get { return _size; }
|
||||||
|
set { _size = value; }
|
||||||
|
}
|
||||||
|
public byte[] CRC
|
||||||
|
{
|
||||||
|
get { return _crc; }
|
||||||
|
set { _crc = value; }
|
||||||
|
}
|
||||||
|
public byte[] MD5
|
||||||
|
{
|
||||||
|
get { return _md5; }
|
||||||
|
set { _md5 = value; }
|
||||||
|
}
|
||||||
|
public byte[] SHA1
|
||||||
|
{
|
||||||
|
get { return _sha1; }
|
||||||
|
set { _sha1 = value; }
|
||||||
|
}
|
||||||
|
public byte[] SHA256
|
||||||
|
{
|
||||||
|
get { return _sha256; }
|
||||||
|
set { _sha256 = value; }
|
||||||
|
}
|
||||||
|
public byte[] SHA384
|
||||||
|
{
|
||||||
|
get { return _sha384; }
|
||||||
|
set { _sha384 = value; }
|
||||||
|
}
|
||||||
|
public byte[] SHA512
|
||||||
|
{
|
||||||
|
get { return _sha512; }
|
||||||
|
set { _sha512 = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Construtors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new Archive with no base file
|
||||||
|
/// </summary>
|
||||||
|
public BaseFile()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new Archive from the given file
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filename">Name of the file to use as an archive</param>
|
||||||
|
public BaseFile(string filename)
|
||||||
|
{
|
||||||
|
_filename = filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -88,7 +88,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
/// 0x68-0x7b - Parent SHA-1
|
/// 0x68-0x7b - Parent SHA-1
|
||||||
/// ----------------------------------------------
|
/// ----------------------------------------------
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public class CHDFile : IDisposable
|
public class CHDFile : BaseFile, IDisposable
|
||||||
{
|
{
|
||||||
#region Private instance variables
|
#region Private instance variables
|
||||||
|
|
||||||
@@ -122,6 +122,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
/// <param name="chdstream">Stream representing the CHD file</param>
|
/// <param name="chdstream">Stream representing the CHD file</param>
|
||||||
public CHDFile(Stream chdstream)
|
public CHDFile(Stream chdstream)
|
||||||
{
|
{
|
||||||
|
_fileType = FileType.CHD;
|
||||||
m_br = new BinaryReader(chdstream);
|
m_br = new BinaryReader(chdstream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using SabreTools.Library.Data;
|
using SabreTools.Library.Data;
|
||||||
|
using SabreTools.Library.DatItems;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This code is based on the header format described at http://www.rarlab.com/technote.htm#srvheaders
|
/// This code is based on the header format described at http://www.rarlab.com/technote.htm#srvheaders
|
||||||
@@ -116,7 +117,7 @@ using SabreTools.Library.Data;
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
namespace SabreTools.Library.FileTypes
|
namespace SabreTools.Library.FileTypes
|
||||||
{
|
{
|
||||||
public class CoreRarArchive
|
public class CoreRarArchive : BaseArchive
|
||||||
{
|
{
|
||||||
// SFX Module Information
|
// SFX Module Information
|
||||||
public byte[] SFX;
|
public byte[] SFX;
|
||||||
@@ -148,6 +149,55 @@ namespace SabreTools.Library.FileTypes
|
|||||||
|
|
||||||
// Entry Information
|
// Entry Information
|
||||||
public List<CoreRarArchiveEntry> Entries = new List<CoreRarArchiveEntry>();
|
public List<CoreRarArchiveEntry> Entries = new List<CoreRarArchiveEntry>();
|
||||||
|
|
||||||
|
#region Unimplemented methods
|
||||||
|
|
||||||
|
public override bool ExtractAll(string outDir)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ExtractEntry(string entryName, string outDir)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override (MemoryStream, string) ExtractEntryStream(string entryName)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override List<Rom> GetArchiveFileInfo(Hash omitFromScan = Hash.DeepHashes, bool date = false)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override List<string> GetEmptyFolders()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool IsTorrent()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool romba = false)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool romba = false)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Write(List<string> inputFiles, string outDir, List<Rom> roms, bool date = false, bool romba = false)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CoreRarArchiveEntry
|
public class CoreRarArchiveEntry
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
public Folder()
|
public Folder()
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
|
_fileType = FileType.Folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -47,6 +48,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
public Folder(string filename)
|
public Folder(string filename)
|
||||||
: base(filename)
|
: base(filename)
|
||||||
{
|
{
|
||||||
|
_fileType = FileType.Folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ using SeekOrigin = System.IO.SeekOrigin;
|
|||||||
using Stream = System.IO.Stream;
|
using Stream = System.IO.Stream;
|
||||||
#endif
|
#endif
|
||||||
using Ionic.Zlib;
|
using Ionic.Zlib;
|
||||||
using SharpCompress.Common;
|
|
||||||
|
|
||||||
namespace SabreTools.Library.FileTypes
|
namespace SabreTools.Library.FileTypes
|
||||||
{
|
{
|
||||||
@@ -38,6 +37,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
public GZipArchive()
|
public GZipArchive()
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
|
_fileType = FileType.GZipArchive;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -48,7 +48,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
public GZipArchive(string filename)
|
public GZipArchive(string filename)
|
||||||
: base(filename)
|
: base(filename)
|
||||||
{
|
{
|
||||||
_archiveType = ArchiveType.GZip;
|
_fileType = FileType.GZipArchive;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
public LRZipArchive()
|
public LRZipArchive()
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
|
_fileType = FileType.LRZipArchive;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -36,7 +37,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
public LRZipArchive(string filename)
|
public LRZipArchive(string filename)
|
||||||
: base(filename)
|
: base(filename)
|
||||||
{
|
{
|
||||||
//_archiveType = ArchiveType.LRZip;
|
_fileType = FileType.LRZipArchive;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
public LZ4Archive()
|
public LZ4Archive()
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
|
_fileType = FileType.LZ4Archive;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -36,7 +37,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
public LZ4Archive(string filename)
|
public LZ4Archive(string filename)
|
||||||
: base(filename)
|
: base(filename)
|
||||||
{
|
{
|
||||||
//_archiveType = ArchiveType.LRZip;
|
_fileType = FileType.LZ4Archive;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ using Stream = System.IO.Stream;
|
|||||||
#endif
|
#endif
|
||||||
using SharpCompress.Archives;
|
using SharpCompress.Archives;
|
||||||
using SharpCompress.Archives.Rar;
|
using SharpCompress.Archives.Rar;
|
||||||
using SharpCompress.Common;
|
|
||||||
using SharpCompress.Readers;
|
using SharpCompress.Readers;
|
||||||
|
|
||||||
namespace SabreTools.Library.FileTypes
|
namespace SabreTools.Library.FileTypes
|
||||||
@@ -38,6 +37,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
public RarArchive()
|
public RarArchive()
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
|
_fileType = FileType.RarArchive;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -48,7 +48,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
public RarArchive(string filename)
|
public RarArchive(string filename)
|
||||||
: base(filename)
|
: base(filename)
|
||||||
{
|
{
|
||||||
_archiveType = ArchiveType.Rar;
|
_fileType = FileType.RarArchive;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -252,13 +252,13 @@ namespace SabreTools.Library.FileTypes
|
|||||||
// Check for the signature first (Skipping the SFX Module)
|
// Check for the signature first (Skipping the SFX Module)
|
||||||
byte[] signature = br.ReadBytes(8);
|
byte[] signature = br.ReadBytes(8);
|
||||||
int startpos = 0;
|
int startpos = 0;
|
||||||
while (startpos < Constants.MibiByte && BitConverter.ToString(signature, 0, 7) != Constants.RarSignature && BitConverter.ToString(signature) != Constants.RarFiveSig)
|
while (startpos < Constants.MibiByte && !signature.StartsWith(Constants.RarSignature, exact: true) && !signature.StartsWith(Constants.RarFiveSignature, exact: true))
|
||||||
{
|
{
|
||||||
startpos++;
|
startpos++;
|
||||||
br.BaseStream.Position = startpos;
|
br.BaseStream.Position = startpos;
|
||||||
signature = br.ReadBytes(8);
|
signature = br.ReadBytes(8);
|
||||||
}
|
}
|
||||||
if (BitConverter.ToString(signature, 0, 7) != Constants.RarSignature && BitConverter.ToString(signature) != Constants.RarFiveSig)
|
if (!signature.StartsWith(Constants.RarSignature, exact: true) && !signature.StartsWith(Constants.RarFiveSignature, exact: true))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ using ROMVault2.SupportedFiles.Zip;
|
|||||||
using SevenZip; // TODO: Remove this when 7zip write is implemented in SharpCompress
|
using SevenZip; // TODO: Remove this when 7zip write is implemented in SharpCompress
|
||||||
using SharpCompress.Archives;
|
using SharpCompress.Archives;
|
||||||
using SharpCompress.Archives.SevenZip;
|
using SharpCompress.Archives.SevenZip;
|
||||||
using SharpCompress.Common;
|
|
||||||
using SharpCompress.Readers;
|
using SharpCompress.Readers;
|
||||||
|
|
||||||
namespace SabreTools.Library.FileTypes
|
namespace SabreTools.Library.FileTypes
|
||||||
@@ -41,6 +40,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
public SevenZipArchive()
|
public SevenZipArchive()
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
|
_fileType = FileType.SevenZipArchive;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -51,7 +51,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
public SevenZipArchive(string filename)
|
public SevenZipArchive(string filename)
|
||||||
: base(filename)
|
: base(filename)
|
||||||
{
|
{
|
||||||
_archiveType = ArchiveType.SevenZip;
|
_fileType = FileType.SevenZipArchive;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
public TapeArchive()
|
public TapeArchive()
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
|
_fileType = FileType.TapeArchive;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -50,7 +51,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
public TapeArchive(string filename)
|
public TapeArchive(string filename)
|
||||||
: base(filename)
|
: base(filename)
|
||||||
{
|
{
|
||||||
_archiveType = ArchiveType.Tar;
|
_fileType = FileType.TapeArchive;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
public TorrentZipArchive()
|
public TorrentZipArchive()
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
|
_fileType = FileType.ZipArchive;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -46,7 +47,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
public TorrentZipArchive(string filename)
|
public TorrentZipArchive(string filename)
|
||||||
: base(filename)
|
: base(filename)
|
||||||
{
|
{
|
||||||
_archiveType = ArchiveType.Zip;
|
_fileType = FileType.ZipArchive;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
public XZArchive()
|
public XZArchive()
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
|
_fileType = FileType.XZArchive;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -50,7 +51,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
public XZArchive(string filename)
|
public XZArchive(string filename)
|
||||||
: base(filename)
|
: base(filename)
|
||||||
{
|
{
|
||||||
//_archiveType = ArchiveType.XZip;
|
_fileType = FileType.XZArchive;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
public ZPAQArchive()
|
public ZPAQArchive()
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
|
_fileType = FileType.ZPAQArchive;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -36,7 +37,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
public ZPAQArchive(string filename)
|
public ZPAQArchive(string filename)
|
||||||
: base(filename)
|
: base(filename)
|
||||||
{
|
{
|
||||||
//_archiveType = ArchiveType.LRZip;
|
_fileType = FileType.ZPAQArchive;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
public ZstdArchive()
|
public ZstdArchive()
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
|
_fileType = FileType.ZstdArchive;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -36,7 +37,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
public ZstdArchive(string filename)
|
public ZstdArchive(string filename)
|
||||||
: base(filename)
|
: base(filename)
|
||||||
{
|
{
|
||||||
//_archiveType = ArchiveType.LRZip;
|
_fileType = FileType.ZstdArchive;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -133,6 +133,7 @@
|
|||||||
<Compile Include="DatFiles\SoftwareList.cs" />
|
<Compile Include="DatFiles\SoftwareList.cs" />
|
||||||
<Compile Include="DatItems\Blank.cs" />
|
<Compile Include="DatItems\Blank.cs" />
|
||||||
<Compile Include="FileTypes\CHDFile.cs" />
|
<Compile Include="FileTypes\CHDFile.cs" />
|
||||||
|
<Compile Include="FileTypes\BaseFile.cs" />
|
||||||
<Compile Include="FileTypes\CoreRarArchive.cs" />
|
<Compile Include="FileTypes\CoreRarArchive.cs" />
|
||||||
<Compile Include="External\NaturalSort\NaturalComparer.cs" />
|
<Compile Include="External\NaturalSort\NaturalComparer.cs" />
|
||||||
<Compile Include="External\NaturalSort\NaturalReversedComparer.cs" />
|
<Compile Include="External\NaturalSort\NaturalReversedComparer.cs" />
|
||||||
|
|||||||
@@ -466,13 +466,12 @@ namespace SabreTools.Library.Tools
|
|||||||
case FileType.SevenZipArchive:
|
case FileType.SevenZipArchive:
|
||||||
archive = new SevenZipArchive(input);
|
archive = new SevenZipArchive(input);
|
||||||
break;
|
break;
|
||||||
case FileType.TarArchive:
|
case FileType.TapeArchive:
|
||||||
archive = new TapeArchive(input);
|
archive = new TapeArchive(input);
|
||||||
break;
|
break;
|
||||||
case FileType.ZipArchive:
|
case FileType.ZipArchive:
|
||||||
archive = new TorrentZipArchive(input);
|
archive = new TorrentZipArchive(input);
|
||||||
break;
|
break;
|
||||||
case FileType.CHD:
|
|
||||||
default:
|
default:
|
||||||
// We ignore these types for now
|
// We ignore these types for now
|
||||||
break;
|
break;
|
||||||
@@ -496,7 +495,7 @@ namespace SabreTools.Library.Tools
|
|||||||
return new RarArchive();
|
return new RarArchive();
|
||||||
case FileType.SevenZipArchive:
|
case FileType.SevenZipArchive:
|
||||||
return new SevenZipArchive();
|
return new SevenZipArchive();
|
||||||
case FileType.TarArchive:
|
case FileType.TapeArchive:
|
||||||
return new TapeArchive();
|
return new TapeArchive();
|
||||||
case FileType.ZipArchive:
|
case FileType.ZipArchive:
|
||||||
return new TorrentZipArchive();
|
return new TorrentZipArchive();
|
||||||
@@ -1320,7 +1319,7 @@ namespace SabreTools.Library.Tools
|
|||||||
}
|
}
|
||||||
else if (magic.StartsWith(Constants.TarSignature) || magic.StartsWith(Constants.TarZeroSignature))
|
else if (magic.StartsWith(Constants.TarSignature) || magic.StartsWith(Constants.TarZeroSignature))
|
||||||
{
|
{
|
||||||
outFileType = FileType.TarArchive;
|
outFileType = FileType.TapeArchive;
|
||||||
}
|
}
|
||||||
else if (magic.StartsWith(Constants.ZipSignature) || magic.StartsWith(Constants.ZipSignatureEmpty) || magic.StartsWith(Constants.ZipSignatureSpanned))
|
else if (magic.StartsWith(Constants.ZipSignature) || magic.StartsWith(Constants.ZipSignatureEmpty) || magic.StartsWith(Constants.ZipSignatureSpanned))
|
||||||
{
|
{
|
||||||
@@ -1351,11 +1350,6 @@ namespace SabreTools.Library.Tools
|
|||||||
FileType? fileType = GetFileType(input);
|
FileType? fileType = GetFileType(input);
|
||||||
switch (fileType)
|
switch (fileType)
|
||||||
{
|
{
|
||||||
case FileType.CHD:
|
|
||||||
case null:
|
|
||||||
shouldExternalProcess = true;
|
|
||||||
shouldInternalProcess = false;
|
|
||||||
break;
|
|
||||||
case FileType.GZipArchive:
|
case FileType.GZipArchive:
|
||||||
shouldExternalProcess = ((archiveScanLevel & ArchiveScanLevel.GZipExternal) != 0);
|
shouldExternalProcess = ((archiveScanLevel & ArchiveScanLevel.GZipExternal) != 0);
|
||||||
shouldInternalProcess = ((archiveScanLevel & ArchiveScanLevel.GZipInternal) != 0);
|
shouldInternalProcess = ((archiveScanLevel & ArchiveScanLevel.GZipInternal) != 0);
|
||||||
@@ -1372,6 +1366,11 @@ namespace SabreTools.Library.Tools
|
|||||||
shouldExternalProcess = ((archiveScanLevel & ArchiveScanLevel.ZipExternal) != 0);
|
shouldExternalProcess = ((archiveScanLevel & ArchiveScanLevel.ZipExternal) != 0);
|
||||||
shouldInternalProcess = ((archiveScanLevel & ArchiveScanLevel.ZipInternal) != 0);
|
shouldInternalProcess = ((archiveScanLevel & ArchiveScanLevel.ZipInternal) != 0);
|
||||||
break;
|
break;
|
||||||
|
case null:
|
||||||
|
default:
|
||||||
|
shouldExternalProcess = true;
|
||||||
|
shouldInternalProcess = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user