mirror of
https://github.com/aelurum/AssetStudio.git
synced 2026-11-15 19:28:48 -05:00
[CLI] Add flag to allow filtering assets in blacklist mode.
- Added --filter-blacklist-mode flag
This commit is contained in:
@@ -118,6 +118,7 @@ namespace AssetStudioCLI.Options
|
|||||||
public static Option<List<string>> o_filterByPathID;
|
public static Option<List<string>> o_filterByPathID;
|
||||||
public static Option<List<string>> o_filterByText;
|
public static Option<List<string>> o_filterByText;
|
||||||
public static Option<bool> f_filterWithRegex;
|
public static Option<bool> f_filterWithRegex;
|
||||||
|
public static Option<bool> f_filterBlackListMode;
|
||||||
//advanced
|
//advanced
|
||||||
public static Option<CompressionType> o_bundleBlockInfoCompression;
|
public static Option<CompressionType> o_bundleBlockInfoCompression;
|
||||||
public static Option<CompressionType> o_bundleBlockCompression;
|
public static Option<CompressionType> o_bundleBlockCompression;
|
||||||
@@ -456,7 +457,17 @@ namespace AssetStudioCLI.Options
|
|||||||
optionDefaultValue: false,
|
optionDefaultValue: false,
|
||||||
optionName: "--filter-with-regex",
|
optionName: "--filter-with-regex",
|
||||||
optionDescription: "(Flag) If specified, the filter options will handle the specified text\n" +
|
optionDescription: "(Flag) If specified, the filter options will handle the specified text\n" +
|
||||||
"as a regular expression (doesn't apply to --filter-by-pathid)",
|
"as a regular expression (doesn't apply to --filter-by-pathid)\n",
|
||||||
|
optionExample: "",
|
||||||
|
optionHelpGroup: HelpGroups.Filter,
|
||||||
|
isFlag: true
|
||||||
|
);
|
||||||
|
f_filterBlackListMode = new GroupedOption<bool>
|
||||||
|
(
|
||||||
|
optionDefaultValue: false,
|
||||||
|
optionName: "--filter-blacklist-mode",
|
||||||
|
optionDescription: "(Flag) If specified, the filter options will work as a blacklist\n" +
|
||||||
|
"(i.e. assets that match the filter conditions will be excluded)",
|
||||||
optionExample: "",
|
optionExample: "",
|
||||||
optionHelpGroup: HelpGroups.Filter,
|
optionHelpGroup: HelpGroups.Filter,
|
||||||
isFlag: true
|
isFlag: true
|
||||||
@@ -739,6 +750,10 @@ namespace AssetStudioCLI.Options
|
|||||||
f_filterWithRegex.Value = true;
|
f_filterWithRegex.Value = true;
|
||||||
flagIndexes.Add(i);
|
flagIndexes.Add(i);
|
||||||
break;
|
break;
|
||||||
|
case "--filter-blacklist-mode":
|
||||||
|
f_filterBlackListMode.Value = true;
|
||||||
|
flagIndexes.Add(i);
|
||||||
|
break;
|
||||||
case "--decompress-to-disk":
|
case "--decompress-to-disk":
|
||||||
f_decompressToDisk.Value = true;
|
f_decompressToDisk.Value = true;
|
||||||
flagIndexes.Add(i);
|
flagIndexes.Add(i);
|
||||||
@@ -1457,12 +1472,14 @@ namespace AssetStudioCLI.Options
|
|||||||
}
|
}
|
||||||
sb.AppendLine(ShowCurrentFilter());
|
sb.AppendLine(ShowCurrentFilter());
|
||||||
sb.AppendLine($"# Filter With Regex: {f_filterWithRegex}");
|
sb.AppendLine($"# Filter With Regex: {f_filterWithRegex}");
|
||||||
|
sb.AppendLine($"# Filter Blacklist mode: {f_filterBlackListMode}");
|
||||||
sb.AppendLine($"# Assembly Path: \"{o_assemblyPath}\"");
|
sb.AppendLine($"# Assembly Path: \"{o_assemblyPath}\"");
|
||||||
break;
|
break;
|
||||||
case WorkMode.Live2D:
|
case WorkMode.Live2D:
|
||||||
sb.AppendLine($"# [{o_workMode} Options]");
|
sb.AppendLine($"# [{o_workMode} Options]");
|
||||||
sb.AppendLine($"# Filter by Text: \"{string.Join("\", \"", o_filterByText.Value)}\"");
|
sb.AppendLine($"# Filter by Text: \"{string.Join("\", \"", o_filterByText.Value)}\"");
|
||||||
sb.AppendLine($"# Filter With Regex: {f_filterWithRegex}");
|
sb.AppendLine($"# Filter With Regex: {f_filterWithRegex}");
|
||||||
|
sb.AppendLine($"# Filter Blacklist mode: {f_filterBlackListMode}");
|
||||||
sb.AppendLine($"# Model Group Option: {o_l2dGroupOption}");
|
sb.AppendLine($"# Model Group Option: {o_l2dGroupOption}");
|
||||||
sb.AppendFormat("# Search Model-related Assets by: {0}\n", f_l2dAssetSearchByFilename.Value ? "FileName" : "Container");
|
sb.AppendFormat("# Search Model-related Assets by: {0}\n", f_l2dAssetSearchByFilename.Value ? "FileName" : "Container");
|
||||||
sb.AppendLine($"# Motion Export Method: {o_l2dMotionMode}");
|
sb.AppendLine($"# Motion Export Method: {o_l2dMotionMode}");
|
||||||
@@ -1476,6 +1493,7 @@ namespace AssetStudioCLI.Options
|
|||||||
? ShowCurrentFilter()
|
? ShowCurrentFilter()
|
||||||
: $"# Filter by Name(s): \"{string.Join("\", \"", o_filterByName.Value)}\"");
|
: $"# Filter by Name(s): \"{string.Join("\", \"", o_filterByName.Value)}\"");
|
||||||
sb.AppendLine($"# Filter With Regex: {f_filterWithRegex}");
|
sb.AppendLine($"# Filter With Regex: {f_filterWithRegex}");
|
||||||
|
sb.AppendLine($"# Filter Blacklist mode: {f_filterBlackListMode}");
|
||||||
sb.AppendLine($"# Export Image Format: {o_imageFormat}");
|
sb.AppendLine($"# Export Image Format: {o_imageFormat}");
|
||||||
sb.AppendLine($"# FBX Scale Factor: {o_fbxScaleFactor}");
|
sb.AppendLine($"# FBX Scale Factor: {o_fbxScaleFactor}");
|
||||||
sb.AppendLine($"# FBX Bone Size: {o_fbxBoneSize}");
|
sb.AppendLine($"# FBX Bone Size: {o_fbxBoneSize}");
|
||||||
|
|||||||
@@ -152,6 +152,9 @@ Filter Options:
|
|||||||
--filter-with-regex (Flag) If specified, the filter options will handle the specified text
|
--filter-with-regex (Flag) If specified, the filter options will handle the specified text
|
||||||
as a regular expression (doesn't apply to --filter-by-pathid)
|
as a regular expression (doesn't apply to --filter-by-pathid)
|
||||||
|
|
||||||
|
--filter-blacklist-mode (Flag) If specified, the filter options will work as a blacklist
|
||||||
|
(i.e. assets that match the filter conditions will be excluded)
|
||||||
|
|
||||||
Advanced Options:
|
Advanced Options:
|
||||||
--blockinfo-comp <value> Specify the compression type of bundle's blockInfo data
|
--blockinfo-comp <value> Specify the compression type of bundle's blockInfo data
|
||||||
<Value: auto(default) | zstd | oodle | lz4 | lzma>
|
<Value: auto(default) | zstd | oodle | lz4 | lzma>
|
||||||
|
|||||||
@@ -637,6 +637,14 @@ namespace AssetStudioCLI
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CLIOptions.f_filterBlackListMode.Value)
|
||||||
|
{
|
||||||
|
var blackListedCount = assetsCount - filteredAssets.Count;
|
||||||
|
Logger.Info($"Black list mode enabled: Excluding {blackListedCount} asset(s) from export.");
|
||||||
|
filteredAssets = parsedAssetsList.Except(filteredAssets).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
parsedAssetsList.Clear();
|
parsedAssetsList.Clear();
|
||||||
parsedAssetsList = filteredAssets;
|
parsedAssetsList = filteredAssets;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user