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));
|
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)
|
if ((statDatFormat & StatReportFormat.TSV) != 0)
|
||||||
{
|
{
|
||||||
output.Add(StatReportFormat.TSV, CreateOutStatsNamesHelper(outDir, ".tsv", reportName, overwrite));
|
output.Add(StatReportFormat.TSV, CreateOutStatsNamesHelper(outDir, ".tsv", reportName, overwrite));
|
||||||
|
|||||||
@@ -273,9 +273,10 @@ namespace SabreTools.Library.Data
|
|||||||
Textfile = 0x01,
|
Textfile = 0x01,
|
||||||
HTML = Textfile << 1,
|
HTML = Textfile << 1,
|
||||||
CSV = HTML << 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>
|
/// <summary>
|
||||||
|
|||||||
@@ -637,21 +637,38 @@ Options:
|
|||||||
- Items that include a SHA-512
|
- Items that include a SHA-512
|
||||||
- Items with Nodump status
|
- 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.
|
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.
|
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.
|
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.
|
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
|
Output all statistical information in generic text format. If no
|
||||||
other format flags are enabled, this is the default output.
|
other format flags are enabled, this is the default output.
|
||||||
|
[DEPRECIATED]
|
||||||
|
|
||||||
-f, --filename Set the external name of the DAT
|
-f, --filename Set the external name of the DAT
|
||||||
Set the external filename for the output DAT(s)
|
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);
|
return new Reports.SeparatedValue(null, filename, ',', baddumpCol, nodumpCol);
|
||||||
case StatReportFormat.HTML:
|
case StatReportFormat.HTML:
|
||||||
return new Html(null, filename, baddumpCol, nodumpCol);
|
return new Html(null, filename, baddumpCol, nodumpCol);
|
||||||
|
case StatReportFormat.SSV:
|
||||||
|
return new Reports.SeparatedValue(null, filename, ';', baddumpCol, nodumpCol);
|
||||||
case StatReportFormat.TSV:
|
case StatReportFormat.TSV:
|
||||||
return new Reports.SeparatedValue(null, filename, '\t', baddumpCol, nodumpCol);
|
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>
|
/// <summary>
|
||||||
/// Get a sanitized size from an input string
|
/// Get a sanitized size from an input string
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -40,11 +40,11 @@ namespace SabreTools
|
|||||||
return new Feature(
|
return new Feature(
|
||||||
"all-stats",
|
"all-stats",
|
||||||
new List<string>() { "-as", "--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,
|
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
|
private static Feature _archivesAsFilesFlag
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -136,11 +136,11 @@ namespace SabreTools
|
|||||||
return new Feature(
|
return new Feature(
|
||||||
"csv",
|
"csv",
|
||||||
new List<string>() { "-csv", "--csv" },
|
new List<string>() { "-csv", "--csv" },
|
||||||
"Output in Comma-Separated Value format",
|
"Output in Comma-Separated Value format [DEPRECIATED]",
|
||||||
FeatureType.Flag,
|
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
|
private static Feature _datDeviceNonMergedFlag
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -424,11 +424,11 @@ namespace SabreTools
|
|||||||
return new Feature(
|
return new Feature(
|
||||||
"html",
|
"html",
|
||||||
new List<string>() { "-html", "--html" },
|
new List<string>() { "-html", "--html" },
|
||||||
"Output in HTML format",
|
"Output in HTML format [DEPRECIATED]",
|
||||||
FeatureType.Flag,
|
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
|
private static Feature _individualFlag
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -1168,11 +1168,11 @@ namespace SabreTools
|
|||||||
return new Feature(
|
return new Feature(
|
||||||
"text",
|
"text",
|
||||||
new List<string>() { "-txt", "--text" },
|
new List<string>() { "-txt", "--text" },
|
||||||
"Output in generic text format",
|
"Output in generic text format [DEPRECIATED]",
|
||||||
FeatureType.Flag,
|
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
|
private static Feature _torrent7zipFlag
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -1300,11 +1300,11 @@ namespace SabreTools
|
|||||||
return new Feature(
|
return new Feature(
|
||||||
"tsv",
|
"tsv",
|
||||||
new List<string>() { "-tsv", "--tsv" },
|
new List<string>() { "-tsv", "--tsv" },
|
||||||
"Output in Tab-Separated Value format",
|
"Output in Tab-Separated Value format [DEPRECIATED]",
|
||||||
FeatureType.Flag,
|
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
|
private static Feature _typeFlag
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -1802,6 +1802,26 @@ Possible values are:
|
|||||||
xml, logiqx - Logiqx XML");
|
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
|
private static Feature _sha1ListInput
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -2486,6 +2506,9 @@ The stats that are outputted are as follows:
|
|||||||
- Items that include a SHA-384
|
- Items that include a SHA-384
|
||||||
- Items that include a SHA-512
|
- Items that include a SHA-512
|
||||||
- Items with Nodump status");
|
- Items with Nodump status");
|
||||||
|
// NEW
|
||||||
|
stats.AddFeature(_reportTypeListInput);
|
||||||
|
// OLD
|
||||||
stats.AddFeature(_allStatsFlag);
|
stats.AddFeature(_allStatsFlag);
|
||||||
stats.AddFeature(_csvFlag);
|
stats.AddFeature(_csvFlag);
|
||||||
stats.AddFeature(_htmlFlag);
|
stats.AddFeature(_htmlFlag);
|
||||||
|
|||||||
@@ -205,6 +205,7 @@ namespace SabreTools
|
|||||||
addFileDates = true;
|
addFileDates = true;
|
||||||
break;
|
break;
|
||||||
case "all-stats":
|
case "all-stats":
|
||||||
|
Globals.Logger.User("This flag '{0}' is depreciated, pleause use {1} instead", feat.Key, String.Join(", ", _reportTypeListInput.Flags));
|
||||||
statDatFormat = StatReportFormat.All;
|
statDatFormat = StatReportFormat.All;
|
||||||
break;
|
break;
|
||||||
case "archives-as-files":
|
case "archives-as-files":
|
||||||
@@ -229,6 +230,7 @@ namespace SabreTools
|
|||||||
cleanGameNames = true;
|
cleanGameNames = true;
|
||||||
break;
|
break;
|
||||||
case "csv":
|
case "csv":
|
||||||
|
Globals.Logger.User("This flag '{0}' is depreciated, pleause use {1} instead", feat.Key, String.Join(", ", _reportTypeListInput.Flags));
|
||||||
statDatFormat |= StatReportFormat.CSV;
|
statDatFormat |= StatReportFormat.CSV;
|
||||||
break;
|
break;
|
||||||
case "dat-device-non-merged":
|
case "dat-device-non-merged":
|
||||||
@@ -306,6 +308,7 @@ namespace SabreTools
|
|||||||
hashOnly = true;
|
hashOnly = true;
|
||||||
break;
|
break;
|
||||||
case "html":
|
case "html":
|
||||||
|
Globals.Logger.User("This flag '{0}' is depreciated, pleause use {1} instead", feat.Key, String.Join(", ", _reportTypeListInput.Flags));
|
||||||
statDatFormat |= StatReportFormat.HTML;
|
statDatFormat |= StatReportFormat.HTML;
|
||||||
break;
|
break;
|
||||||
case "individual":
|
case "individual":
|
||||||
@@ -521,6 +524,7 @@ namespace SabreTools
|
|||||||
outputFormat = OutputFormat.TapeArchive;
|
outputFormat = OutputFormat.TapeArchive;
|
||||||
break;
|
break;
|
||||||
case "text":
|
case "text":
|
||||||
|
Globals.Logger.User("This flag '{0}' is depreciated, pleause use {1} instead", feat.Key, String.Join(", ", _reportTypeListInput.Flags));
|
||||||
statDatFormat |= StatReportFormat.Textfile;
|
statDatFormat |= StatReportFormat.Textfile;
|
||||||
break;
|
break;
|
||||||
case "torrent-7zip":
|
case "torrent-7zip":
|
||||||
@@ -554,6 +558,7 @@ namespace SabreTools
|
|||||||
filter.Trim = true;
|
filter.Trim = true;
|
||||||
break;
|
break;
|
||||||
case "tsv":
|
case "tsv":
|
||||||
|
Globals.Logger.User("This flag '{0}' is depreciated, pleause use {1} instead", feat.Key, String.Join(", ", _reportTypeListInput.Flags));
|
||||||
statDatFormat |= StatReportFormat.TSV;
|
statDatFormat |= StatReportFormat.TSV;
|
||||||
break;
|
break;
|
||||||
case "type":
|
case "type":
|
||||||
@@ -703,6 +708,12 @@ namespace SabreTools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "report-type":
|
||||||
|
foreach (string rt in (List<string>)feat.Value.GetValue())
|
||||||
|
{
|
||||||
|
statDatFormat |= Utilities.GetStatFormat(rt);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "sha1":
|
case "sha1":
|
||||||
filter.SHA1s.AddRange((List<string>)feat.Value.GetValue());
|
filter.SHA1s.AddRange((List<string>)feat.Value.GetValue());
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user