|
@@ -18,8 +18,11 @@ namespace SevenRepacker
|
|
|
SevenZipBase.SetLibraryPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "7z.dll"));
|
|
|
#endif
|
|
|
string outDir = null;
|
|
|
+ var banPrefix = new List<string>();
|
|
|
+ string password = null;
|
|
|
|
|
|
var inputFiles = new List<string>();
|
|
|
+
|
|
|
foreach (var arg in args)
|
|
|
{
|
|
|
if (arg.StartsWith('/') && arg.Contains(':') && arg[^1] != ':')
|
|
@@ -35,6 +38,12 @@ namespace SevenRepacker
|
|
|
return -1;
|
|
|
}
|
|
|
break;
|
|
|
+ case "ban-prefix":
|
|
|
+ banPrefix.Add(kv[1]);
|
|
|
+ break;
|
|
|
+ case "pass":
|
|
|
+ password = kv[1];
|
|
|
+ break;
|
|
|
}
|
|
|
continue;
|
|
|
}
|
|
@@ -67,7 +76,10 @@ namespace SevenRepacker
|
|
|
Console.WriteLine($" In: {inputFilePath}");
|
|
|
Console.WriteLine($" Out: {outputFilePath}");
|
|
|
|
|
|
- using var inputArchive = new SevenZipExtractor(inputFilePath);
|
|
|
+ using var inputArchive = password == null
|
|
|
+ ? new SevenZipExtractor(inputFilePath)
|
|
|
+ : new SevenZipExtractor(inputFilePath, password);
|
|
|
+
|
|
|
var inputItems = inputArchive.ArchiveFileData.OrderBy(p => p.Index).ToArray();
|
|
|
|
|
|
var streamDict = new Dictionary<string, Stream>();
|
|
@@ -75,6 +87,22 @@ namespace SevenRepacker
|
|
|
foreach (var item in inputItems)
|
|
|
{
|
|
|
if (item.IsDirectory) continue;
|
|
|
+ var ban = false;
|
|
|
+
|
|
|
+ foreach (var prefix in banPrefix)
|
|
|
+ {
|
|
|
+ if (item.FileName.StartsWith(prefix))
|
|
|
+ {
|
|
|
+ ban = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ban)
|
|
|
+ {
|
|
|
+ Console.WriteLine($"Banned: {item.FileName}");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
streamDict.Add(item.FileName, new BridgeStream(1, (long?)item.Size, inputArchive, item.Index));
|
|
|
}
|