2018-07-16 17:10:45 -07:00
|
|
|
|
using System;
|
2020-09-10 21:10:32 -07:00
|
|
|
|
using System.IO;
|
2020-10-31 14:16:51 -07:00
|
|
|
|
using System.Linq;
|
2018-07-16 17:10:45 -07:00
|
|
|
|
using BurnOutSharp;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Test
|
|
|
|
|
|
{
|
|
|
|
|
|
class Program
|
|
|
|
|
|
{
|
|
|
|
|
|
static void Main(string[] args)
|
|
|
|
|
|
{
|
2020-10-31 14:00:31 -07:00
|
|
|
|
// Create progress indicator
|
2018-07-22 23:46:49 -07:00
|
|
|
|
var p = new Progress<FileProtection>();
|
|
|
|
|
|
p.ProgressChanged += Changed;
|
2020-10-31 14:00:31 -07:00
|
|
|
|
|
|
|
|
|
|
// Create scanner to be shared
|
|
|
|
|
|
var scanner = new Scanner(p)
|
|
|
|
|
|
{
|
|
|
|
|
|
IncludePosition = true,
|
|
|
|
|
|
ScanAllFiles = false,
|
|
|
|
|
|
ScanArchives = true,
|
2020-10-31 14:48:25 -07:00
|
|
|
|
ScanPackers = true,
|
2020-10-31 14:00:31 -07:00
|
|
|
|
};
|
|
|
|
|
|
|
2018-07-16 17:10:45 -07:00
|
|
|
|
foreach (string arg in args)
|
|
|
|
|
|
{
|
2020-10-31 14:00:31 -07:00
|
|
|
|
var protections = scanner.GetProtections(arg);
|
|
|
|
|
|
if (protections != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
using (StreamWriter sw = new StreamWriter(File.OpenWrite($"{DateTime.Now:yyyy-MM-dd_HHmmss}.txt")))
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (string key in protections.Keys)
|
|
|
|
|
|
{
|
2020-10-31 14:16:51 -07:00
|
|
|
|
// Skip over files with no protection
|
|
|
|
|
|
if (protections[key] == null || !protections[key].Any())
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
2020-10-31 14:00:31 -07:00
|
|
|
|
string line = $"{key}: {string.Join(", ", protections[key])}";
|
|
|
|
|
|
Console.WriteLine(line);
|
|
|
|
|
|
sw.WriteLine(line);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
2020-09-10 21:10:32 -07:00
|
|
|
|
{
|
2020-10-31 14:00:31 -07:00
|
|
|
|
Console.WriteLine($"No protections found for {arg}");
|
2020-09-10 21:10:32 -07:00
|
|
|
|
}
|
2018-07-16 17:10:45 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-09-10 21:10:32 -07:00
|
|
|
|
Console.WriteLine("Press any button to close...");
|
2018-07-16 17:10:45 -07:00
|
|
|
|
Console.ReadLine();
|
|
|
|
|
|
}
|
2018-07-22 23:46:49 -07:00
|
|
|
|
|
|
|
|
|
|
private static void Changed(object source, FileProtection value)
|
|
|
|
|
|
{
|
2019-09-29 12:08:31 -07:00
|
|
|
|
Console.WriteLine($"{value.Percentage * 100:N2}%: {value.Filename} - {value.Protection}");
|
2018-07-22 23:46:49 -07:00
|
|
|
|
}
|
2018-07-16 17:10:45 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|