From b4c5b220efbef06b748d2e6350944528cca9946e Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sun, 22 Jul 2018 23:46:49 -0700 Subject: [PATCH] Progress => FileProtection This also implements a sample usage in the Test program --- BurnOutSharp/{Progress.cs => FileProtection.cs} | 4 ++-- Test/Program.cs | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) rename BurnOutSharp/{Progress.cs => FileProtection.cs} (74%) diff --git a/BurnOutSharp/Progress.cs b/BurnOutSharp/FileProtection.cs similarity index 74% rename from BurnOutSharp/Progress.cs rename to BurnOutSharp/FileProtection.cs index 34c408ad..63311b89 100644 --- a/BurnOutSharp/Progress.cs +++ b/BurnOutSharp/FileProtection.cs @@ -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; diff --git a/Test/Program.cs b/Test/Program.cs index 5ada2951..1c2fade1 100644 --- a/Test/Program.cs +++ b/Test/Program.cs @@ -8,12 +8,19 @@ namespace Test { static void Main(string[] args) { + var p = new Progress(); + 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}"); + } } }