File type tango

This commit is contained in:
Matt Nadareski
2020-07-26 22:44:05 -07:00
parent 4f28ae7f61
commit 9a14d4befb
10 changed files with 34 additions and 164 deletions

View File

@@ -52,7 +52,7 @@ As the core of the SabreTools suite, the C# library provides nearly all of the f
* Stores the header information linked to unheadered hash * Stores the header information linked to unheadered hash
* **Rebuild From DAT** - Act as a simple rebuilder for files * **Rebuild From DAT** - Act as a simple rebuilder for files
* Two options for rebuild origin: standard folder and Romba depot * Two options for rebuild origin: standard folder and Romba depot
* Multiple output formats: unarchived, TAR, TorrentZip, 7zip, XZ, TorrentGZ * Multiple output formats: unarchived, TAR, TorrentZip, 7zip, TorrentGZ
* Can rebuild from multiple DATs at the same time * Can rebuild from multiple DATs at the same time
* Cross-check with multiple hashing algorithms, up to SHA-512 * Cross-check with multiple hashing algorithms, up to SHA-512
* Can output a fixdat based on the rebuilt files * Can output a fixdat based on the rebuilt files

View File

@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Runtime.CompilerServices;
using System.Threading.Tasks; using System.Threading.Tasks;
using SabreTools.Library.Data; using SabreTools.Library.Data;
@@ -14,8 +13,6 @@ using SabreTools.Library.Skippers;
using SabreTools.Library.Tools; using SabreTools.Library.Tools;
using NaturalSort; using NaturalSort;
[assembly: InternalsVisibleTo("SabreTools")]
[assembly: InternalsVisibleTo("RombaSharp")]
namespace SabreTools.Library.DatFiles namespace SabreTools.Library.DatFiles
{ {
/// <summary> /// <summary>
@@ -23,13 +20,13 @@ namespace SabreTools.Library.DatFiles
/// </summary> /// </summary>
public abstract class DatFile public abstract class DatFile
{ {
#region Private instance variables #region Publically available fields
// Internal DatHeader values // Internal DatHeader values
internal DatHeader DatHeader = new DatHeader(); public DatHeader DatHeader { get; set; } = new DatHeader();
// DatItems dictionary // DatItems dictionary
internal ItemDictionary Items = new ItemDictionary(); public ItemDictionary Items { get; set; } = new ItemDictionary();
#endregion #endregion

View File

@@ -4,12 +4,12 @@ using System.Text;
using SabreTools.Library.Tools; using SabreTools.Library.Tools;
namespace SabreTools.Library.FileTypes namespace SabreTools.Library.FileTypes.CHD
{ {
/// <summary> /// <summary>
/// CHD V1 File /// CHD V1 File
/// </summary> /// </summary>
public class CHDFileV1 : CHDFile internal class CHDFileV1 : CHDFile
{ {
/// <summary> /// <summary>
/// CHD flags /// CHD flags

View File

@@ -4,12 +4,12 @@ using System.Text;
using SabreTools.Library.Tools; using SabreTools.Library.Tools;
namespace SabreTools.Library.FileTypes namespace SabreTools.Library.FileTypes.CHD
{ {
/// <summary> /// <summary>
/// CHD V2 File /// CHD V2 File
/// </summary> /// </summary>
public class CHDFileV2 : CHDFile internal class CHDFileV2 : CHDFile
{ {
/// <summary> /// <summary>
/// CHD flags /// CHD flags

View File

@@ -4,12 +4,12 @@ using System.Text;
using SabreTools.Library.Tools; using SabreTools.Library.Tools;
namespace SabreTools.Library.FileTypes namespace SabreTools.Library.FileTypes.CHD
{ {
/// <summary> /// <summary>
/// CHD V3 File /// CHD V3 File
/// </summary> /// </summary>
public class CHDFileV3 : CHDFile internal class CHDFileV3 : CHDFile
{ {
/// <summary> /// <summary>
/// CHD flags /// CHD flags

View File

@@ -4,12 +4,12 @@ using System.Text;
using SabreTools.Library.Tools; using SabreTools.Library.Tools;
namespace SabreTools.Library.FileTypes namespace SabreTools.Library.FileTypes.CHD
{ {
/// <summary> /// <summary>
/// CHD V4 File /// CHD V4 File
/// </summary> /// </summary>
public class CHDFileV4 : CHDFile internal class CHDFileV4 : CHDFile
{ {
/// <summary> /// <summary>
/// CHD flags /// CHD flags

View File

@@ -3,12 +3,12 @@ using System.Text;
using SabreTools.Library.Tools; using SabreTools.Library.Tools;
namespace SabreTools.Library.FileTypes namespace SabreTools.Library.FileTypes.CHD
{ {
/// <summary> /// <summary>
/// CHD V5 File /// CHD V5 File
/// </summary> /// </summary>
public class CHDFileV5 : CHDFile internal class CHDFileV5 : CHDFile
{ {
/// <summary> /// <summary>
/// Uncompressed map format /// Uncompressed map format

View File

@@ -3,6 +3,7 @@ using System.IO;
using System.Text; using System.Text;
using SabreTools.Library.Data; using SabreTools.Library.Data;
using SabreTools.Library.FileTypes.CHD;
using SabreTools.Library.Tools; using SabreTools.Library.Tools;
namespace SabreTools.Library.FileTypes namespace SabreTools.Library.FileTypes

View File

@@ -662,31 +662,6 @@ Options:
and output for physical files. Where appropriate, Romba depot and output for physical files. Where appropriate, Romba depot
files will be created as well. files will be created as well.
-tlrz, --torrent-lrzip Enable Torrent Long-Range Zip output [UNIMPLEMENTED]
Instead of outputting the files to folder, files will be rebuilt to
Torrent Long-Range Zip (TLRZ) files. This format is based on the
LRZip file format as defined at https://github.com/ckolivas/lrzip but
with custom header information. This is currently unused by any major
application.
-tlz4, --torrent-lz4 Enable Torrent LZ4 output [UNIMPLEMENTED]
Instead of outputting 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, --torrent-rar Enable Torrent RAR output [UNIMPLEMENTED]
Instead of outputting files to folder, files will be rebuilt to
Torrent RAR (TRAR) files. This format is based on the RAR propietary
format but with custom header information. This is currently unused
by any major application.
-txz, --torrent-xz Enable Torrent XZ output [UNIMPLEMENTED]
Instead of outputting files to folder, files will be rebuilt to
Torrent XZ (TXZ) files. This format is based on the LZMA container
format XZ, but with a file name replaced by the SHA-1 of the file
inside. This is currently unused by any major application.
-tzip, --torrent-zip Enable Torrent Zip output -tzip, --torrent-zip Enable Torrent Zip output
Instead of outputting files to folder, files will be rebuilt to Instead of outputting files to folder, files will be rebuilt to
TorrentZip (TZip) files. This format is based on the ZIP archive TorrentZip (TZip) files. This format is based on the ZIP archive
@@ -694,20 +669,6 @@ Options:
external tool RomVault (http://www.romvault.com/) and is already external tool RomVault (http://www.romvault.com/) and is already
widely used. widely used.
-tzpaq, --torrent-zpaq Enable Torrent ZPAQ output [UNIMPLEMENTED]
Instead of outputting 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, --torrent-zstd Enable Torrent Zstd output [UNIMPLEMENTED]
Instead of outputting 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= Set a header skipper to use, blank means all -h=, --header= Set a header skipper to use, blank means all
Set the header special field for the output DAT(s). In file Set the header special field for the output DAT(s). In file
rebuilding, this flag allows for either all copier headers (using string.Empty) rebuilding, this flag allows for either all copier headers (using string.Empty)
@@ -1946,13 +1907,7 @@ This section contains remappings from old flag names to new ones.
-t7z, --t7z -> -t7z, --torrent-7zip -t7z, --t7z -> -t7z, --torrent-7zip
-text, --text -> -srt=text, --report-type=text -text, --text -> -srt=text, --report-type=text
-tgz, --tgz -> -tgz, --torrent-gzip -tgz, --tgz -> -tgz, --torrent-gzip
-tlrz, --tlrz -> -tlrz, --torrent-lrzip
-tlz4, --tlz4 -> -tlz4, --torrent-lz4
-trar, --trar -> -trar, --torrent-rar
-txz, --txz -> -txz, --torrent-xz
-tzip, --tzip -> -tzip, --torrent-zip -tzip, --tzip -> -tzip, --torrent-zip
-tzpaq, --tzpaq -> -tzpaq, --torrent-zpaq
-tzstd, --tzstd -> -tzstd, --torrent-zstd
-udd, --update-desc -> -udd, --update-description -udd, --update-desc -> -udd, --update-description
-um, --update-manu -> -um, --update-manufacturer -um, --update-manu -> -um, --update-manufacturer
-xof, --exclude-of -> (-ef=romof -ef=cloneof -ef=sampleof -xof, --exclude-of -> (-ef=romof -ef=cloneof -ef=sampleof

View File

@@ -977,62 +977,6 @@ namespace SabreTools
} }
} }
public const string TorrentLrzipValue = "torrent-lrzip";
private static Feature TorrentLrzipFlag
{
get
{
return new Feature(
TorrentLrzipValue,
new List<string>() { "-tlrz", "--torrent-lrzip" },
"Enable Torrent Long-Range Zip output [UNIMPLEMENTED]",
FeatureType.Flag,
longDescription: "Instead of outputting the files to folder, files will be rebuilt to Torrent Long-Range Zip (TLRZ) files. This format is based on the LRZip file format as defined at https://github.com/ckolivas/lrzip but with custom header information. This is currently unused by any major application.");
}
}
public const string TorrentLz4Value = "torrent-lz4";
private static Feature TorrentLz4Flag
{
get
{
return new Feature(
TorrentLz4Value,
new List<string>() { "-tlz4", "--torrent-lz4" },
"Enable Torrent LZ4 output [UNIMPLEMENTED]",
FeatureType.Flag,
longDescription: "Instead of outputting 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.");
}
}
public const string TorrentRarValue = "torrent-rar";
private static Feature TorrentRarFlag
{
get
{
return new Feature(
TorrentRarValue,
new List<string>() { "-trar", "--torrent-rar" },
"Enable Torrent RAR output [UNIMPLEMENTED]",
FeatureType.Flag,
longDescription: "Instead of outputting files to folder, files will be rebuilt to Torrent RAR (TRAR) files. This format is based on the RAR propietary format but with custom header information. This is currently unused by any major application.");
}
}
public const string TorrentXzValue = "torrent-xz";
private static Feature TorrentXzFlag
{
get
{
return new Feature(
TorrentXzValue,
new List<string>() { "-txz", "--torrent-xz" },
"Enable Torrent XZ output [UNIMPLEMENTED]",
FeatureType.Flag,
longDescription: "Instead of outputting files to folder, files will be rebuilt to Torrent XZ (TXZ) files. This format is based on the LZMA container format XZ, but with a file name replaced by the SHA-1 of the file inside. This is currently unused by any major application.");
}
}
public const string TorrentZipValue = "torrent-zip"; public const string TorrentZipValue = "torrent-zip";
private static Feature TorrentZipFlag private static Feature TorrentZipFlag
{ {
@@ -1047,34 +991,6 @@ namespace SabreTools
} }
} }
public const string TorrentZpaqValue = "torrent-zpaq";
private static Feature TorrentZpaqFlag
{
get
{
return new Feature(
TorrentZpaqValue,
new List<string>() { "-tzpaq", "--torrent-zpaq" },
"Enable Torrent ZPAQ output [UNIMPLEMENTED]",
FeatureType.Flag,
longDescription: "Instead of outputting 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.");
}
}
public const string TorrentZstdValue = "torrent-zstd";
private static Feature TorrentZstdFlag
{
get
{
return new Feature(
TorrentZstdValue,
new List<string>() { "-tzstd", "--torrent-zstd" },
"Enable Torrent Zstd output [UNIMPLEMENTED]",
FeatureType.Flag,
longDescription: "Instead of outputting 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.");
}
}
public const string TrimValue = "trim"; public const string TrimValue = "trim";
private static Feature TrimFlag private static Feature TrimFlag
{ {
@@ -2618,20 +2534,20 @@ Some special strings that can be used:
return OutputFormat.Torrent7Zip; return OutputFormat.Torrent7Zip;
else if (GetBoolean(features, TorrentGzipValue)) else if (GetBoolean(features, TorrentGzipValue))
return OutputFormat.TorrentGzip; return OutputFormat.TorrentGzip;
else if (GetBoolean(features, TorrentLrzipValue)) //else if (GetBoolean(features, TorrentLrzipValue))
return OutputFormat.TorrentLRZip; // return OutputFormat.TorrentLRZip;
else if (GetBoolean(features, TorrentLz4Value)) //else if (GetBoolean(features, TorrentLz4Value))
return OutputFormat.TorrentLZ4; // return OutputFormat.TorrentLZ4;
else if (GetBoolean(features, TorrentRarValue)) //else if (GetBoolean(features, TorrentRarValue))
return OutputFormat.TorrentRar; // return OutputFormat.TorrentRar;
else if (GetBoolean(features, TorrentXzValue)) //else if (GetBoolean(features, TorrentXzValue))
return OutputFormat.TorrentXZ; // return OutputFormat.TorrentXZ;
else if (GetBoolean(features, TorrentZipValue)) else if (GetBoolean(features, TorrentZipValue))
return OutputFormat.TorrentZip; return OutputFormat.TorrentZip;
else if (GetBoolean(features, TorrentZpaqValue)) //else if (GetBoolean(features, TorrentZpaqValue))
return OutputFormat.TorrentZPAQ; // return OutputFormat.TorrentZPAQ;
else if (GetBoolean(features, TorrentZstdValue)) //else if (GetBoolean(features, TorrentZstdValue))
return OutputFormat.TorrentZstd; // return OutputFormat.TorrentZstd;
else else
return OutputFormat.Folder; return OutputFormat.Folder;
} }
@@ -3153,13 +3069,14 @@ The following systems have headers that this program can work with:
AddFeature(TarFlag); AddFeature(TarFlag);
AddFeature(TorrentGzipFlag); AddFeature(TorrentGzipFlag);
this[TorrentGzipFlag].AddFeature(RombaFlag); this[TorrentGzipFlag].AddFeature(RombaFlag);
AddFeature(TorrentLrzipFlag); //AddFeature(TorrentLrzipFlag);
AddFeature(TorrentLz4Flag); //AddFeature(TorrentLz4Flag);
AddFeature(TorrentRarFlag); //AddFeature(TorrentRarFlag);
AddFeature(TorrentXzFlag); //AddFeature(TorrentXzFlag);
//this[TorrentXzFlag].AddFeature(RombaFlag);
AddFeature(TorrentZipFlag); AddFeature(TorrentZipFlag);
AddFeature(TorrentZpaqFlag); //AddFeature(TorrentZpaqFlag);
AddFeature(TorrentZstdFlag); //AddFeature(TorrentZstdFlag);
AddFeature(HeaderStringInput); AddFeature(HeaderStringInput);
AddFeature(DatMergedFlag); AddFeature(DatMergedFlag);
AddFeature(DatSplitFlag); AddFeature(DatSplitFlag);