From 71fd5af48e7599f3f4abc956fcf1674717d46205 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 18 Sep 2023 00:33:24 -0400 Subject: [PATCH] Move some classes to new library --- {BurnOutSharp => BinaryObjectScanner}/Factory.cs | 12 ++++++++++-- {BurnOutSharp => BinaryObjectScanner}/Options.cs | 2 +- .../ProtectionProgress.cs | 14 +++++++++++++- BurnOutSharp/Scanner.cs | 1 + Test/Program.cs | 1 + Test/Protector.cs | 1 + 6 files changed, 27 insertions(+), 4 deletions(-) rename {BurnOutSharp => BinaryObjectScanner}/Factory.cs (94%) rename {BurnOutSharp => BinaryObjectScanner}/Options.cs (96%) rename {BurnOutSharp => BinaryObjectScanner}/ProtectionProgress.cs (77%) diff --git a/BurnOutSharp/Factory.cs b/BinaryObjectScanner/Factory.cs similarity index 94% rename from BurnOutSharp/Factory.cs rename to BinaryObjectScanner/Factory.cs index ca42142c..4bf53da3 100644 --- a/BurnOutSharp/Factory.cs +++ b/BinaryObjectScanner/Factory.cs @@ -1,14 +1,18 @@ using BinaryObjectScanner.Interfaces; using BinaryObjectScanner.Utilities; -namespace BurnOutSharp +namespace BinaryObjectScanner { - internal static class Factory + public static class Factory { /// /// Create an instance of a detectable based on file type /// +#if NET48 public static IDetectable CreateDetectable(SupportedFileType fileType) +#else + public static IDetectable? CreateDetectable(SupportedFileType fileType) +#endif { switch (fileType) { @@ -29,7 +33,11 @@ namespace BurnOutSharp /// /// Create an instance of an extractable based on file type /// +#if NET48 public static IExtractable CreateExtractable(SupportedFileType fileType) +#else + public static IExtractable? CreateExtractable(SupportedFileType fileType) +#endif { switch (fileType) { diff --git a/BurnOutSharp/Options.cs b/BinaryObjectScanner/Options.cs similarity index 96% rename from BurnOutSharp/Options.cs rename to BinaryObjectScanner/Options.cs index 559682b9..9a9af387 100644 --- a/BurnOutSharp/Options.cs +++ b/BinaryObjectScanner/Options.cs @@ -1,4 +1,4 @@ -namespace BurnOutSharp +namespace BinaryObjectScanner { /// /// Scanning options diff --git a/BurnOutSharp/ProtectionProgress.cs b/BinaryObjectScanner/ProtectionProgress.cs similarity index 77% rename from BurnOutSharp/ProtectionProgress.cs rename to BinaryObjectScanner/ProtectionProgress.cs index 6330e740..e3f23837 100644 --- a/BurnOutSharp/ProtectionProgress.cs +++ b/BinaryObjectScanner/ProtectionProgress.cs @@ -1,4 +1,4 @@ -namespace BurnOutSharp +namespace BinaryObjectScanner { /// /// Struct representing protection scanning progress @@ -8,17 +8,29 @@ /// /// Filename to report progress for /// +#if NET48 public string Filename { get; private set; } +#else + public string Filename { get; init; } +#endif /// /// Value between 0 and 1 representign the percentage completed /// +#if NET48 public float Percentage { get; private set; } +#else + public float Percentage { get; init; } +#endif /// /// Protection information to report /// +#if NET48 public string Protection { get; private set; } +#else + public string Protection { get; init; } +#endif public ProtectionProgress(string filename, float percentage, string protection) { diff --git a/BurnOutSharp/Scanner.cs b/BurnOutSharp/Scanner.cs index 9cd9b0a8..653f3689 100644 --- a/BurnOutSharp/Scanner.cs +++ b/BurnOutSharp/Scanner.cs @@ -5,6 +5,7 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using BinaryObjectScanner; using BinaryObjectScanner.FileType; using BinaryObjectScanner.Interfaces; using BinaryObjectScanner.Utilities; diff --git a/Test/Program.cs b/Test/Program.cs index b237fc4c..b146d2ac 100644 --- a/Test/Program.cs +++ b/Test/Program.cs @@ -1,5 +1,6 @@ using System; using System.Text; +using BinaryObjectScanner; using BurnOutSharp; namespace Test diff --git a/Test/Protector.cs b/Test/Protector.cs index cd0e5ba0..e047316d 100644 --- a/Test/Protector.cs +++ b/Test/Protector.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Concurrent; using System.IO; using System.Linq; +using BinaryObjectScanner; using BurnOutSharp; namespace Test