Progress => FileProtection

This also implements a sample usage in the Test program
This commit is contained in:
Matt Nadareski
2018-07-22 23:46:49 -07:00
parent 413652f92a
commit b4c5b220ef
2 changed files with 10 additions and 3 deletions

View File

@@ -1,12 +1,12 @@
namespace BurnOutSharp
{
public class Progress
public class FileProtection
{
public string Filename { get; private set; }
public float Percentage { get; private set; }
public string Protection { get; private set; }
public Progress(string filename, float percentage, string protection)
public FileProtection(string filename, float percentage, string protection)
{
this.Filename = filename;
this.Percentage = percentage;

View File

@@ -8,12 +8,19 @@ namespace Test
{
static void Main(string[] args)
{
var p = new Progress<FileProtection>();
p.ProgressChanged += Changed;
foreach (string arg in args)
{
Console.WriteLine(String.Join("\r\n", ProtectionFind.Scan(arg).Select(kvp => kvp.Key + ": " + kvp.Value)));
Console.WriteLine(String.Join("\r\n", ProtectionFind.Scan(arg, p).Select(kvp => kvp.Key + ": " + kvp.Value)));
}
Console.ReadLine();
}
private static void Changed(object source, FileProtection value)
{
Console.WriteLine($"{value.Percentage * 100}: {value.Filename} - {value.Protection}");
}
}
}