mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[SabreTools, Flags, DatFile, Utilities, README] Stat output
Add new input that mirrors the input for DAT formats. This also introduces the SSV statistics output format
This commit is contained in:
@@ -6226,6 +6226,10 @@ Please check the log folder if the stats scrolled offscreen", false);
|
||||
{
|
||||
output.Add(StatReportFormat.HTML, CreateOutStatsNamesHelper(outDir, ".html", reportName, overwrite));
|
||||
}
|
||||
if ((statDatFormat & StatReportFormat.SSV) != 0)
|
||||
{
|
||||
output.Add(StatReportFormat.SSV, CreateOutStatsNamesHelper(outDir, ".ssv", reportName, overwrite));
|
||||
}
|
||||
if ((statDatFormat & StatReportFormat.TSV) != 0)
|
||||
{
|
||||
output.Add(StatReportFormat.TSV, CreateOutStatsNamesHelper(outDir, ".tsv", reportName, overwrite));
|
||||
|
||||
@@ -273,9 +273,10 @@ namespace SabreTools.Library.Data
|
||||
Textfile = 0x01,
|
||||
HTML = Textfile << 1,
|
||||
CSV = HTML << 1,
|
||||
TSV = CSV << 1,
|
||||
SSV = CSV << 1,
|
||||
TSV = SSV << 1,
|
||||
|
||||
All = Textfile | HTML | CSV | TSV,
|
||||
All = Textfile | HTML | CSV | SSV | TSV,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -637,21 +637,38 @@ Options:
|
||||
- Items that include a SHA-512
|
||||
- Items with Nodump status
|
||||
|
||||
-as, --all-stats Write all statistics to all available formats
|
||||
-srt, --report-type Output statistics to a specified format
|
||||
Add outputting the created DAT to known format. Multiple instances
|
||||
of this flag are allowed.
|
||||
|
||||
Possible values are:
|
||||
all - All available DAT types
|
||||
csv - Standardized Comma-Separated Value
|
||||
html - HTML webpage
|
||||
ssv - Standardized Semicolon-Separated Value
|
||||
text - Generic textfile
|
||||
tsv - Standardized Tab-Separated Value
|
||||
|
||||
-as, --all-stats Write all statistics to all available formats [DEPRECIATED]
|
||||
Output all statistical information to all available formats.
|
||||
[DEPRECIATED]
|
||||
|
||||
-csv, --csv Output in Comma-Separated Value format
|
||||
-csv, --csv Output in Comma-Separated Value format [DEPRECIATED]
|
||||
Output all statistical information in standardized CSV format.
|
||||
[DEPRECIATED]
|
||||
|
||||
-html, --html Output in HTML format
|
||||
-html, --html Output in HTML format [DEPRECIATED]
|
||||
Output all statistical information in standardized HTML format.
|
||||
[DEPRECIATED]
|
||||
|
||||
-tsv, --tsv Output in Tab-Separated Value format
|
||||
-tsv, --tsv Output in Tab-Separated Value format [DEPRECIATED]
|
||||
Output all statistical information in standardized TSV format.
|
||||
[DEPRECIATED]
|
||||
|
||||
-txt, --text Output in generic text format
|
||||
-txt, --text Output in generic text format [DEPRECIATED]
|
||||
Output all statistical information in generic text format. If no
|
||||
other format flags are enabled, this is the default output.
|
||||
[DEPRECIATED]
|
||||
|
||||
-f, --filename Set the external name of the DAT
|
||||
Set the external filename for the output DAT(s)
|
||||
|
||||
@@ -558,6 +558,8 @@ namespace SabreTools.Library.Tools
|
||||
return new Reports.SeparatedValue(null, filename, ',', baddumpCol, nodumpCol);
|
||||
case StatReportFormat.HTML:
|
||||
return new Html(null, filename, baddumpCol, nodumpCol);
|
||||
case StatReportFormat.SSV:
|
||||
return new Reports.SeparatedValue(null, filename, ';', baddumpCol, nodumpCol);
|
||||
case StatReportFormat.TSV:
|
||||
return new Reports.SeparatedValue(null, filename, '\t', baddumpCol, nodumpCol);
|
||||
}
|
||||
@@ -918,6 +920,32 @@ namespace SabreTools.Library.Tools
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get StatReportFormat value from input string
|
||||
/// </summary>
|
||||
/// <param name="input">String to get value from</param>
|
||||
/// <returns>StatReportFormat value corresponding to the string</returns>
|
||||
public static StatReportFormat GetStatFormat(string input)
|
||||
{
|
||||
switch (input?.Trim().ToLowerInvariant())
|
||||
{
|
||||
case "all":
|
||||
return StatReportFormat.All;
|
||||
case "csv":
|
||||
return StatReportFormat.CSV;
|
||||
case "html":
|
||||
return StatReportFormat.HTML;
|
||||
case "ssv":
|
||||
return StatReportFormat.SSV;
|
||||
case "text":
|
||||
return StatReportFormat.Textfile;
|
||||
case "tsv":
|
||||
return StatReportFormat.TSV;
|
||||
default:
|
||||
return 0x0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a sanitized size from an input string
|
||||
/// </summary>
|
||||
|
||||
@@ -40,11 +40,11 @@ namespace SabreTools
|
||||
return new Feature(
|
||||
"all-stats",
|
||||
new List<string>() { "-as", "--all-stats" },
|
||||
"Write all statistics to all available formats",
|
||||
"Write all statistics to all available formats [DEPRECIATED]",
|
||||
FeatureType.Flag,
|
||||
longDescription: "Output all statistical information to all available formats.");
|
||||
}
|
||||
longDescription: "Output all statistical information to all available formats. [DEPRECIATED]");
|
||||
}
|
||||
} // TODO: Remove
|
||||
private static Feature _archivesAsFilesFlag
|
||||
{
|
||||
get
|
||||
@@ -136,11 +136,11 @@ namespace SabreTools
|
||||
return new Feature(
|
||||
"csv",
|
||||
new List<string>() { "-csv", "--csv" },
|
||||
"Output in Comma-Separated Value format",
|
||||
"Output in Comma-Separated Value format [DEPRECIATED]",
|
||||
FeatureType.Flag,
|
||||
longDescription: "Output all statistical information in standardized CSV format.");
|
||||
}
|
||||
longDescription: "Output all statistical information in standardized CSV format. [DEPRECIATED]");
|
||||
}
|
||||
} // TODO: Remove
|
||||
private static Feature _datDeviceNonMergedFlag
|
||||
{
|
||||
get
|
||||
@@ -424,11 +424,11 @@ namespace SabreTools
|
||||
return new Feature(
|
||||
"html",
|
||||
new List<string>() { "-html", "--html" },
|
||||
"Output in HTML format",
|
||||
"Output in HTML format [DEPRECIATED]",
|
||||
FeatureType.Flag,
|
||||
longDescription: "Output all statistical information in standardized HTML format.");
|
||||
}
|
||||
longDescription: "Output all statistical information in standardized HTML format. [DEPRECIATED]");
|
||||
}
|
||||
} // TODO: Remove
|
||||
private static Feature _individualFlag
|
||||
{
|
||||
get
|
||||
@@ -1168,11 +1168,11 @@ namespace SabreTools
|
||||
return new Feature(
|
||||
"text",
|
||||
new List<string>() { "-txt", "--text" },
|
||||
"Output in generic text format",
|
||||
"Output in generic text format [DEPRECIATED]",
|
||||
FeatureType.Flag,
|
||||
longDescription: "Output all statistical information in generic text format. If no other format flags are enabled, this is the default output.");
|
||||
}
|
||||
longDescription: "Output all statistical information in generic text format. If no other format flags are enabled, this is the default output. [DEPRECIATED]");
|
||||
}
|
||||
} // TODO: Remove
|
||||
private static Feature _torrent7zipFlag
|
||||
{
|
||||
get
|
||||
@@ -1300,11 +1300,11 @@ namespace SabreTools
|
||||
return new Feature(
|
||||
"tsv",
|
||||
new List<string>() { "-tsv", "--tsv" },
|
||||
"Output in Tab-Separated Value format",
|
||||
"Output in Tab-Separated Value format [DEPRECIATED]",
|
||||
FeatureType.Flag,
|
||||
longDescription: "Output all statistical information in standardized TSV format.");
|
||||
}
|
||||
longDescription: "Output all statistical information in standardized TSV format. [DEPRECIATED]");
|
||||
}
|
||||
} // TODO: Remove
|
||||
private static Feature _typeFlag
|
||||
{
|
||||
get
|
||||
@@ -1802,6 +1802,26 @@ Possible values are:
|
||||
xml, logiqx - Logiqx XML");
|
||||
}
|
||||
}
|
||||
private static Feature _reportTypeListInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
"report-type",
|
||||
new List<string>() { "-srt", "--report-type" },
|
||||
"Output statistics to a specified format",
|
||||
FeatureType.List,
|
||||
longDescription: @"Add outputting the created DAT to known format. Multiple instances of this flag are allowed.
|
||||
|
||||
Possible values are:
|
||||
all - All available DAT types
|
||||
csv - Standardized Comma-Separated Value
|
||||
html - HTML webpage
|
||||
ssv - Standardized Semicolon-Separated Value
|
||||
text - Generic textfile
|
||||
tsv - Standardized Tab-Separated Value");
|
||||
}
|
||||
}
|
||||
private static Feature _sha1ListInput
|
||||
{
|
||||
get
|
||||
@@ -2486,6 +2506,9 @@ The stats that are outputted are as follows:
|
||||
- Items that include a SHA-384
|
||||
- Items that include a SHA-512
|
||||
- Items with Nodump status");
|
||||
// NEW
|
||||
stats.AddFeature(_reportTypeListInput);
|
||||
// OLD
|
||||
stats.AddFeature(_allStatsFlag);
|
||||
stats.AddFeature(_csvFlag);
|
||||
stats.AddFeature(_htmlFlag);
|
||||
|
||||
@@ -205,6 +205,7 @@ namespace SabreTools
|
||||
addFileDates = true;
|
||||
break;
|
||||
case "all-stats":
|
||||
Globals.Logger.User("This flag '{0}' is depreciated, pleause use {1} instead", feat.Key, String.Join(", ", _reportTypeListInput.Flags));
|
||||
statDatFormat = StatReportFormat.All;
|
||||
break;
|
||||
case "archives-as-files":
|
||||
@@ -229,6 +230,7 @@ namespace SabreTools
|
||||
cleanGameNames = true;
|
||||
break;
|
||||
case "csv":
|
||||
Globals.Logger.User("This flag '{0}' is depreciated, pleause use {1} instead", feat.Key, String.Join(", ", _reportTypeListInput.Flags));
|
||||
statDatFormat |= StatReportFormat.CSV;
|
||||
break;
|
||||
case "dat-device-non-merged":
|
||||
@@ -306,6 +308,7 @@ namespace SabreTools
|
||||
hashOnly = true;
|
||||
break;
|
||||
case "html":
|
||||
Globals.Logger.User("This flag '{0}' is depreciated, pleause use {1} instead", feat.Key, String.Join(", ", _reportTypeListInput.Flags));
|
||||
statDatFormat |= StatReportFormat.HTML;
|
||||
break;
|
||||
case "individual":
|
||||
@@ -521,6 +524,7 @@ namespace SabreTools
|
||||
outputFormat = OutputFormat.TapeArchive;
|
||||
break;
|
||||
case "text":
|
||||
Globals.Logger.User("This flag '{0}' is depreciated, pleause use {1} instead", feat.Key, String.Join(", ", _reportTypeListInput.Flags));
|
||||
statDatFormat |= StatReportFormat.Textfile;
|
||||
break;
|
||||
case "torrent-7zip":
|
||||
@@ -554,6 +558,7 @@ namespace SabreTools
|
||||
filter.Trim = true;
|
||||
break;
|
||||
case "tsv":
|
||||
Globals.Logger.User("This flag '{0}' is depreciated, pleause use {1} instead", feat.Key, String.Join(", ", _reportTypeListInput.Flags));
|
||||
statDatFormat |= StatReportFormat.TSV;
|
||||
break;
|
||||
case "type":
|
||||
@@ -703,6 +708,12 @@ namespace SabreTools
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "report-type":
|
||||
foreach (string rt in (List<string>)feat.Value.GetValue())
|
||||
{
|
||||
statDatFormat |= Utilities.GetStatFormat(rt);
|
||||
}
|
||||
break;
|
||||
case "sha1":
|
||||
filter.SHA1s.AddRange((List<string>)feat.Value.GetValue());
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user