mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[FileTypes/] Add remaining unimplemented types
This commit is contained in:
@@ -3942,7 +3942,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case OutputFormat.TorrentGzip:
|
case OutputFormat.TorrentGzip:
|
||||||
format = "TorrentGZ";
|
format = "TorrentGZ";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.TorrentLrzip:
|
case OutputFormat.TorrentLRZip:
|
||||||
format = "TorrentLRZ";
|
format = "TorrentLRZ";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.TorrentRar:
|
case OutputFormat.TorrentRar:
|
||||||
@@ -4120,7 +4120,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case OutputFormat.TorrentGzip:
|
case OutputFormat.TorrentGzip:
|
||||||
format = "TorrentGZ";
|
format = "TorrentGZ";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.TorrentLrzip:
|
case OutputFormat.TorrentLRZip:
|
||||||
format = "TorrentLRZ";
|
format = "TorrentLRZ";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.TorrentRar:
|
case OutputFormat.TorrentRar:
|
||||||
|
|||||||
@@ -100,11 +100,14 @@
|
|||||||
TorrentGzip = 2,
|
TorrentGzip = 2,
|
||||||
TapeArchive = 5,
|
TapeArchive = 5,
|
||||||
|
|
||||||
// Currently unimplemented
|
// Currently unimplemented fully
|
||||||
Torrent7Zip = 3,
|
Torrent7Zip = 3,
|
||||||
TorrentRar = 4,
|
TorrentRar = 4,
|
||||||
TorrentXZ = 6,
|
TorrentXZ = 6,
|
||||||
TorrentLrzip = 7,
|
TorrentLRZip = 7,
|
||||||
|
TorrentLZ4 = 8,
|
||||||
|
TorrentZstd = 9,
|
||||||
|
TorrentZPAQ = 10,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -16,25 +16,24 @@ namespace SabreTools.Library.FileTypes
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a TorrentLRZip archive for reading and writing
|
/// Represents a TorrentLRZip archive for reading and writing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// TODO: LRZIP: https://github.com/ckolivas/lrzip
|
/// TODO: Implement from source at https://github.com/ckolivas/lrzip
|
||||||
public class LRZArchive : BaseArchive
|
public class LRZipArchive : BaseArchive
|
||||||
{
|
{
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new TorrentGZipArchive with no base file
|
/// Create a new LRZipArchive with no base file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public LRZArchive()
|
public LRZipArchive()
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new TorrentGZipArchive from the given file
|
/// Create a new LRZipArchive from the given file
|
||||||
/// </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>
|
||||||
/// <param name="read">True for opening file as read, false for opening file as write</param>
|
public LRZipArchive(string filename)
|
||||||
public LRZArchive(string filename)
|
|
||||||
: base(filename)
|
: base(filename)
|
||||||
{
|
{
|
||||||
//_archiveType = ArchiveType.LRZip;
|
//_archiveType = ArchiveType.LRZip;
|
||||||
162
SabreTools.Library/FileTypes/LZ4Archive.cs
Normal file
162
SabreTools.Library/FileTypes/LZ4Archive.cs
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using SabreTools.Library.Data;
|
||||||
|
using SabreTools.Library.Items;
|
||||||
|
|
||||||
|
#if MONO
|
||||||
|
using System.IO;
|
||||||
|
#else
|
||||||
|
using MemoryStream = System.IO.MemoryStream;
|
||||||
|
using Stream = System.IO.Stream;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace SabreTools.Library.FileTypes
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a TorrentLRZip archive for reading and writing
|
||||||
|
/// </summary>
|
||||||
|
/// TODO: Implement from source at https://github.com/lz4/lz4
|
||||||
|
public class LZ4Archive : BaseArchive
|
||||||
|
{
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new LZ4Archive with no base file
|
||||||
|
/// </summary>
|
||||||
|
public LZ4Archive()
|
||||||
|
: base()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new LZ4Archive from the given file
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filename">Name of the file to use as an archive</param>
|
||||||
|
public LZ4Archive(string filename)
|
||||||
|
: base(filename)
|
||||||
|
{
|
||||||
|
//_archiveType = ArchiveType.LRZip;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Extraction
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempt to extract a file as an archive
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="outDir">Output directory for archive extraction</param>
|
||||||
|
/// <returns>True if the extraction was a success, false otherwise</returns>
|
||||||
|
public override bool ExtractAll(string outDir)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempt to extract a file from an archive
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entryName">Name of the entry to be extracted</param>
|
||||||
|
/// <param name="outDir">Output directory for archive extraction</param>
|
||||||
|
/// <returns>Name of the extracted file, null on error</returns>
|
||||||
|
public override string ExtractEntry(string entryName, string outDir)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempt to extract a stream from an archive
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entryName">Name of the entry to be extracted</param>
|
||||||
|
/// <param name="realEntry">Output representing the entry name that was found</param>
|
||||||
|
/// <returns>MemoryStream representing the entry, null on error</returns>
|
||||||
|
public override (MemoryStream, string) ExtractEntryStream(string entryName)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Information
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generate a list of DatItem objects from the header values in an archive
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="omitFromScan">Hash representing the hashes that should be skipped</param>
|
||||||
|
/// <param name="date">True if entry dates should be included, false otherwise (default)</param>
|
||||||
|
/// <returns>List of DatItem objects representing the found data</returns>
|
||||||
|
/// <remarks>TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually</remarks>
|
||||||
|
public override List<Rom> GetArchiveFileInfo(Hash omitFromScan = Hash.DeepHashes, bool date = false)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generate a list of empty folders in an archive
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input">Input file to get data from</param>
|
||||||
|
/// <returns>List of empty folders in the archive</returns>
|
||||||
|
public override List<string> GetEmptyFolders()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check whether the input file is a standardized format
|
||||||
|
/// </summary>
|
||||||
|
public override bool IsTorrent()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Writing
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write an input file to a torrent LZ4 file
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inputFile">Input filename to be moved</param>
|
||||||
|
/// <param name="outDir">Output directory to build to</param>
|
||||||
|
/// <param name="rom">DatItem representing the new information</param>
|
||||||
|
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
|
||||||
|
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
|
||||||
|
/// <returns>True if the write was a success, false otherwise</returns>
|
||||||
|
/// <remarks>This works for now, but it can be sped up by using Ionic.Zip or another zlib wrapper that allows for header values built-in. See edc's code.</remarks>
|
||||||
|
public override bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool romba = false)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write an input stream to a torrent LZ4 file
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inputStream">Input stream to be moved</param>
|
||||||
|
/// <param name="outDir">Output directory to build to</param>
|
||||||
|
/// <param name="rom">DatItem representing the new information</param>
|
||||||
|
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
|
||||||
|
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
|
||||||
|
/// <returns>True if the write was a success, false otherwise</returns>
|
||||||
|
/// <remarks>This works for now, but it can be sped up by using Ionic.Zip or another zlib wrapper that allows for header values built-in. See edc's code.</remarks>
|
||||||
|
public override bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool romba = false)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write a set of input files to a torrent LZ4 archive (assuming the same output archive name)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inputFiles">Input files to be moved</param>
|
||||||
|
/// <param name="outDir">Output directory to build to</param>
|
||||||
|
/// <param name="rom">DatItem representing the new information</param>
|
||||||
|
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
|
||||||
|
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
|
||||||
|
/// <returns>True if the archive was written properly, false otherwise</returns>
|
||||||
|
public override bool Write(List<string> inputFiles, string outDir, List<Rom> roms, bool date = false, bool romba = false)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
162
SabreTools.Library/FileTypes/ZPAQArchive.cs
Normal file
162
SabreTools.Library/FileTypes/ZPAQArchive.cs
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using SabreTools.Library.Data;
|
||||||
|
using SabreTools.Library.Items;
|
||||||
|
|
||||||
|
#if MONO
|
||||||
|
using System.IO;
|
||||||
|
#else
|
||||||
|
using MemoryStream = System.IO.MemoryStream;
|
||||||
|
using Stream = System.IO.Stream;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace SabreTools.Library.FileTypes
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a ZPAQArchive archive for reading and writing
|
||||||
|
/// </summary>
|
||||||
|
/// TODO: Implement from source at https://github.com/zpaq/zpaq - In progress as external DLL
|
||||||
|
public class ZPAQArchive : BaseArchive
|
||||||
|
{
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new ZPAQArchive with no base file
|
||||||
|
/// </summary>
|
||||||
|
public ZPAQArchive()
|
||||||
|
: base()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new ZPAQArchive from the given file
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filename">Name of the file to use as an archive</param>
|
||||||
|
public ZPAQArchive(string filename)
|
||||||
|
: base(filename)
|
||||||
|
{
|
||||||
|
//_archiveType = ArchiveType.LRZip;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Extraction
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempt to extract a file as an archive
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="outDir">Output directory for archive extraction</param>
|
||||||
|
/// <returns>True if the extraction was a success, false otherwise</returns>
|
||||||
|
public override bool ExtractAll(string outDir)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempt to extract a file from an archive
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entryName">Name of the entry to be extracted</param>
|
||||||
|
/// <param name="outDir">Output directory for archive extraction</param>
|
||||||
|
/// <returns>Name of the extracted file, null on error</returns>
|
||||||
|
public override string ExtractEntry(string entryName, string outDir)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempt to extract a stream from an archive
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entryName">Name of the entry to be extracted</param>
|
||||||
|
/// <param name="realEntry">Output representing the entry name that was found</param>
|
||||||
|
/// <returns>MemoryStream representing the entry, null on error</returns>
|
||||||
|
public override (MemoryStream, string) ExtractEntryStream(string entryName)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Information
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generate a list of DatItem objects from the header values in an archive
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="omitFromScan">Hash representing the hashes that should be skipped</param>
|
||||||
|
/// <param name="date">True if entry dates should be included, false otherwise (default)</param>
|
||||||
|
/// <returns>List of DatItem objects representing the found data</returns>
|
||||||
|
/// <remarks>TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually</remarks>
|
||||||
|
public override List<Rom> GetArchiveFileInfo(Hash omitFromScan = Hash.DeepHashes, bool date = false)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generate a list of empty folders in an archive
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input">Input file to get data from</param>
|
||||||
|
/// <returns>List of empty folders in the archive</returns>
|
||||||
|
public override List<string> GetEmptyFolders()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check whether the input file is a standardized format
|
||||||
|
/// </summary>
|
||||||
|
public override bool IsTorrent()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Writing
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write an input file to a torrent ZPAQ file
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inputFile">Input filename to be moved</param>
|
||||||
|
/// <param name="outDir">Output directory to build to</param>
|
||||||
|
/// <param name="rom">DatItem representing the new information</param>
|
||||||
|
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
|
||||||
|
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
|
||||||
|
/// <returns>True if the write was a success, false otherwise</returns>
|
||||||
|
/// <remarks>This works for now, but it can be sped up by using Ionic.Zip or another zlib wrapper that allows for header values built-in. See edc's code.</remarks>
|
||||||
|
public override bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool romba = false)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write an input stream to a torrent ZPAQ file
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inputStream">Input stream to be moved</param>
|
||||||
|
/// <param name="outDir">Output directory to build to</param>
|
||||||
|
/// <param name="rom">DatItem representing the new information</param>
|
||||||
|
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
|
||||||
|
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
|
||||||
|
/// <returns>True if the write was a success, false otherwise</returns>
|
||||||
|
/// <remarks>This works for now, but it can be sped up by using Ionic.Zip or another zlib wrapper that allows for header values built-in. See edc's code.</remarks>
|
||||||
|
public override bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool romba = false)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write a set of input files to a torrent ZPAQ archive (assuming the same output archive name)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inputFiles">Input files to be moved</param>
|
||||||
|
/// <param name="outDir">Output directory to build to</param>
|
||||||
|
/// <param name="rom">DatItem representing the new information</param>
|
||||||
|
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
|
||||||
|
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
|
||||||
|
/// <returns>True if the archive was written properly, false otherwise</returns>
|
||||||
|
public override bool Write(List<string> inputFiles, string outDir, List<Rom> roms, bool date = false, bool romba = false)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
162
SabreTools.Library/FileTypes/ZstdArchive.cs
Normal file
162
SabreTools.Library/FileTypes/ZstdArchive.cs
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using SabreTools.Library.Data;
|
||||||
|
using SabreTools.Library.Items;
|
||||||
|
|
||||||
|
#if MONO
|
||||||
|
using System.IO;
|
||||||
|
#else
|
||||||
|
using MemoryStream = System.IO.MemoryStream;
|
||||||
|
using Stream = System.IO.Stream;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace SabreTools.Library.FileTypes
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a ZstdArchive archive for reading and writing
|
||||||
|
/// </summary>
|
||||||
|
/// TODO: Implement from source at https://github.com/skbkontur/ZstdNet
|
||||||
|
public class ZstdArchive : BaseArchive
|
||||||
|
{
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new ZstdArchive with no base file
|
||||||
|
/// </summary>
|
||||||
|
public ZstdArchive()
|
||||||
|
: base()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new ZstdArchive from the given file
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filename">Name of the file to use as an archive</param>
|
||||||
|
public ZstdArchive(string filename)
|
||||||
|
: base(filename)
|
||||||
|
{
|
||||||
|
//_archiveType = ArchiveType.LRZip;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Extraction
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempt to extract a file as an archive
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="outDir">Output directory for archive extraction</param>
|
||||||
|
/// <returns>True if the extraction was a success, false otherwise</returns>
|
||||||
|
public override bool ExtractAll(string outDir)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempt to extract a file from an archive
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entryName">Name of the entry to be extracted</param>
|
||||||
|
/// <param name="outDir">Output directory for archive extraction</param>
|
||||||
|
/// <returns>Name of the extracted file, null on error</returns>
|
||||||
|
public override string ExtractEntry(string entryName, string outDir)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempt to extract a stream from an archive
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entryName">Name of the entry to be extracted</param>
|
||||||
|
/// <param name="realEntry">Output representing the entry name that was found</param>
|
||||||
|
/// <returns>MemoryStream representing the entry, null on error</returns>
|
||||||
|
public override (MemoryStream, string) ExtractEntryStream(string entryName)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Information
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generate a list of DatItem objects from the header values in an archive
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="omitFromScan">Hash representing the hashes that should be skipped</param>
|
||||||
|
/// <param name="date">True if entry dates should be included, false otherwise (default)</param>
|
||||||
|
/// <returns>List of DatItem objects representing the found data</returns>
|
||||||
|
/// <remarks>TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually</remarks>
|
||||||
|
public override List<Rom> GetArchiveFileInfo(Hash omitFromScan = Hash.DeepHashes, bool date = false)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generate a list of empty folders in an archive
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input">Input file to get data from</param>
|
||||||
|
/// <returns>List of empty folders in the archive</returns>
|
||||||
|
public override List<string> GetEmptyFolders()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check whether the input file is a standardized format
|
||||||
|
/// </summary>
|
||||||
|
public override bool IsTorrent()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Writing
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write an input file to a torrent Zstd file
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inputFile">Input filename to be moved</param>
|
||||||
|
/// <param name="outDir">Output directory to build to</param>
|
||||||
|
/// <param name="rom">DatItem representing the new information</param>
|
||||||
|
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
|
||||||
|
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
|
||||||
|
/// <returns>True if the write was a success, false otherwise</returns>
|
||||||
|
/// <remarks>This works for now, but it can be sped up by using Ionic.Zip or another zlib wrapper that allows for header values built-in. See edc's code.</remarks>
|
||||||
|
public override bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool romba = false)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write an input stream to a torrent Zstd file
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inputStream">Input stream to be moved</param>
|
||||||
|
/// <param name="outDir">Output directory to build to</param>
|
||||||
|
/// <param name="rom">DatItem representing the new information</param>
|
||||||
|
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
|
||||||
|
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
|
||||||
|
/// <returns>True if the write was a success, false otherwise</returns>
|
||||||
|
/// <remarks>This works for now, but it can be sped up by using Ionic.Zip or another zlib wrapper that allows for header values built-in. See edc's code.</remarks>
|
||||||
|
public override bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool romba = false)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write a set of input files to a torrent Zstd archive (assuming the same output archive name)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inputFiles">Input files to be moved</param>
|
||||||
|
/// <param name="outDir">Output directory to build to</param>
|
||||||
|
/// <param name="rom">DatItem representing the new information</param>
|
||||||
|
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
|
||||||
|
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
|
||||||
|
/// <returns>True if the archive was written properly, false otherwise</returns>
|
||||||
|
public override bool Write(List<string> inputFiles, string outDir, List<Rom> roms, bool date = false, bool romba = false)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -549,6 +549,13 @@ Options:
|
|||||||
but with custom header information. This is currently unused by any
|
but with custom header information. This is currently unused by any
|
||||||
major application.
|
major application.
|
||||||
|
|
||||||
|
-tlz4 Enable Torrent LZ4 output [UNIMPLEMENTED]
|
||||||
|
Instead of ouputting the files to folder, files will be rebuilt to
|
||||||
|
Torrent LZ4 (TLZ4) files. This format is based on the LZ4 file
|
||||||
|
format as defined at https://github.com/lz4/lz4 but with custom
|
||||||
|
header information. This is currently unused by any major
|
||||||
|
application.
|
||||||
|
|
||||||
-trar Enable Torrent RAR output [UNIMPLEMENTED]
|
-trar Enable Torrent RAR output [UNIMPLEMENTED]
|
||||||
Instead of outputting files to folder, files will be rebuilt to
|
Instead of outputting files to folder, files will be rebuilt to
|
||||||
Torrent RAR (TRAR) files. This format is based on the RAR propietary
|
Torrent RAR (TRAR) files. This format is based on the RAR propietary
|
||||||
@@ -569,6 +576,20 @@ Options:
|
|||||||
by external tool RomVault (http://www.romvault.com/) and is already
|
by external tool RomVault (http://www.romvault.com/) and is already
|
||||||
widely used.
|
widely used.
|
||||||
|
|
||||||
|
-tzpaq Enable Torrent ZPAQ output [UNIMPLEMENTED]
|
||||||
|
Instead of ouputting the files to folder, files will be rebuilt to
|
||||||
|
Torrent ZPAQ (TZPAQ) files. This format is based on the ZPAQ file
|
||||||
|
format as defined at https://github.com/zpaq/zpaq but with custom
|
||||||
|
header information. This is currently unused by any major
|
||||||
|
application.
|
||||||
|
|
||||||
|
-tzstd Enable Torrent Zstd output [UNIMPLEMENTED]
|
||||||
|
Instead of ouputting the files to folder, files will be rebuilt to
|
||||||
|
Torrent Zstd (TZstd) files. This format is based on the Zstd file
|
||||||
|
format as defined at https://github.com/skbkontur/ZstdNet but with
|
||||||
|
custom header information. This is currently unused by any major
|
||||||
|
application.
|
||||||
|
|
||||||
-h=, --header= Remove headers from hash calculations
|
-h=, --header= Remove headers from hash calculations
|
||||||
If this is set, then all files that have copier headers that are
|
If this is set, then all files that have copier headers that are
|
||||||
detected will have them removed from the hash calculation. This will
|
detected will have them removed from the hash calculation. This will
|
||||||
@@ -697,6 +718,13 @@ Options:
|
|||||||
but with custom header information. This is currently unused by any
|
but with custom header information. This is currently unused by any
|
||||||
major application.
|
major application.
|
||||||
|
|
||||||
|
-tlz4 Enable Torrent LZ4 output [UNIMPLEMENTED]
|
||||||
|
Instead of ouputting the files to folder, files will be rebuilt to
|
||||||
|
Torrent LZ4 (TLZ4) files. This format is based on the LZ4 file
|
||||||
|
format as defined at https://github.com/lz4/lz4 but with custom
|
||||||
|
header information. This is currently unused by any major
|
||||||
|
application.
|
||||||
|
|
||||||
-trar Enable Torrent RAR output [UNIMPLEMENTED]
|
-trar Enable Torrent RAR output [UNIMPLEMENTED]
|
||||||
Instead of outputting files to folder, files will be rebuilt to
|
Instead of outputting files to folder, files will be rebuilt to
|
||||||
Torrent RAR (TRAR) files. This format is based on the RAR propietary
|
Torrent RAR (TRAR) files. This format is based on the RAR propietary
|
||||||
@@ -717,6 +745,20 @@ Options:
|
|||||||
by external tool RomVault (http://www.romvault.com/) and is already
|
by external tool RomVault (http://www.romvault.com/) and is already
|
||||||
widely used.
|
widely used.
|
||||||
|
|
||||||
|
-tzpaq Enable Torrent ZPAQ output [UNIMPLEMENTED]
|
||||||
|
Instead of ouputting the files to folder, files will be rebuilt to
|
||||||
|
Torrent ZPAQ (TZPAQ) files. This format is based on the ZPAQ file
|
||||||
|
format as defined at https://github.com/zpaq/zpaq but with custom
|
||||||
|
header information. This is currently unused by any major
|
||||||
|
application.
|
||||||
|
|
||||||
|
-tzstd Enable Torrent Zstd output [UNIMPLEMENTED]
|
||||||
|
Instead of ouputting the files to folder, files will be rebuilt to
|
||||||
|
Torrent Zstd (TZstd) files. This format is based on the Zstd file
|
||||||
|
format as defined at https://github.com/skbkontur/ZstdNet but with
|
||||||
|
custom header information. This is currently unused by any major
|
||||||
|
application.
|
||||||
|
|
||||||
-h=, --header= Remove headers from hash calculations
|
-h=, --header= Remove headers from hash calculations
|
||||||
If this is set, then all files that have copier headers that are
|
If this is set, then all files that have copier headers that are
|
||||||
detected will have them removed from the hash calculation. This will
|
detected will have them removed from the hash calculation. This will
|
||||||
|
|||||||
@@ -153,12 +153,15 @@
|
|||||||
<Compile Include="FileTypes\BaseArchive.cs" />
|
<Compile Include="FileTypes\BaseArchive.cs" />
|
||||||
<Compile Include="FileTypes\Folder.cs" />
|
<Compile Include="FileTypes\Folder.cs" />
|
||||||
<Compile Include="FileTypes\GZipArchive.cs" />
|
<Compile Include="FileTypes\GZipArchive.cs" />
|
||||||
<Compile Include="FileTypes\LRZArchive.cs" />
|
<Compile Include="FileTypes\LRZipArchive.cs" />
|
||||||
|
<Compile Include="FileTypes\LZ4Archive.cs" />
|
||||||
<Compile Include="FileTypes\RarArchive.cs" />
|
<Compile Include="FileTypes\RarArchive.cs" />
|
||||||
<Compile Include="FileTypes\SevenZipArchive.cs" />
|
<Compile Include="FileTypes\SevenZipArchive.cs" />
|
||||||
<Compile Include="FileTypes\TapeArchive.cs" />
|
<Compile Include="FileTypes\TapeArchive.cs" />
|
||||||
<Compile Include="FileTypes\XZArchive.cs" />
|
<Compile Include="FileTypes\XZArchive.cs" />
|
||||||
<Compile Include="FileTypes\TorrentZipArchive.cs" />
|
<Compile Include="FileTypes\TorrentZipArchive.cs" />
|
||||||
|
<Compile Include="FileTypes\ZPAQArchive.cs" />
|
||||||
|
<Compile Include="FileTypes\ZstdArchive.cs" />
|
||||||
<Compile Include="Items\Archive.cs" />
|
<Compile Include="Items\Archive.cs" />
|
||||||
<Compile Include="Items\BiosSet.cs" />
|
<Compile Include="Items\BiosSet.cs" />
|
||||||
<Compile Include="DatFiles\DatFile.cs" />
|
<Compile Include="DatFiles\DatFile.cs" />
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
|
|
||||||
using SabreTools.Library.Data;
|
using SabreTools.Library.Data;
|
||||||
using SabreTools.Library.FileTypes;
|
using SabreTools.Library.FileTypes;
|
||||||
using SabreTools.Library.Items;
|
|
||||||
|
|
||||||
#if MONO
|
#if MONO
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -21,15 +19,9 @@ namespace SabreTools.Library.Tools
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tools for working with archives
|
/// Tools for working with archives
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
|
||||||
/// TODO: Full archive support for: RAR, LRZip, ZPAQ?, Zstd?, LZ4?
|
|
||||||
/// ZPAQ: https://github.com/zpaq/zpaq - In progress as external DLL
|
|
||||||
/// Zstd: https://github.com/skbkontur/ZstdNet
|
|
||||||
/// LZ4: https://github.com/lz4/lz4
|
|
||||||
/// </remarks>
|
|
||||||
public static class ArchiveTools
|
public static class ArchiveTools
|
||||||
{
|
{
|
||||||
#region Factory
|
#region Factories
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create an archive of the specified type, if possible
|
/// Create an archive of the specified type, if possible
|
||||||
@@ -114,8 +106,8 @@ namespace SabreTools.Library.Tools
|
|||||||
return new SevenZipArchive();
|
return new SevenZipArchive();
|
||||||
case OutputFormat.TorrentGzip:
|
case OutputFormat.TorrentGzip:
|
||||||
return new GZipArchive();
|
return new GZipArchive();
|
||||||
case OutputFormat.TorrentLrzip:
|
case OutputFormat.TorrentLRZip:
|
||||||
return new LRZArchive();
|
return new LRZipArchive();
|
||||||
case OutputFormat.TorrentRar:
|
case OutputFormat.TorrentRar:
|
||||||
return new RarArchive();
|
return new RarArchive();
|
||||||
case OutputFormat.TorrentXZ:
|
case OutputFormat.TorrentXZ:
|
||||||
|
|||||||
@@ -462,6 +462,13 @@ namespace SabreTools
|
|||||||
null));
|
null));
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
sort.AddFeature("tlz4", new Feature(
|
||||||
|
new List<string>() { "-tlz4", "--tlz4" },
|
||||||
|
"Enable TorrentLZ4 output",
|
||||||
|
FeatureType.Flag,
|
||||||
|
null));
|
||||||
|
*/
|
||||||
|
/*
|
||||||
sort.AddFeature("trar", new Feature(
|
sort.AddFeature("trar", new Feature(
|
||||||
new List<string>() { "-trar", "--trar" },
|
new List<string>() { "-trar", "--trar" },
|
||||||
"Enable TorrentRAR output",
|
"Enable TorrentRAR output",
|
||||||
@@ -480,6 +487,20 @@ namespace SabreTools
|
|||||||
"Enable TorrentZip output",
|
"Enable TorrentZip output",
|
||||||
FeatureType.Flag,
|
FeatureType.Flag,
|
||||||
null));
|
null));
|
||||||
|
/*
|
||||||
|
sort.AddFeature("tzpaq", new Feature(
|
||||||
|
new List<string>() { "-tzpaq", "--tzpaq" },
|
||||||
|
"Enable TorrentZPAQ output",
|
||||||
|
FeatureType.Flag,
|
||||||
|
null));
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
sort.AddFeature("tzstd", new Feature(
|
||||||
|
new List<string>() { "-tzstd", "--tzstd" },
|
||||||
|
"Enable TorrentZstd output",
|
||||||
|
FeatureType.Flag,
|
||||||
|
null));
|
||||||
|
*/
|
||||||
sort.AddFeature("header", new Feature(
|
sort.AddFeature("header", new Feature(
|
||||||
new List<string>() { "-h", "--header" },
|
new List<string>() { "-h", "--header" },
|
||||||
"Set a header skipper to use, blank means all",
|
"Set a header skipper to use, blank means all",
|
||||||
@@ -600,6 +621,13 @@ namespace SabreTools
|
|||||||
null));
|
null));
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
sortDepot.AddFeature("tlz4", new Feature(
|
||||||
|
new List<string>() { "-tlz4", "--tlz4" },
|
||||||
|
"Enable TorrentLZ4 output",
|
||||||
|
FeatureType.Flag,
|
||||||
|
null));
|
||||||
|
*/
|
||||||
|
/*
|
||||||
sortDepot.AddFeature("trar", new Feature(
|
sortDepot.AddFeature("trar", new Feature(
|
||||||
new List<string>() { "-trar", "--trar" },
|
new List<string>() { "-trar", "--trar" },
|
||||||
"Enable TorrentRAR output",
|
"Enable TorrentRAR output",
|
||||||
@@ -618,6 +646,20 @@ namespace SabreTools
|
|||||||
"Enable TorrentZip output",
|
"Enable TorrentZip output",
|
||||||
FeatureType.Flag,
|
FeatureType.Flag,
|
||||||
null));
|
null));
|
||||||
|
/*
|
||||||
|
sortDepot.AddFeature("tzpaq", new Feature(
|
||||||
|
new List<string>() { "-tzpaq", "--tzpaq" },
|
||||||
|
"Enable TorrentZPAQ output",
|
||||||
|
FeatureType.Flag,
|
||||||
|
null));
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
sortDepot.AddFeature("tzstd", new Feature(
|
||||||
|
new List<string>() { "-tzstd", "--tzstd" },
|
||||||
|
"Enable TorrentZstd output",
|
||||||
|
FeatureType.Flag,
|
||||||
|
null));
|
||||||
|
*/
|
||||||
sortDepot.AddFeature("header", new Feature(
|
sortDepot.AddFeature("header", new Feature(
|
||||||
new List<string>() { "-h", "--header" },
|
new List<string>() { "-h", "--header" },
|
||||||
"Set a header skipper to use, blank means all",
|
"Set a header skipper to use, blank means all",
|
||||||
|
|||||||
@@ -615,7 +615,11 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-tlrz":
|
case "-tlrz":
|
||||||
case "--tlrz":
|
case "--tlrz":
|
||||||
outputFormat = OutputFormat.TorrentLrzip;
|
outputFormat = OutputFormat.TorrentLRZip;
|
||||||
|
break;
|
||||||
|
case "-lz4":
|
||||||
|
case "--tlz4":
|
||||||
|
outputFormat = OutputFormat.TorrentLZ4;
|
||||||
break;
|
break;
|
||||||
case "-trar":
|
case "-trar":
|
||||||
case "--trar":
|
case "--trar":
|
||||||
@@ -637,6 +641,14 @@ namespace SabreTools
|
|||||||
case "--tzip":
|
case "--tzip":
|
||||||
outputFormat = OutputFormat.TorrentZip;
|
outputFormat = OutputFormat.TorrentZip;
|
||||||
break;
|
break;
|
||||||
|
case "-tzpaq":
|
||||||
|
case "--tzpaq":
|
||||||
|
outputFormat = OutputFormat.TorrentZPAQ;
|
||||||
|
break;
|
||||||
|
case "-tzstd":
|
||||||
|
case "--tzstd":
|
||||||
|
outputFormat = OutputFormat.TorrentZstd;
|
||||||
|
break;
|
||||||
case "-upd":
|
case "-upd":
|
||||||
case "--update-dat":
|
case "--update-dat":
|
||||||
updateDat = true;
|
updateDat = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user